/home/lnzliplg/public_html/scripts.tar
pdeps.py000075500000007540151732701160006245 0ustar00#! /usr/bin/python2.7

# pdeps
#
# Find dependencies between a bunch of Python modules.
#
# Usage:
#       pdeps file1.py file2.py ...
#
# Output:
# Four tables separated by lines like '--- Closure ---':
# 1) Direct dependencies, listing which module imports which other modules
# 2) The inverse of (1)
# 3) Indirect dependencies, or the closure of the above
# 4) The inverse of (3)
#
# To do:
# - command line options to select output type
# - option to automatically scan the Python library for referenced modules
# - option to limit output to particular modules


import sys
import re
import os


# Main program
#
def main():
    args = sys.argv[1:]
    if not args:
        print 'usage: pdeps file.py file.py ...'
        return 2
    #
    table = {}
    for arg in args:
        process(arg, table)
    #
    print '--- Uses ---'
    printresults(table)
    #
    print '--- Used By ---'
    inv = inverse(table)
    printresults(inv)
    #
    print '--- Closure of Uses ---'
    reach = closure(table)
    printresults(reach)
    #
    print '--- Closure of Used By ---'
    invreach = inverse(reach)
    printresults(invreach)
    #
    return 0


# Compiled regular expressions to search for import statements
#
m_import = re.compile('^[ \t]*from[ \t]+([^ \t]+)[ \t]+')
m_from = re.compile('^[ \t]*import[ \t]+([^#]+)')


# Collect data from one file
#
def process(filename, table):
    fp = open(filename, 'r')
    mod = os.path.basename(filename)
    if mod[-3:] == '.py':
        mod = mod[:-3]
    table[mod] = list = []
    while 1:
        line = fp.readline()
        if not line: break
        while line[-1:] == '\\':
            nextline = fp.readline()
            if not nextline: break
            line = line[:-1] + nextline
        if m_import.match(line) >= 0:
            (a, b), (a1, b1) = m_import.regs[:2]
        elif m_from.match(line) >= 0:
            (a, b), (a1, b1) = m_from.regs[:2]
        else: continue
        words = line[a1:b1].split(',')
        # print '#', line, words
        for word in words:
            word = word.strip()
            if word not in list:
                list.append(word)


# Compute closure (this is in fact totally general)
#
def closure(table):
    modules = table.keys()
    #
    # Initialize reach with a copy of table
    #
    reach = {}
    for mod in modules:
        reach[mod] = table[mod][:]
    #
    # Iterate until no more change
    #
    change = 1
    while change:
        change = 0
        for mod in modules:
            for mo in reach[mod]:
                if mo in modules:
                    for m in reach[mo]:
                        if m not in reach[mod]:
                            reach[mod].append(m)
                            change = 1
    #
    return reach


# Invert a table (this is again totally general).
# All keys of the original table are made keys of the inverse,
# so there may be empty lists in the inverse.
#
def inverse(table):
    inv = {}
    for key in table.keys():
        if not inv.has_key(key):
            inv[key] = []
        for item in table[key]:
            store(inv, item, key)
    return inv


# Store "item" in "dict" under "key".
# The dictionary maps keys to lists of items.
# If there is no list for the key yet, it is created.
#
def store(dict, key, item):
    if dict.has_key(key):
        dict[key].append(item)
    else:
        dict[key] = [item]


# Tabulate results neatly
#
def printresults(table):
    modules = table.keys()
    maxlen = 0
    for mod in modules: maxlen = max(maxlen, len(mod))
    modules.sort()
    for mod in modules:
        list = table[mod]
        list.sort()
        print mod.ljust(maxlen), ':',
        if mod in list:
            print '(*)',
        for ref in list:
            print ref,
        print


# Call main and honor exit status
if __name__ == '__main__':
    try:
        sys.exit(main())
    except KeyboardInterrupt:
        sys.exit(1)
reindent.pyc000064400000022635151732701160007104 0ustar00�
�fc@s�dZdZddlZddlZddlZddlZddlZdadada	e
add�Z
d�Zd�Zd�Zd	�Zd
d�Zddd
��YZd�Zedkr�e�ndS(sAreindent [-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.
t1i����NicCs-|dk	rtj|IJntjtIJdS(N(tNonetsyststderrt__doc__(tmsg((s./usr/lib64/python2.7/Tools/scripts/reindent.pytusage6scGsKd}x.|D]&}tjj|t|��d}q
Wtjjd�dS(Ntt s
(RRtwritetstr(targstseptarg((s./usr/lib64/python2.7/Tools/scripts/reindent.pyterrprint;s


cCsEddl}y5|jtjdddddddg�\}}Wn!|jk
rd}t|�dSXx�|D]�\}}|dkr�td7aql|dkr�td7aql|dkr�taql|dkr�t	d7a	ql|dkrlt�dSqlW|s&t
tj�}|j�|j
tj�dSx|D]}t|�q-WdS(Ni����itdrnvhtdryruntrecursetnobackuptverbosethelps-ds--dryruns-rs	--recurses-ns
--nobackups-vs	--verboses-hs--help(s-ds--dryrun(s-rs	--recurse(s-ns
--nobackup(s-vs	--verbose(s-hs--help(tgetoptRtargvterrorRRRtFalset
makebackupRt
ReindentertstdintrunR	tstdouttcheck(RtoptsRRtotatrR
((s./usr/lib64/python2.7/Tools/scripts/reindent.pytmainBs4"


	


c	Cs6tjj|�r�tjj|�r�tr7dG|GHntj|�}x�|D]�}tjj||�}tr�tjj|�r�tjj|�r�tjj|�dj	d�s�|j
�jd�rMt|�qMqMWdStr�dG|GdGnyt
|d�}Wn.tk
r5}td|t|�f�dSXt|�}|j�|j}t|t�rvtd	|�dS|j�r tr�d
GHtr�dGHq�nts|d}tr�tj||�tr�d
G|GdG|GHq�nt
|d�}|j|�|j�trdG|GHqntStr.dGHntSdS(Nslisting directoryit.s.pytcheckings...trbs%s: I/O Error: %ss0%s: mixed newlines detected; cannot process fileschanged.s+But this is a dry run, so leaving it alone.s.baks	backed upttotwbs	wrote news
unchanged.(tostpathtisdirtislinkRtlistdirtjoinRtsplitt
startswithtlowertendswithRtopentIOErrorRR
Rtclosetnewlinest
isinstancettupleRRRtshutiltcopyfileR	tTrueR(	tfiletnamestnametfullnametfRR"tnewlinetbak((s./usr/lib64/python2.7/Tools/scripts/reindent.pyR_sZ%
 
	


cCsWd�|D�}|jd�tt|��}|s9dSt|�dkrS|dS|S(NcSsXh|]N}|ddkr"dn/|ddkr8dn|ddkrNdnd�qS(i����s
i����s
s
R((t.0tline((s./usr/lib64/python2.7/Tools/scripts/reindent.pys	<setcomp>�s	Rs
ii(tdiscardR8tsortedtlen(tlinesR6((s./usr/lib64/python2.7/Tools/scripts/reindent.pyt_detect_newlines�s

s
 	cCsEt|�}x.|dkr<||d|kr<|d8}qW|| S(sReturn 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>.
    ii(RG(RDtJUNKti((s./usr/lib64/python2.7/Tools/scripts/reindent.pyt_rstrip�s#RcBsSeZd�Zd�Zd�Zd�Zejejej	ej
ejd�ZRS(cCs�d|_d|_|j�|_t|j�|_t|jt�rX|jd|_n|j|_g|jD]}t	|�j
�|j^qn|_|jjdd�d|_g|_dS(Nii(t	find_stmttlevelt	readlinestrawRIR6R7R8RARLt
expandtabsRHtinsertRtindextstats(tselfR@RD((s./usr/lib64/python2.7/Tools/scripts/reindent.pyt__init__�s		/	cCstj|j|j�|j}x'|rH|d|jkrH|j�q"W|j}|jt|�df�i}g}|_	|dd}|j
|d|!�xftt|�d�D]N}||\}}||dd}t||�}	|d}
|
dkr.|	r%|j
|	d�}
|
dkr�xkt|dt|�d�D]I}||\}}
|
dkrG|	t||�kr�|
d}
nPqGqGWn|
dkr
xgt|ddd�D]L}||\}}
|
dkr�|	t||d�t||�}
Pq�q�Wn|
dkr+|	}
q+q.d}
n|
dks@t�|
||	<|
|	}|dksl|	dkr�|j
|||!�q�x|||!D]p}|dkr�||jkr�|j|�q|jd||�q�tt|�|�}|j||�q�Wq�W|j|j	kS(Ni����iiiR(ttokenizetgetlinet
tokeneaterRHRAtpopRTtappendRGtaftertextendtranget	getlspacetgettxrangetAssertionErrortminRP(RURHRTt	have2wantR\RKtthisstmtt	thisleveltnextstmtthavetwanttjtjlinetjleveltdiffRDtremove((s./usr/lib64/python2.7/Tools/scripts/reindent.pyR�s`		

$
	

cCs|j|j�dS(N(t
writelinesR\(RUR@((s./usr/lib64/python2.7/Tools/scripts/reindent.pyR	scCsD|jt|j�kr!d}n|j|j}|jd7_|S(NRi(RSRGRH(RURD((s./usr/lib64/python2.7/Tools/scripts/reindent.pyRXs
	c
Cs�|\}}||kr$d|_n�||krKd|_|jd7_n�||krrd|_|jd8_nw||	kr�|jr�|jj|df�q�nF||
kr�n7|jr�d|_|r�|jj||jf�q�ndS(Nii����i(RMRNRTR[(
RUttypettokent.3tendRDtINDENTtDEDENTtNEWLINEtCOMMENTtNLtslinetscol((s./usr/lib64/python2.7/Tools/scripts/reindent.pyRYs$						(
t__name__t
__module__RVRR	RXRWRtRuRvRwRxRY(((s./usr/lib64/python2.7/Tools/scripts/reindent.pyR�s		E		
cCsDdt|�}}x*||kr?||dkr?|d7}qW|S(NiRi(RG(RDRKtn((s./usr/lib64/python2.7/Tools/scripts/reindent.pyR_Fst__main__((Rt__version__RWR)R9RtioRRRR;RRRRR#RRIRLRR_R{(((s./usr/lib64/python2.7/Tools/scripts/reindent.pyt<module>(s&			4	
�	classfix.pyc000064400000010135151732701160007100 0ustar00�
�fc@s�ddlZddlZddlZddlTejjZeZejjZ	d�Z
ejd�Zd�Z
d�Zd�ZdZeje�Zd	Zeje�Zd
�Zedkr�e
�ndS(i����N(t*cCs�d}tjds<tdtjdd�tjd�nx}tjdD]n}tjj|�rzt|�r�d}q�qJtjj|�r�t|d�d}qJt	|�rJd}qJqJWtj|�dS(Niisusage: s file-or-directory ...
is": will not process symbolic links
(
tsystargvterrtexittostpathtisdirtrecursedowntislinktfix(tbadtarg((s./usr/lib64/python2.7/Tools/scripts/classfix.pytmain)s
	
s^[a-zA-Z0-9_]+\.py$cCstj|�dkS(Ni(tispythonprogtmatch(tname((s./usr/lib64/python2.7/Tools/scripts/classfix.pytispython9scCs1td|f�d}ytj|�}Wn+tjk
rW}td||f�dSX|j�g}x�|D]�}|tjtjfkr�qontjj	||�}tjj
|�r�qotjj|�r�|j|�qot
|�rot|�rd}qqoqoWx#|D]}t|�rd}qqW|S(Nsrecursedown(%r)
is%s: cannot list directory: %r
i(tdbgRtlistdirterrorRtsorttcurdirtpardirRtjoinR	RtappendRR
R(tdirnameRtnamestmsgtsubdirsRtfullname((s./usr/lib64/python2.7/Tools/scripts/classfix.pyR<s0



cCs�yt|d�}Wn(tk
r=}td||f�dSXtjj|�\}}tjj|d|�}d}d}xG|j�}|s�Pn|d}x>|ddkr�|j�}	|	s�Pn||	}|d}q�Wt	|�}
|
|kr�|dkrryt|d�}Wn2tk
rJ}|j
�td	||f�dSX|jd�d}t|d
�q~ntt
|�d�td|�td
|
�n|dk	r~|j|
�q~q~W|j
�|s�dSy+tj|�}tj||td@�Wn*tjk
r0}td||f�nXytj||d�Wn*tjk
ru}td||f�nXytj||�Wn+tjk
r�}td||f�dSXdS(Ntrs%s: cannot open: %r
it@ii����s\
tws%s: cannot create: %r
s:
s
s< s> i�s%s: warning: chmod failed (%r)
t~s %s: warning: backup failed (%r)
s%s: rename failed (%r)
(topentIOErrorRRRtsplitRtNonetreadlinetfixlinetclosetseektreptreprtwritetstattchmodtST_MODERtrename(tfilenametfRtheadttailttempnametgtlinenotlinetnextlinetnewlinetstatbuf((s./usr/lib64/python2.7/Tools/scripts/classfix.pyR
Rsp




s-^([ 	]*class +[a-zA-Z0-9_]+) *( *) *((=.*)?):s^ *(.*) *( *) *$cCstj|�dkr|Stjd \\}}\}}\}}|| }||}||krm|d|S||d|!}	|	jd�}
x^tt|
��D]J}tj|
|�dkr�tjd\}}
|
|||
!|
|<q�q�Wdj|
�}	|d|	d|S(	Niit:it,s, t(s):(t	classprogRtregsR%trangetlentbaseprogR(R9ta0tb0ta1tb1ta2tb2R4R5tbaseparttbasestitx1ty1((s./usr/lib64/python2.7/Tools/scripts/classfix.pyR(�s(

t__main__(RtreRR.tstderrR-RRtstdoutR+R
tcompileRRRR
t	classexprR@tbaseexprRDR(t__name__(((s./usr/lib64/python2.7/Tools/scripts/classfix.pyt<module> s$
				E	gprof2html.pyo000064400000004345151732701160007372 0ustar00�
�fc@szdZddlZddlZddlZddlZddlZdZdZd�Zd�Z	e
dkrve	�ndS(s+Transform gprof(1) output into useful HTML.i����NsF<html>
<head>
  <title>gprof output (%s)</title>
</head>
<body>
<pre>
s</pre>
</body>
</html>
ccs#x|D]}tj|�VqWdS(N(tcgitescape(tinputtline((s0/usr/lib64/python2.7/Tools/scripts/gprof2html.pytadd_escapess
cCs�d}tjdr#tjd}n|d}tt|��}t|d�}|jt|�x.|D]&}|j|�|jd�rfPqfqfWi}xv|D]n}tjd|�}|s�|j|�Pn|j	dd�\}}|||<|jd||||f�q�Wx.|D]&}|j|�|jd	�rPqqWx�|D]�}tjd
|�}|s�|j|�|jd�rGPqGqGn|j	ddd�\}	}}
||kr�|j|�qGn|jd
�r�|jd|	||||
f�qG|jd|	|||
f�qGWxW|D]O}xFtj
d|�D]2}||kr`d||f}n|j|�q;Wq"W|jt�|j�t
jdtjj|��dS(Ns	gprof.outis.htmltws times
(.*  )(\w+)\nis+%s<a name="flat:%s" href="#call:%s">%s</a>
sindex % times*(.*  )(\w+)(( &lt;cycle.*&gt;)? \[\d+\])\nsIndex by function nameit[s-%s<a name="call:%s" href="#flat:%s">%s</a>%s
s%s<a href="#call:%s">%s</a>%s
s(\w+(?:\.c)?|\W+)s<a href="#call:%s">%s</a>sfile:(tsystargvRtfiletwritetheadert
startswithtretmatchtgrouptfindallttrailertcloset
webbrowsertopentostpathtabspath(tfilenametoutputfilenameRtoutputRtlabelstmtstufftfnametprefixtsuffixtpart((s0/usr/lib64/python2.7/Tools/scripts/gprof2html.pytmainsb






	




		


t__main__(t__doc__R
RRRRRRRR"t__name__(((s0/usr/lib64/python2.7/Tools/scripts/gprof2html.pyt<module>s<			4fixcid.pyo000064400000017253151732701170006557 0ustar00�
�fc@s�ddlZddlZddlZddlTddlZejjZeZej	jZ
d�Zd�ZdZ
d�Zd�Zd�Zd	Zd
ZdZdZd
ZdZdZdZededeZdZdedZdeZedeZedeZeeeeefZddj e�dZ!ej"e!�Z#eeefZ$ddj e$�dZ%ej"e%�Z&d�Z'd�Z(da)d�Z*da+d�Z,iZ-iZ.d�Z/e0dkr�e�ndS(i����N(t*cCs�tjd}td|d�td�td�td�td�td�td�td	�td
�td�td�dS(
NisUsage: s/ [-c] [-r] [-s file] ... file-or-directory ...
s
s*-c           : substitute inside comments
s:-r           : reverse direction for following -s options
s+-s substfile : add a file of substitutions
s<Each non-empty non-comment line in a substitution file must
s>contain exactly two words: an identifier and its replacement.
s:Comments start with a # character and end at end of line.
s=If an identifier is preceded with a *, it is not substituted
s,inside a comment even when -c is specified.
(tsystargvterr(tprogname((s,/usr/lib64/python2.7/Tools/scripts/fixcid.pytusage/s










cCsqy#tjtjdd�\}}WnBtjk
rg}tdt|�d�t�tjd�nXd}|s�t�tjd�nxY|D]Q\}}|dkr�t�n|dkr�t	�n|d	kr�t
|�q�q�Wxv|D]n}tjj
|�rt|�r\d}q\q�tjj|�rGt|d
�d}q�t|�r�d}q�q�Wtj|�dS(Niscrs:sOptions error: s
iis-cs-rs-ss": will not process symbolic links
(tgetoptRRterrorRtstrRtexitt
setdocommentst
setreversetaddsubsttostpathtisdirtrecursedowntislinktfix(toptstargstmsgtbadtopttarg((s,/usr/lib64/python2.7/Tools/scripts/fixcid.pytmain>s6#


	
s^[a-zA-Z0-9_]+\.[ch]$cCstjt|�S(N(tretmatchtWanted(tname((s,/usr/lib64/python2.7/Tools/scripts/fixcid.pytwanted\scCs9td|f�d}ytj|�}Wn3tjk
r_}t|dt|�d�dSX|j�g}x�|D]�}|tjtjfkr�qwntj	j
||�}tj	j|�r�qwtj	j|�r�|j
|�qwt|�rwt|�rd}qqwqwWx#|D]}t|�rd}qqW|S(Nsrecursedown(%r)
is: cannot list directory: s
i(tdbgR
tlistdirRRRtsorttcurdirtpardirRtjoinRRtappendRRR(tdirnameRtnamesRtsubdirsRtfullname((s,/usr/lib64/python2.7/Tools/scripts/fixcid.pyR_s0



cCs-|dkr!tj}tj}n}yt|d�}Wn0tk
rf}t|dt|�d�dSXtjj	|�\}}tjj
|d|�}d}d}t�xV|j
�}|s�Pn|d}x>|dd	kr|j
�}	|	s�Pn||	}|d}q�Wt|�}
|
|kr�|dkr�yt|d
�}Wn:tk
r�}|j�t|dt|�d�dSX|jd�d}t�t|d�q�ntt|�d�td
|�td|
�n|dk	r�|j|
�q�q�W|dkrdS|j�|s(dS|j�y+tj|�}tj||td@�Wn2tjk
r�}t|dt|�d�nXytj||d�Wn2tjk
r�}t|dt|�d�nXytj||�Wn3tjk
r(}t|dt|�d�dSXdS(Nt-trs: cannot open: s
it@ii����s\
tws: cannot create: s:
s< s> i�s: warning: chmod failed (s)
t~s: warning: backup failed (s: rename failed ((RtstdintstdouttopentIOErrorRRR
RtsplitR$tNonetinitfixlinetreadlinetfixlinetclosetseektreptreprtwritetstattchmodtST_MODERtrename(tfilenametftgRtheadttailttempnametlinenotlinetnextlinetnewlinetstatbuf((s,/usr/lib64/python2.7/Tools/scripts/fixcid.pyRus�	





  s (struct )?[a-zA-Z_][a-zA-Z0-9_]+s"([^\n\\"]|\\.)*"s'([^\n\\']|\\.)*'s/\*s\*/s0[xX][0-9a-fA-F]*[uUlL]*s0[0-7]*[uUlL]*s[1-9][0-9]*[uUlL]*t|s[eE][-+]?[0-9]+s([0-9]+\.[0-9]*|\.[0-9]+)(s)?s[0-9]+t(t)cCs
tadS(N(tOutsideCommentProgramtProgram(((s,/usr/lib64/python2.7/Tools/scripts/fixcid.pyR5�scCs7d}x*|t|�kr2tj||�}|dkr=Pn|j�}|jd�}t|�dkr�|dkrtaq�|dkr�taq�nt|�}|tkr%t|}ttkr�t	s�dG|GH||}q	n|t
kr�|}q�n|| ||||}t|�}n||}q	W|S(Niis/*s*/sFound in comment:(tlenRPtsearchR4tstarttgrouptInsideCommentProgramROtDictt
DocommentstNotInComment(RHtiRtfoundtntsubst((s,/usr/lib64/python2.7/Tools/scripts/fixcid.pyR7�s4	
	
icCs
dadS(Ni(RW(((s,/usr/lib64/python2.7/Tools/scripts/fixcid.pyR
scCstadS(N(tReverse(((s,/usr/lib64/python2.7/Tools/scripts/fixcid.pyRsc	Cs�yt|d�}Wn<tk
rQ}t|dt|�d�tjd�nXd}x�|j�}|sqPn|d}y|jd�}Wntk
r�d}nX|| j	�}|s�q[nt
|�dkr|dd	kr|dd
|dg|d*n3t
|�dkr9t|d|||f�q[ntrN|\}}n|\}}|dd
krw|d}n|dd
kr�|d}|t|<n|t
kr�td||||f�td||t
|f�n|t
|<q[W|j�dS(NR+s: cannot read substfile: s
iit#i����itstructt is%s:%r: warning: bad line: %rRs"%s:%r: warning: overriding: %r %r
s%s:%r: warning: previous: %r
(R1R2RRRR	R6tindext
ValueErrorR3RQR]RXRVR8(	t	substfiletfpRRGRHRYtwordstvaluetkey((s,/usr/lib64/python2.7/Tools/scripts/fixcid.pyRsH


" 


t__main__(1RRR
R=RtstderrR<RRR0R:RRRRRRt
IdentifiertStringtChartCommentStartt
CommentEndt	Hexnumbert	Octnumbert	Decnumbert	IntnumbertExponentt
PointfloattExpfloattFloatnumbertNumbertOutsideCommentR$tOutsideCommentPatterntcompileROt
InsideCommenttInsideCommentPatternRUR5R7RWR
R]RRVRXRt__name__(((s,/usr/lib64/python2.7/Tools/scripts/fixcid.pyt<module>%sX
					P
		'			%mailerdaemon.py000075500000017406151732701170007572 0ustar00#! /usr/bin/python2.7
"""mailerdaemon - classes to parse mailer-daemon messages"""

import rfc822
import calendar
import re
import os
import sys

Unparseable = 'mailerdaemon.Unparseable'

class ErrorMessage(rfc822.Message):
    def __init__(self, fp):
        rfc822.Message.__init__(self, fp)
        self.sub = ''

    def is_warning(self):
        sub = self.getheader('Subject')
        if not sub:
            return 0
        sub = sub.lower()
        if sub.startswith('waiting mail'): return 1
        if 'warning' in sub: return 1
        self.sub = sub
        return 0

    def get_errors(self):
        for p in EMPARSERS:
            self.rewindbody()
            try:
                return p(self.fp, self.sub)
            except Unparseable:
                pass
        raise Unparseable

# List of re's or tuples of re's.
# If a re, it should contain at least a group (?P<email>...) which
# should refer to the email address.  The re can also contain a group
# (?P<reason>...) which should refer to the reason (error message).
# If no reason is present, the emparse_list_reason list is used to
# find a reason.
# If a tuple, the tuple should contain 2 re's.  The first re finds a
# location, the second re is repeated one or more times to find
# multiple email addresses.  The second re is matched (not searched)
# where the previous match ended.
# The re's are compiled using the re module.
emparse_list_list = [
    'error: (?P<reason>unresolvable): (?P<email>.+)',
    ('----- The following addresses had permanent fatal errors -----\n',
     '(?P<email>[^ \n].*)\n( .*\n)?'),
    'remote execution.*\n.*rmail (?P<email>.+)',
    ('The following recipients did not receive your message:\n\n',
     ' +(?P<email>.*)\n(The following recipients did not receive your message:\n\n)?'),
    '------- Failure Reasons  --------\n\n(?P<reason>.*)\n(?P<email>.*)',
    '^<(?P<email>.*)>:\n(?P<reason>.*)',
    '^(?P<reason>User mailbox exceeds allowed size): (?P<email>.+)',
    '^5\\d{2} <(?P<email>[^\n>]+)>\\.\\.\\. (?P<reason>.+)',
    '^Original-Recipient: rfc822;(?P<email>.*)',
    '^did not reach the following recipient\\(s\\):\n\n(?P<email>.*) on .*\n +(?P<reason>.*)',
    '^ <(?P<email>[^\n>]+)> \\.\\.\\. (?P<reason>.*)',
    '^Report on your message to: (?P<email>.*)\nReason: (?P<reason>.*)',
    '^Your message was not delivered to +(?P<email>.*)\n +for the following reason:\n +(?P<reason>.*)',
    '^ was not +(?P<email>[^ \n].*?) *\n.*\n.*\n.*\n because:.*\n +(?P<reason>[^ \n].*?) *\n',
    ]
# compile the re's in the list and store them in-place.
for i in range(len(emparse_list_list)):
    x = emparse_list_list[i]
    if type(x) is type(''):
        x = re.compile(x, re.MULTILINE)
    else:
        xl = []
        for x in x:
            xl.append(re.compile(x, re.MULTILINE))
        x = tuple(xl)
        del xl
    emparse_list_list[i] = x
    del x
del i

# list of re's used to find reasons (error messages).
# if a string, "<>" is replaced by a copy of the email address.
# The expressions are searched for in order.  After the first match,
# no more expressions are searched for.  So, order is important.
emparse_list_reason = [
    r'^5\d{2} <>\.\.\. (?P<reason>.*)',
    '<>\.\.\. (?P<reason>.*)',
    re.compile(r'^<<< 5\d{2} (?P<reason>.*)', re.MULTILINE),
    re.compile('===== stderr was =====\nrmail: (?P<reason>.*)'),
    re.compile('^Diagnostic-Code: (?P<reason>.*)', re.MULTILINE),
    ]
emparse_list_from = re.compile('^From:', re.IGNORECASE|re.MULTILINE)
def emparse_list(fp, sub):
    data = fp.read()
    res = emparse_list_from.search(data)
    if res is None:
        from_index = len(data)
    else:
        from_index = res.start(0)
    errors = []
    emails = []
    reason = None
    for regexp in emparse_list_list:
        if type(regexp) is type(()):
            res = regexp[0].search(data, 0, from_index)
            if res is not None:
                try:
                    reason = res.group('reason')
                except IndexError:
                    pass
                while 1:
                    res = regexp[1].match(data, res.end(0), from_index)
                    if res is None:
                        break
                    emails.append(res.group('email'))
                break
        else:
            res = regexp.search(data, 0, from_index)
            if res is not None:
                emails.append(res.group('email'))
                try:
                    reason = res.group('reason')
                except IndexError:
                    pass
                break
    if not emails:
        raise Unparseable
    if not reason:
        reason = sub
        if reason[:15] == 'returned mail: ':
            reason = reason[15:]
        for regexp in emparse_list_reason:
            if type(regexp) is type(''):
                for i in range(len(emails)-1,-1,-1):
                    email = emails[i]
                    exp = re.compile(re.escape(email).join(regexp.split('<>')), re.MULTILINE)
                    res = exp.search(data)
                    if res is not None:
                        errors.append(' '.join((email.strip()+': '+res.group('reason')).split()))
                        del emails[i]
                continue
            res = regexp.search(data)
            if res is not None:
                reason = res.group('reason')
                break
    for email in emails:
        errors.append(' '.join((email.strip()+': '+reason).split()))
    return errors

EMPARSERS = [emparse_list, ]

def sort_numeric(a, b):
    a = int(a)
    b = int(b)
    if a < b: return -1
    elif a > b: return 1
    else: return 0

def parsedir(dir, modify):
    os.chdir(dir)
    pat = re.compile('^[0-9]*$')
    errordict = {}
    errorfirst = {}
    errorlast = {}
    nok = nwarn = nbad = 0

    # find all numeric file names and sort them
    files = filter(lambda fn, pat=pat: pat.match(fn) is not None, os.listdir('.'))
    files.sort(sort_numeric)

    for fn in files:
        # Lets try to parse the file.
        fp = open(fn)
        m = ErrorMessage(fp)
        sender = m.getaddr('From')
        print '%s\t%-40s\t'%(fn, sender[1]),

        if m.is_warning():
            fp.close()
            print 'warning only'
            nwarn = nwarn + 1
            if modify:
                os.rename(fn, ','+fn)
##              os.unlink(fn)
            continue

        try:
            errors = m.get_errors()
        except Unparseable:
            print '** Not parseable'
            nbad = nbad + 1
            fp.close()
            continue
        print len(errors), 'errors'

        # Remember them
        for e in errors:
            try:
                mm, dd = m.getdate('date')[1:1+2]
                date = '%s %02d' % (calendar.month_abbr[mm], dd)
            except:
                date = '??????'
            if not errordict.has_key(e):
                errordict[e] = 1
                errorfirst[e] = '%s (%s)' % (fn, date)
            else:
                errordict[e] = errordict[e] + 1
            errorlast[e] = '%s (%s)' % (fn, date)

        fp.close()
        nok = nok + 1
        if modify:
            os.rename(fn, ','+fn)
##          os.unlink(fn)

    print '--------------'
    print nok, 'files parsed,',nwarn,'files warning-only,',
    print nbad,'files unparseable'
    print '--------------'
    list = []
    for e in errordict.keys():
        list.append((errordict[e], errorfirst[e], errorlast[e], e))
    list.sort()
    for num, first, last, e in list:
        print '%d %s - %s\t%s' % (num, first, last, e)

def main():
    modify = 0
    if len(sys.argv) > 1 and sys.argv[1] == '-d':
        modify = 1
        del sys.argv[1]
    if len(sys.argv) > 1:
        for folder in sys.argv[1:]:
            parsedir(folder, modify)
    else:
        parsedir('/ufs/jack/Mail/errorsinbox', modify)

if __name__ == '__main__' or sys.argv[0] == __name__:
    main()
svneol.pyo000064400000005411151732701170006610 0ustar00�
�fc@s�dZddlZddlZd�Zd�Zejd�jZx�ejd�D]�\Z	Z
Zde
kr}e
jd�nx[eD]SZ
ee
�r�dee	e
�kr�ejje	e
�Zejd	e�q�q�q�WqRWdS(
s�
SVN helper script.

Try to set the svn:eol-style property to "native" on every .py, .txt, .c and
.h file in the directory tree rooted at the current directory.

Files with the svn:eol-style property already set (to anything) are skipped.

svn will itself refuse to set this property on a file that's not under SVN
control, or that has a binary mime-type property set.  This script inherits
that behavior, and passes on whatever warning message the failing "svn
propset" command produces.

In the Python project, it's safe to invoke this script from the root of
a checkout.

No output is produced for files that are ignored.  For a file that gets
svn:eol-style set, output looks like:

    property 'svn:eol-style' set on 'Lib\ctypes\__init__.py'

For a file not under version control:

    svn: warning: 'patch-finalizer.txt' is not under version control

and for a file with a binary mime-type property:

    svn: File 'Lib	est	est_pep263.py' has binary mime type property
i����NcCs�tjj|dd|d�}y4tttjj|dd��j�j��}Wntk
rggSX|d
kr�tjj|dd|d�tjj|dd|d�gStd	�dS(Ns.svntpropss	.svn-worktformatii	s	prop-bases	.svn-basesUnknown repository format(ii	(	tostpathtjointinttopentreadtstriptIOErrort
ValueError(troottfntdefaultR((s,/usr/lib64/python2.7/Tools/scripts/svneol.pyt	propfiles$s4
 c	Cs�g}x�t||�D]�}yt|�}Wntk
rBqnXx�|j�}|jd�rePnt|j�d�}|j|�}|j|�|j�|j�}t|j�d�}|j|�}|j�qFW|j	�qW|S(s=Return a list of property names for file fn in directory roottENDi(
RRR	treadlinet
startswithRtsplitRtappendtclose(	RRtresultRtftlinetLtkeytvalue((s,/usr/lib64/python2.7/Tools/scripts/svneol.pytproplist1s(


s\.([hc]|py|txt|sln|vcproj)$t.s.svns
svn:eol-styles%svn propset svn:eol-style native "%s"(t__doc__treRRRtcompiletsearchtpossible_text_filetwalkRtdirstfilestremoveRRRtsystem(((s,/usr/lib64/python2.7/Tools/scripts/svneol.pyt<module>s	
	!
treesync.pyc000064400000013546151732701170007132 0ustar00�
�fc@s�dZddlZddlZddlZddlZdZdZdadada	d�Z
d�Zd�ZdZ
d�Zd�Zd
�Zdddd�Zdd�Zedkr�e
�ndS(s�Script to synchronize two source trees.

Invoke with two arguments:

python treesync.py slave master

The assumption is that "master" contains CVS administration while
slave doesn't.  All files in the slave tree that have a CVS/Entries
entry in the master tree are synchronized.  This means:

    If the files differ:
        if the slave file is newer:
            normalize the slave file
            if the files still differ:
                copy the slave to the master
        else (the master is newer):
            copy the master to the slave

    normalizing the slave means replacing CRLF with LF when the master
    doesn't use CRLF

i����NtasktyestnocCs)tjtjdd�\}}x�|D]�\}}|dkrGd}n|dkr\d}n|dkrq|an|dkr�|an|d	kr�|an|d
kr�|}n|dkr&|}aaaq&q&Wy|\}}Wn0tk
rdGtjd
p	dGdGdGHdSXt||�dS(Nisnym:s:d:f:a:s-yRs-nRs-ss-ms-ds-fs-as
usage: pythonistreesync.pys5[-n] [-y] [-m y|n|a] [-s y|n|a] [-d y|n|a] [-f n|y|a]sslavedir masterdir(tgetopttsystargvtwrite_slavetwrite_mastertcreate_directoriest
ValueErrortprocess(toptstargstotatdefault_answertcreate_filestslavetmaster((s./usr/lib64/python2.7/Tools/scripts/treesync.pytmain#s0						
cCsYtjj|d�}tjj|�s9dG|GHdGHdSddGHdG|GHdG|GHtjj|�s�td|d	t�s�dG|GHd
G|GHdSdG|GHytj|�Wn(tjk
r�}dG|Gd
G|GHdSXdG|GHnd}g}tj	|�}x�|D]�}tjj||�}tjj||�}|dkrJ|}qtjj|�rtjj
|�r|j||f�qqW|r1tjj|d�}	x�t|	�j
�D]s}
|
jd�}|ddkr�|dr�|d}tjj||�}tjj||�}
t||
�q�q�Wnx!|D]\}}
t||
�q8WdS(NtCVSsskipping master subdirectorys-- not under CVSt-i(sslave Rscreate slave directory %s?tanswers-- no corresponding slavescreating slave directoryscan't make slave directoryt:smade slave directorytEntriest/iti(tostpathtjointisdirtokayRtmkdirterrortNonetlistdirtislinktappendtopent	readlinestsplittcompareR
(RRtcvsdirtmsgtsubdirstnamestnamet
masternamet	slavenametentriestetwordststm((s./usr/lib64/python2.7/Tools/scripts/treesync.pyR
?sT				
				
	%
cCs�yt|d�}Wntk
r,d}nXyt|d�}Wntk
rYd}nX|s�|ssdG|GHdSdG|GHt||dt�dS|s�dG|GHdS|r�|r�t||�r�dSnt|�}t|�}||kr)|j�|j�dG|GHdG|GHt||dt�dSd	G||Gd
GH|j	d�t
|�}|j�|j�|r�dGHt||ddt�nd
GHt||ddt�dS(NtrtrbsNeither master nor slave existssCreating missing slaveRsNot updating missing mastersMaster             sis newer than slavesSlave issseconds newer than masteris#***UPDATING MASTER (BINARY COPY)***s***UPDATING MASTER***(R&tIOErrorR"tcopyRt	identicaltmtimetcloseRtseekt
funnycharsR(RRtsftmftsfttmfttfun((s./usr/lib64/python2.7/Tools/scripts/treesync.pyR)msP



			

		


iicCsCx<|jt�}|jt�}||kr1dS|sPqqWdS(Nii(treadtBUFSIZE(R?R@tsdtmd((s./usr/lib64/python2.7/Tools/scripts/treesync.pyR:�scCs tj|j��}|tjS(N(RtfstattfilenotstattST_MTIME(tftst((s./usr/lib64/python2.7/Tools/scripts/treesync.pyR;�scCs@x9|jt�}|sPnd|ks4d|krdSqWdS(Ns
sii(RDRE(RLtbuf((s./usr/lib64/python2.7/Tools/scripts/treesync.pyR>�sR7twbcCs�dG|GHdG|GHtd|�s%dSt||�}t||�}x*|jt�}|s_Pn|j|�qFW|j�|j�dS(Ntcopyings     tosokay to copy? (RR&RDREtwriteR<(tsrctdsttrmodetwmodeRRLtgRN((s./usr/lib64/python2.7/Tools/scripts/treesync.pyR9�s		
cCs�|j�j�}|s)|ddkrYt|�}|j�j�}|sYt}qYn|d dkrmdS|d dkr�dSdGHt|�S(NitnyitytnsYes or No please -- try again:(tstriptlowert	raw_inputRR(tpromptR((s./usr/lib64/python2.7/Tools/scripts/treesync.pyR�st__main__i@(t__doc__RRRJRRRRRRRR
R)RER:R;R>R9Rt__name__(((s./usr/lib64/python2.7/Tools/scripts/treesync.pyt<module>s"0		.	.			treesync.py000075500000013227151732701170006766 0ustar00#! /usr/bin/python2.7

"""Script to synchronize two source trees.

Invoke with two arguments:

python treesync.py slave master

The assumption is that "master" contains CVS administration while
slave doesn't.  All files in the slave tree that have a CVS/Entries
entry in the master tree are synchronized.  This means:

    If the files differ:
        if the slave file is newer:
            normalize the slave file
            if the files still differ:
                copy the slave to the master
        else (the master is newer):
            copy the master to the slave

    normalizing the slave means replacing CRLF with LF when the master
    doesn't use CRLF

"""

import os, sys, stat, getopt

# Interactivity options
default_answer = "ask"
create_files = "yes"
create_directories = "no"
write_slave = "ask"
write_master = "ask"

def main():
    global always_no, always_yes
    global create_directories, write_master, write_slave
    opts, args = getopt.getopt(sys.argv[1:], "nym:s:d:f:a:")
    for o, a in opts:
        if o == '-y':
            default_answer = "yes"
        if o == '-n':
            default_answer = "no"
        if o == '-s':
            write_slave = a
        if o == '-m':
            write_master = a
        if o == '-d':
            create_directories = a
        if o == '-f':
            create_files = a
        if o == '-a':
            create_files = create_directories = write_slave = write_master = a
    try:
        [slave, master] = args
    except ValueError:
        print "usage: python", sys.argv[0] or "treesync.py",
        print "[-n] [-y] [-m y|n|a] [-s y|n|a] [-d y|n|a] [-f n|y|a]",
        print "slavedir masterdir"
        return
    process(slave, master)

def process(slave, master):
    cvsdir = os.path.join(master, "CVS")
    if not os.path.isdir(cvsdir):
        print "skipping master subdirectory", master
        print "-- not under CVS"
        return
    print "-"*40
    print "slave ", slave
    print "master", master
    if not os.path.isdir(slave):
        if not okay("create slave directory %s?" % slave,
                    answer=create_directories):
            print "skipping master subdirectory", master
            print "-- no corresponding slave", slave
            return
        print "creating slave directory", slave
        try:
            os.mkdir(slave)
        except os.error, msg:
            print "can't make slave directory", slave, ":", msg
            return
        else:
            print "made slave directory", slave
    cvsdir = None
    subdirs = []
    names = os.listdir(master)
    for name in names:
        mastername = os.path.join(master, name)
        slavename = os.path.join(slave, name)
        if name == "CVS":
            cvsdir = mastername
        else:
            if os.path.isdir(mastername) and not os.path.islink(mastername):
                subdirs.append((slavename, mastername))
    if cvsdir:
        entries = os.path.join(cvsdir, "Entries")
        for e in open(entries).readlines():
            words = e.split('/')
            if words[0] == '' and words[1:]:
                name = words[1]
                s = os.path.join(slave, name)
                m = os.path.join(master, name)
                compare(s, m)
    for (s, m) in subdirs:
        process(s, m)

def compare(slave, master):
    try:
        sf = open(slave, 'r')
    except IOError:
        sf = None
    try:
        mf = open(master, 'rb')
    except IOError:
        mf = None
    if not sf:
        if not mf:
            print "Neither master nor slave exists", master
            return
        print "Creating missing slave", slave
        copy(master, slave, answer=create_files)
        return
    if not mf:
        print "Not updating missing master", master
        return
    if sf and mf:
        if identical(sf, mf):
            return
    sft = mtime(sf)
    mft = mtime(mf)
    if mft > sft:
        # Master is newer -- copy master to slave
        sf.close()
        mf.close()
        print "Master             ", master
        print "is newer than slave", slave
        copy(master, slave, answer=write_slave)
        return
    # Slave is newer -- copy slave to master
    print "Slave is", sft-mft, "seconds newer than master"
    # But first check what to do about CRLF
    mf.seek(0)
    fun = funnychars(mf)
    mf.close()
    sf.close()
    if fun:
        print "***UPDATING MASTER (BINARY COPY)***"
        copy(slave, master, "rb", answer=write_master)
    else:
        print "***UPDATING MASTER***"
        copy(slave, master, "r", answer=write_master)

BUFSIZE = 16*1024

def identical(sf, mf):
    while 1:
        sd = sf.read(BUFSIZE)
        md = mf.read(BUFSIZE)
        if sd != md: return 0
        if not sd: break
    return 1

def mtime(f):
    st = os.fstat(f.fileno())
    return st[stat.ST_MTIME]

def funnychars(f):
    while 1:
        buf = f.read(BUFSIZE)
        if not buf: break
        if '\r' in buf or '\0' in buf: return 1
    return 0

def copy(src, dst, rmode="rb", wmode="wb", answer='ask'):
    print "copying", src
    print "     to", dst
    if not okay("okay to copy? ", answer):
        return
    f = open(src, rmode)
    g = open(dst, wmode)
    while 1:
        buf = f.read(BUFSIZE)
        if not buf: break
        g.write(buf)
    f.close()
    g.close()

def okay(prompt, answer='ask'):
    answer = answer.strip().lower()
    if not answer or answer[0] not in 'ny':
        answer = raw_input(prompt)
        answer = answer.strip().lower()
        if not answer:
            answer = default_answer
    if answer[:1] == 'y':
        return 1
    if answer[:1] == 'n':
        return 0
    print "Yes or No please -- try again:"
    return okay(prompt)

if __name__ == '__main__':
    main()
objgraph.pyc000064400000011505151732701170007063 0ustar00�
�fc@s�ddlZddlZddlZddlZdZdZdZejd�Zd�Z	d�Z
iZiZiZ
iZd�Zd	�Zd
�Zd�Zd�Zd
�Zedkr�yeje��Wq�ek
r�ejd�q�XndS(i����Nt	TRGDSBAECtUVtNntrgdsbavucs(.*):	?........ (.) (.*)$cCs4|j|�r#||j|�n
|g||<dS(N(thas_keytappend(tdicttkeytitem((s./usr/lib64/python2.7/Tools/scripts/objgraph.pytstore)scCs-d}x|D]}|d|}q
W|dS(Ntt i((tlisttsR((s./usr/lib64/python2.7/Tools/scripts/objgraph.pytflat2s
c
Csx|j�}|sPntj|�dkr8|qntjd \\}}\}}\}}\}}	|||!|||	!|||!}
}}|tkr�tt||
�tt|
|�q|tkr�tt	|
|�tt
||
�q|tkr|
d|d|GHqqWdS(Niit:s: unknown type (treadlinetmatchertsearchtregstdefinitionsRtdef2filetfile2deft	externalst
file2undeft
undef2filetignore(
tfpRtratrbtr1atr1btr2atr2btr3atr3btfntnamettype((s./usr/lib64/python2.7/Tools/scripts/objgraph.pyt	readinputBs"1)cCs�tj�}|j�x�|D]�}|dGHt|}|j�xm|D]e}t|�dkrhd}nd}tj|�s�d||dGHqGd||tt|�GHqGWqWdS(NRis	s		s *undefined(RtkeystsorttlenRRR
(tflisttfilenametelisttextttabs((s./usr/lib64/python2.7/Tools/scripts/objgraph.pytprintcalleeXs

	


	cCs�tj�}|j�x�|D]�}g}x2t|D]&}tj|�r4|t|}q4q4W|r�|j�|dGHd}x8|D]$}||kr�d|GHn|}q�Wq|dGHqWdS(NRR	s	s: unused(RR'R(RR(tfilesR+tcallerstlabeltlastfnR#((s./usr/lib64/python2.7/Tools/scripts/objgraph.pytprintcallerks 


	

cCs�i}xKtj�D]=}x4t|D](}tj|�s$t|||�q$q$WqW|j�}|j�xE|D]=}|dGH||}|j�x|D]}d|GHq�WqqWdS(NRs	(RR'RRRR((tundefsR+R-R,R*((s./usr/lib64/python2.7/Tools/scripts/objgraph.pyt
printundef�s

	


cCs}tj}tjt_tj�}|j�xB|D]:}tt|�dkr2dG|GdGtt|�GHq2q2W|t_dS(Niswarning:smultiply defined:(tsyststdouttstderrRR'R(R)R
(t
savestdouttnamesR$((s./usr/lib64/python2.7/Tools/scripts/objgraph.pytwarndups�s	

c	Cs�y#tjtjdd�\}}Wn_tjk
r�tjt_dGtjjtjd�GdGHdGHdGHdGHd	GHd
GHdGHdSXd}}}xS|D]K\}}|dkr�d}q�|d
kr�d}q�|dkr�d}q�q�W||ko|kodknr!d}}}n|s3dg}nx=|D]5}|dkr\t	tj
�q:t	t|d��q:Wt�|||dk}|r�|r�dGHnt
�n|r�|r�dGHnt�n|r�|r�dGHnt�ndS(NitcdusUsage:is[-cdu] [file] ...s -c: print callers per objectfiles -d: print callees per objectfiles$-u: print usage of undefined symbolss.If none of -cdu is specified, all are assumed.s6Use "nm -o" to generate the input (on IRIX: "nm -Bo"),s"e.g.: nm -o /lib/libc.a | objgraphs-us-cs-dt-trs,---------------All callees------------------s,---------------Undefined callees------------s,---------------All Callers------------------(tgetoptR7targvterrorR9R8tostpathtbasenameR&tstdintopenR<R/R6R4(	toptlisttargstoptutoptctoptdtopttvoidR+tmore((s./usr/lib64/python2.7/Tools/scripts/objgraph.pytmain�sX#		
'



t__main__i(R7RCR@treRRRtcompileRRR
RRRRR&R/R4R6R<RPt__name__texittKeyboardInterrupt(((s./usr/lib64/python2.7/Tools/scripts/objgraph.pyt<module>s0								
	5
suff.pyc000064400000001610151732701170006226 0ustar00�
�fc@s8ddlZd�Zd�Zedkr4e�ndS(i����NcCs�tjd}i}xG|D]?}t|�}|j|�sHg||<n||j|�qW|j�}|j�x'|D]}t|�Gt||�GHqzWdS(Ni(	tsystargvt	getsuffixthas_keytappendtkeystsorttreprtlen(tfilestsuffixestfilenametsuffR((s*/usr/lib64/python2.7/Tools/scripts/suff.pytmain	s




cCsDd}x7tt|��D]#}||dkr||}qqW|S(Ntt.(trangeR(RRti((s*/usr/lib64/python2.7/Tools/scripts/suff.pyRs
t__main__(RR
Rt__name__(((s*/usr/lib64/python2.7/Tools/scripts/suff.pyt<module>s	
	methfix.pyo000064400000010035151732701170006744 0ustar00�
�fc@s�ddlZddlZddlZddlTejjZeZejjZ	d�Z
ejd�Zd�Z
d�Zd�ZdZeje�Zd	�Zed
kr�e
�ndS(i����N(t*cCs�d}tjds<tdtjdd�tjd�nx}tjdD]n}tjj|�rzt|�r�d}q�qJtjj|�r�t|d�d}qJt	|�rJd}qJqJWtj|�dS(Niisusage: s file-or-directory ...
is": will not process symbolic links
(
tsystargvterrtexittostpathtisdirtrecursedowntislinktfix(tbadtarg((s-/usr/lib64/python2.7/Tools/scripts/methfix.pytmain&s
	
s^[a-zA-Z0-9_]+\.py$cCstj|�dkS(Ni(tispythonprogtmatch(tname((s-/usr/lib64/python2.7/Tools/scripts/methfix.pytispython6scCs1td|f�d}ytj|�}Wn+tjk
rW}td||f�dSX|j�g}x�|D]�}|tjtjfkr�qontjj	||�}tjj
|�r�qotjj|�r�|j|�qot
|�rot|�rd}qqoqoWx#|D]}t|�rd}qqW|S(Nsrecursedown(%r)
is%s: cannot list directory: %r
i(tdbgRtlistdirterrorRtsorttcurdirtpardirRtjoinR	RtappendRR
R(tdirnameRtnamestmsgtsubdirsRtfullname((s-/usr/lib64/python2.7/Tools/scripts/methfix.pyR9s0



c
Cs�yt|d�}Wn(tk
r=}td||f�dSXtjj|�\}}tjj|d|�}d}d}x|j�}|s�Pn|d}|dkr�d|kr�t|d�|j	�dS|dkrc|dkrc|d d	krc|dj�}	|	rct
jd
|	d�dkrc|d|	d}|d}t|�|j	�dSnx>|d
dkr�|j�}
|
s�Pn||
}|d}qfWt|�}||krj|dkr7yt|d�}Wn2tk
r}|j	�td||f�dSX|j
d�d}t|d�q~ntt|�d�td|�td|�n|dk	r~|j|�q~q~W|j	�|s�dSy+tj|�}tj||td@�Wn*tjk
r�}td||f�nXytj||d�Wn*tjk
r:}td||f�nXytj||�Wn+tjk
r|}td||f�dSXdS(Ntrs%s: cannot open: %r
it@iss!: contains null bytes; not fixed
is#!s	[pP]ythons: s script; not fixed
i����s\
tws%s: cannot create: %r
s:
s
s< s> i�s%s: warning: chmod failed (%r)
t~s %s: warning: backup failed (%r)
s%s: rename failed (%r)
(topentIOErrorRRRtsplitRtNonetreadlinetclosetretsearchtfixlinetseektreptreprtwritetstattchmodtST_MODERtrename(
tfilenametfRtheadttailttempnametgtlinenotlinetwordstnextlinetnewlinetstatbuf((s-/usr/lib64/python2.7/Tools/scripts/methfix.pyR
Os�

("






s8^[ 	]+def +[a-zA-Z0-9_]+ *( *self *, *(( *(.*) *)) *) *:cCs[tj|�dkrWtjdd!\\}}\}}|| |||!||}n|S(Niii(tfixprogRtregs(R;tatbtctd((s-/usr/lib64/python2.7/Tools/scripts/methfix.pyR+�s" t__main__(RR)RR0tstderrR/RRtstdoutR-R
tcompileRRRR
tfixpatR@R+t__name__(((s-/usr/lib64/python2.7/Tools/scripts/methfix.pyt<module>s 
				R	serve.pyo000064400000003075151732701200006424 0ustar00�
�fc@s�dZddlZddlZddlZddlmZmZd�Zedkr�ej	dZ
eej	�dkr�eej	d�ndZ
ejd	e
e�Zd
e
e
fGHyej�Wq�ek
r�dGHq�XndS(s

Small wsgiref based web server. Takes a path to serve from and an
optional port number (defaults to 8000), then tries to serve files.
Mime types are guessed from the file names, 404 errors are raised
if the file is not found. Used for the make serve target in Doc.
i����N(t
simple_servertutilcCs�tjjt|dd�}d|jtjj�dkrTtjj|d�}ntj|�d}tjj|�r�|dd|fg�tj	t
|��S|d	dg�dgSdS(
Nt	PATH_INFOit.i����s
index.htmlis200 OKsContent-Types
404 Not Founds
text/plains	not found(sContent-Types
text/plain(tostpathtjointsplittsept	mimetypest
guess_typetexistsRtFileWrappertopen(tenvirontrespondtfnttype((s+/usr/lib64/python2.7/Tools/scripts/serve.pytapp
st__main__iii@ts(Serving %s on port %s, control-C to stopsShutting down.(t__doc__tsysRR	twsgirefRRRt__name__targvRtlentinttporttmake_serverthttpdt
serve_forevertKeyboardInterrupt(((s+/usr/lib64/python2.7/Tools/scripts/serve.pyt<module>s	
.
cleanfuture.pyc000064400000016342151732701200007602 0ustar00�
�fc@s�dZddlZddlZddlZddlZdadadad�Zd�Z	d�Z
dd
d��YZed	kr�e	�ndS(s�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.
i����NicGsOtt|�}dj|�}|ddkr;|d7}ntjj|�dS(Nt i����s
(tmaptstrtjointsyststderrtwrite(targststringstmsg((s1/usr/lib64/python2.7/Tools/scripts/cleanfuture.pyterrprint2s

cCs�ddl}y#|jtjdd�\}}Wn!|jk
rR}t|�dSXx_|D]W\}}|dkrtd7aqZ|dkr�td7aqZ|dkrZtd7aqZqZW|s�tdt�dSx|D]}t	|�q�WdS(Ni����itdrvs-ds-rs-vsUsage:(
tgetoptRtargvterrorR
tdryruntrecursetverboset__doc__tcheck(RtoptsRR	totatarg((s1/usr/lib64/python2.7/Tools/scripts/cleanfuture.pytmain9s$#




cCs�tjj|�r�tjj|�r�tr7dG|GHntj|�}xp|D]h}tjj||�}tr�tjj|�r�tjj|�s�|j�j	d�rMt
|�qMqMWdStr�dG|GdGnyt|�}Wn.tk
r}t
d|t|�f�dSXt||�}|j�}|rA|j�n|j�|r�trmdGHtrmdGHqmnxw|D]o\}}	}
d||d	|	d	fGHx&t||	d	�D]}|j|Gq�W|
dkr�d
GHqtdGH|
GqtWts�|d}tjj|�rtj|�ntj||�trCd
G|GdG|GHnt|d�}
|j|
�|
j�tr~dG|GHq~q�ntr�dGHndS(Nslisting directorys.pytcheckings...s%r: I/O Error: %sschanged.s+But this is a dry run, so leaving it alone.s%r lines %d-%dis
-- deleteds
-- change to:s.baktrenamedttotws	wrote news
unchanged.(tostpathtisdirtislinkRtlistdirRRtlowertendswithRtopentIOErrorR
RtFutureFindertrunt
gettheresttcloseRtrangetlinestNonetexiststremovetrenameR(tfiletnamestnametfullnametfR	tfftchangedtstetlinetitbaktg((s1/usr/lib64/python2.7/Tools/scripts/cleanfuture.pyRNsd%





R&cBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCs1||_||_d|_g|_g|_dS(Ni(R4tfnametateofR+R6(tselfR4R=((s1/usr/lib64/python2.7/Tools/scripts/cleanfuture.pyt__init__�s
				cCsH|jr
dS|jj�}|dkr4d|_n|jj|�|S(Nti(R>R4treadlineR+tappend(R?R9((s1/usr/lib64/python2.7/Tools/scripts/cleanfuture.pytgetline�s	cCs	tj}tj}tj}tj}tj}tj}|j}tj|j	�j
}|�\}	}
\}}\}
}}x=|	|||fkr�|�\}	}
\}}\}
}}q{Wx4|	|kr�|�\}	}
\}}\}
}}q�Wxx=|	|||fkr1|�\}	}
\}}\}
}}q�W|	|koG|
dksNPn|d}|�\}	}
\}}\}
}}|	|ko�|
dks�Pn|�\}	}
\}}\}
}}|	|ko�|
dks�Pn|�\}	}
\}}\}
}}g}x�|	|kr�|j|
�|�\}	}
\}}\}
}}|	|koW|
dks^Pn|�\}	}
\}}\}
}}qWd}|	|kr�|
}|�\}	}
\}}\}
}}n|	|k	r�t
d|j||f�gS|d}g}xs|D]k}tt|d�}|dkr:|j|�q|j�}|dksq|tjkrdq|j|�qWt|�t|�kr�t|�dkr�d}n@d}|d	j|�7}|dk	r�|d
|7}n|d7}|j|||f�q�q�W|S(Ntfromit
__future__timportt,s)Skipping file %r; can't parse line %d:
%sisfrom __future__ import s, Rs
(ttokenizetSTRINGtNLtNEWLINEtCOMMENTtNAMEtOPR6tgenerate_tokensRDtnextRCR,R
R=tgetattrRFtgetMandatoryReleaseRtversion_infotlenR(R?RJRKRLRMRNROR6tgetttypettokentsrowtscolterowtecolR9t	startlinetfeaturestcommenttendlinet
okfeaturesR4tobjecttreleased((s1/usr/lib64/python2.7/Tools/scripts/cleanfuture.pyR'�sz							$(((
$$$
$('

	
cCs+|jrd|_n|jj�|_dS(NRA(R>ttherestR4tread(R?((s1/usr/lib64/python2.7/Tools/scripts/cleanfuture.pyR(�s	cCs�|j}|st�g|_|j�xN|D]F\}}}|dkr^|j||d5q/|g|j||d+q/W|j|j�|jr�|j|j�ndS(Ni(R6tAssertionErrortreverseR,R+t
writelinesRdR(R?R4R6R7R8R9((s1/usr/lib64/python2.7/Tools/scripts/cleanfuture.pyRs		
	(t__name__t
__module__R@RDR'R(R(((s1/usr/lib64/python2.7/Tools/scripts/cleanfuture.pyR&�s
	
	
	_	t__main__((
RRFRIRRRRRR
RRR&Ri(((s1/usr/lib64/python2.7/Tools/scripts/cleanfuture.pyt<module>'s			8�h2py.pyc000064400000010450151732701200006141 0ustar00�
�fc@sddlZddlZddlZddlZejd�Zejd�Zejd�Zejd�Zejd�Z	ee	gZ
ejd�Zejd�Zia
iZyejd	jd
�ZWnek
r�yejdjd
�ZWq�ek
r�yfejjd�d
kr9ejdjd
�Zn1ejjd�rdejdjd�Zne�Wq�ek
r�dgZy*ejd
ejjdejd��Wq�ek
r�q�Xq�Xq�XnXd�Zd�Zid�Zedkre�ndS(i����Ns+^[	 ]*#[	 ]*define[	 ]+([a-zA-Z0-9_]+)[	 ]+sG^[	 ]*#[	 ]*define[	 ]+([a-zA-Z0-9_]+)\(([_a-zA-Z][_a-zA-Z0-9]*)\)[	 ]+s"^[	 ]*#[	 ]*include[	 ]+<([^>
]+)>s/\*([^*]+|\*+[^/])*(\*+/)?s//.*s'(\\.[^\\]*|[^\\])'s0x([0-9a-fA-F]+)L?tincludet;tINCLUDEtbeosit
BEINCLUDEStatheostC_INCLUDE_PATHt:s/usr/includet	MULTIARCHcCs�tjtjdd�\}}x9|D]1\}}|dkr&tjtj|��q&q&W|smdg}nxA|D]9}|dkr�tjjd�t	tj
tj�qtt|d�}tj
j|�}|jd�}|dkr�|| }n|j�}|d	}t|d
�}	|	jd|�iaxXtD]P}
|t|
� |
kr8dt|t|
�d<|t|t|
�d<Pq8q8Wt	||	�|	j�|j�qtWdS(Nisi:s-it-s# Generated by h2py from stdin
trt.is.pytws# Generated by h2py from %s
(tgetopttsystargvtignorestappendtretcompiletstdouttwritetprocesststdintopentostpathtbasenametrfindtuppertfiledictt
searchdirstlentNonet
importabletclose(toptstargstotatfilenametfptoutfiletitmodnametoutfptdir((s*/usr/lib64/python2.7/Tools/scripts/h2py.pytmainDs8





cCs�x tD]}|jd|�}qWtjd|�}d}dtjd}x�tj||�}|skPn|j�\}}t|t	|jd��d�}|tjkr�||8}|| dt
|�d||}n|d}qOW|S(	Nt s	ord('\1')iiiit(t)(Rtsubtp_charRtmaxinttp_hextsearchtspantlongtslicetstr(tbodytptstarttUMAXtmtstetval((s*/usr/lib64/python2.7/Tools/scripts/h2py.pytpytifycs 
"
'cBs�d}x�|j�}|sPn|d}ej|�}|rx>|ddkr~|j�}|sgPn|d}||}qAW|jd�}||j�}e|�}d}	d||j�f}
y|
|UWnejj	d|
�qX|j	|
�ne
j|�}|r�|jdd�\}}||j�}e|�}d|||f}
y|
|UWnejj	d|
�q�X|j	|
�nej|�}|r	|j}
|
d\}}|||!}e
j|�r�|j	d	e
|�q�ej|�s�de|<d}x;eD]3}ye|d
|�}PWqek
rPqXqW|r|j	d|�e|||�q�ejj	d|�q�q	q	WdS(
Niii����s\
s%s = %s
sSkipping: %sisdef %s(%s): return %s
sfrom %s import *
t/s
# Included from %s
s!Warning - could not find file %s
(treadlinetp_definetmatchtgrouptendRDtstripRtstderrRtp_macrot	p_includetregsR"thas_keyRR!RRtIOErrorR(R)R-tenvtlinenotlineRHtnextlinetnameR<toktstmttmacrotargROR'tbR(tinclfpR.((s*/usr/lib64/python2.7/Tools/scripts/h2py.pyRwsr

	



t__main__(RRR
RRRGRMRNt	p_commentt
p_cpp_commentRR4R6RR"tenvirontsplitRtKeyErrortplatformtfindt
startswithtinsertRtjoinR/RDRt__name__(((s*/usr/lib64/python2.7/Tools/scripts/h2py.pyt<module>sF0	



	
		=find_recursionlimit.pyo000064400000013051151732701200011343 0ustar00�
�fc@sGdZddlZddlZddd��YZd�Zdd d��YZd�Zd	d!d
��YZd�Zdd"d
��YZ	d�Z
dd#d��YZd�Zd�Z
id�Zd�ZdZxreed�eed�eed�eed�eed�eed�eed�deGHedZq�WdS($sAFind the maximum recursion limit that prevents interpreter termination.

This script finds the maximum safe recursion limit on a particular
platform.  If you need to change the recursion limit on your system,
this script will tell you a safe upper bound.  To use the new limit,
call sys.setrecursionlimit().

This module implements several ways to create infinite recursion in
Python.  Different implementations end up pushing different numbers of
C stack frames, depending on how many calls through Python's abstract
C API occur.

After each round of tests, it prints a message:
"Limit of NNNN is fine".

The highest printed value of "NNNN" is therefore the highest potentially
safe limit for your system (which depends on the OS, architecture, but also
the compilation flags). Please note that it is practically impossible to
test all possible recursion paths in the interpreter, so the results of
this test should not be trusted blindly -- although they give a good hint
of which values are reasonable.

NOTE: When the C stack space allocated by your system is exceeded due
to excessive recursion, exact behaviour depends on the platform, although
the interpreter will always fail in a likely brutal way: either a
segmentation fault, a MemoryError, or just a silent abort.

NB: A program that does not use __methods__ can set a higher limit.
i����NtRecursiveBlowup1cBseZd�ZRS(cCs|j�dS(N(t__init__(tself((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyR$s(t__name__t
__module__R(((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyR#scCst�S(N(R(((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyt	test_init'stRecursiveBlowup2cBseZd�ZRS(cCs
t|�S(N(trepr(R((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyt__repr__+s(RRR(((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyR*scCs
tt��S(N(RR(((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyt	test_repr.stRecursiveBlowup4cBseZd�ZRS(cCs||S(N((Rtx((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyt__add__2s(RRR(((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyR
1scCst�t�S(N(R
(((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyttest_add5stRecursiveBlowup5cBseZd�ZRS(cCs
t||�S(N(tgetattr(Rtattr((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyt__getattr__9s(RRR(((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyR8scCs
t�jS(N(RR(((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyttest_getattr<stRecursiveBlowup6cBseZd�ZRS(cCs||d||dS(Nii((Rtitem((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyt__getitem__@s(RRR(((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyR?scCst�dS(Ni(R(((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyttest_getitemCscCst�S(N(ttest_recurse(((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyRFscCs�yddl}Wntk
r)dGHdSXd}xvtj�D]h}y||}w=Wn1tk
r�x!td�D]}|g}qqWnX|j|dd�|||<q=WdS(Ni����scannot import cPickle, skipped!idtprotocol(tcPickletImportErrortNonet	itertoolstcounttKeyErrortrangetdumps(t_cacheRtltnti((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyttest_cpickleIs


cCshtj|�|jd�r(|dGHn|GHt�|}y|�Wnttfk
r^nXdGHdS(Nttest_isYikes!(tsystsetrecursionlimitt
startswithtglobalstRuntimeErrortAttributeError(R#ttest_func_namet	test_func((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pytcheck_limitZs

i�RR
R	RRRR%sLimit of %d is fineid((((((t__doc__R'RRRRR	R
R
RRRRRR%R/tlimit(((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyt<module>s4							






	ifdef.pyo000064400000004331151732701200006351 0ustar00�
�fc@sPddlZddlZgZgZd�Zd�ZedkrLe�ndS(i����NcCs�tjtjdd�\}}xL|D]D\}}|dkrNtj|�n|dkr&tj|�q&q&W|s�dg}nxY|D]Q}|dkr�ttjtj�q�t	|d�}t|tj�|j
�q�WdS(NisD:U:s-Ds-Ut-tr(tgetopttsystargvtdefstappendtundefstprocesststdintstdouttopentclose(toptstargstotatfilenametf((s+/usr/lib64/python2.7/Tools/scripts/ifdef.pytmain#s
cCs
d}d}g}x�|j�}|s+Pnx4|ddkra|j�}|sTPn||}q.W|j�}|d d	kr�|r|j|�qqn|dj�}|j�}|d
}	|	|kr�|r|j|�qqn|	dkr�t|�dkr�|	dkrd}
nd
}
|d}|tkr_|j||
|f�|
s�d
}q�q�|tkr�|j||
|f�|
r�d
}q�q�|j|d|f�|r�|j|�q�q|	dkr�|j|dd
f�|r�|j|�q�q|	dkrz|rz|d\}}
}|
d
krH|rw|j|�qwq�|
}
|}|
sdd
}n||
|f|d<q|	dkr�|r�|d\}}
}|
d
kr�|r�|j|�q�n|d=|}qtj	jd|	�qW|r	tj	jd|�ndS(Ntiftifdeftifndeftelsetendifii����s\
t#iii����tsUnknown keyword %s
s
stack: %s
(RRRRR(RR(
treadlinetstriptwritetsplittlenRRRRtstderr(tfpitfpotkeywordstoktstacktlinetnextlinettmptwordstkeywordtkotwordts_okts_kots_word((s+/usr/lib64/python2.7/Tools/scripts/ifdef.pyR4s�
	
		t__main__(RRRRRRt__name__(((s+/usr/lib64/python2.7/Tools/scripts/ifdef.pyt<module>s		;reindent.py000075500000026231151732701200006733 0ustar00#! /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()
eptags.py000075500000002713151732701200006405 0ustar00#! /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()
mailerdaemon.pyo000064400000016304151732701200007734 0ustar00�
�fc@s�dZddlZddlZddlZddlZddlZdZdejfd��YZdd#d	d$dd
ddddddddgZ	x�e
ee	��D]�Ze	eZ
ee
�ed�kr�eje
ej�Z
nBgZx*e
D]"Z
ejeje
ej��q�Wee�Z
[e
e	e<[
q�W[ddejdej�ejd�ejdej�gZejdejejB�Zd�ZegZd�Zd�Zd �Zed!ks�ejd"ekr�e�ndS(%s6mailerdaemon - classes to parse mailer-daemon messagesi����Nsmailerdaemon.UnparseabletErrorMessagecBs#eZd�Zd�Zd�ZRS(cCs tjj||�d|_dS(Nt(trfc822tMessaget__init__tsub(tselftfp((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyR
scCsU|jd�}|sdS|j�}|jd�r8dSd|krHdS||_dS(NtSubjectiswaiting mailitwarning(t	getheadertlowert
startswithR(RR((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyt
is_warnings	cCsPxCtD];}|j�y||j|j�SWqtk
rAqXqWt�dS(N(t	EMPARSERSt
rewindbodyRRtUnparseable(Rtp((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyt
get_errorss


(t__name__t
__module__RR
R(((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyRs		
s.error: (?P<reason>unresolvable): (?P<email>.+)s?----- The following addresses had permanent fatal errors -----
s(?P<email>[^ 
].*)
( .*
)?s(remote execution.*
.*rmail (?P<email>.+)s8The following recipients did not receive your message:

sK +(?P<email>.*)
(The following recipients did not receive your message:

)?s?------- Failure Reasons  --------

(?P<reason>.*)
(?P<email>.*)s ^<(?P<email>.*)>:
(?P<reason>.*)s=^(?P<reason>User mailbox exceeds allowed size): (?P<email>.+)s0^5\d{2} <(?P<email>[^
>]+)>\.\.\. (?P<reason>.+)s)^Original-Recipient: rfc822;(?P<email>.*)sR^did not reach the following recipient\(s\):

(?P<email>.*) on .*
 +(?P<reason>.*)s+^ <(?P<email>[^
>]+)> \.\.\. (?P<reason>.*)s@^Report on your message to: (?P<email>.*)
Reason: (?P<reason>.*)s^^Your message was not delivered to +(?P<email>.*)
 +for the following reason:
 +(?P<reason>.*)sO^ was not +(?P<email>[^ 
].*?) *
.*
.*
.*
 because:.*
 +(?P<reason>[^ 
].*?) *
Rs^5\d{2} <>\.\.\. (?P<reason>.*)s<>\.\.\. (?P<reason>.*)s^<<< 5\d{2} (?P<reason>.*)s,===== stderr was =====
rmail: (?P<reason>.*)s ^Diagnostic-Code: (?P<reason>.*)s^From:cCs|j�}tj|�}|dkr6t|�}n|jd�}g}g}d}x*tD]"}t|�td�kr|dj|d|�}|dk	r�y|jd�}Wnt	k
r�nXxL|dj
||jd�|�}|dkr�Pn|j|jd��q�WPq�q^|j|d|�}|dk	r^|j|jd��y|jd�}Wnt	k
r{nXPq^q^W|s�t
�n|s�|}|d dkr�|d}nxtD]}t|�td�kr�x�tt|�ddd�D]�}	||	}
tjtj|
�j|jd	��tj�}|j|�}|dk	r�|jd
j|
j�d|jd�j���||	=q�q�Wq�n|j|�}|dk	r�|jd�}Pq�q�Wnx8|D]0}
|jd
j|
j�d|j���q�W|S(
Nitreasonitemailisreturned mail: Ri����s<>t s: ((treadtemparse_list_fromtsearchtNonetlentstarttemparse_list_listttypetgroupt
IndexErrortmatchtendtappendRtemparse_list_reasontrangetretcompiletescapetjointsplitt	MULTILINEtstrip(RRtdatatrest
from_indexterrorstemailsRtregexptiRtexp((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pytemparse_list\sj

"
	

#
03
.cCs@t|�}t|�}||kr(dS||kr8dSdSdS(Ni����ii(tint(tatb((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pytsort_numeric�scCs�tj|�tjd�}i}i}i}d}}}t|d�tjd��}	|	jt�x�|	D]�}
t|
�}t	|�}|j
d�}
d|
|
dfG|j�r�|j�dGH|d}|rntj
|
d	|
�qnqnny|j�}Wn-tk
r4d
GH|d}|j�qnnXt|�GdGHx�|D]�}y7|jd�dd!\}}dtj||f}Wn
d}nX|j|�s�d||<d|
|f||<n||d||<d|
|f||<qKW|j�|d}|rntj
|
d	|
�qnqnWdGH|GdG|GdG|GdGHdGHg}x9|j�D]+}|j|||||||f�q]W|j�x/|D]'\}}}}d||||fGHq�WdS(Ns^[0-9]*$icSs|j|�dk	S(N(R"R(tfntpat((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyt<lambda>�Rt.tFroms	%s	%-40s	iswarning onlyt,s** Not parseableR1tdateis%s %02ds??????s%s (%s)s--------------s
files parsed,sfiles warning-only,sfiles unparseables
%d %s - %s	%si(tostchdirR'R(tfiltertlistdirtsortR:topenRtgetaddrR
tclosetrenameRRRtgetdatetcalendart
month_abbrthas_keytkeysR$(tdirtmodifyR<t	errordictt
errorfirstt	errorlasttnoktnwarntnbadtfilesR;RtmtsenderR1tetmmtddRAtlisttnumtfirsttlast((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pytparsedir�sj












	)
cCs�d}ttj�dkrAtjddkrAd}tjd=nttj�dkr~x2tjdD]}t||�qdWn
td|�dS(Niis-ds/ufs/jack/Mail/errorsinbox(RtsystargvRb(RQtfolder((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pytmain�s(
t__main__i(s?----- The following addresses had permanent fatal errors -----
s(?P<email>[^ 
].*)
( .*
)?(s8The following recipients did not receive your message:

sK +(?P<email>.*)
(The following recipients did not receive your message:

)?(t__doc__RRLR'RBRcRRRRR&RR4txRR(R,txlR$ttupleR%t
IGNORECASERR6RR:RbRfRRd(((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyt<module>s`$	

 
	9			D	pathfix.pyc000064400000007376151732701200006737 0ustar00�
�fc@s�ddlZddlZddlZddlTddlZejjZeZej	jZ
dad�Z
ejd�Zd�Zd�Zd�Zd�Zed	kr�e
�ndS(
i����N(t*cCspdtjd}y#tjtjdd�\}}Wn;tjk
rq}t|d�t|�tjd�nXx)|D]!\}}|dkry|aqyqyWts�tddks�|r�td	�t|�tjd�nd}xv|D]n}tjj	|�rt
|�r[d}q[q�tjj|�rFt|d
�d}q�t|�r�d}q�q�Wtj|�dS(Ns0usage: %s -i /interpreter file-or-directory ...
iisi:s
is-it/s'-i option or file-or-directory missing
s": will not process symbolic links
(
tsystargvtgetoptterrorterrtexittnew_interpretertostpathtisdirtrecursedowntislinktfix(tusagetoptstargstmsgtotatbadtarg((s-/usr/lib64/python2.7/Tools/scripts/pathfix.pytmain"s4#




	
s^[a-zA-Z0-9_]+\.py$cCstj|�dkS(Ni(tispythonprogtmatch(tname((s-/usr/lib64/python2.7/Tools/scripts/pathfix.pytispython?scCs1td|f�d}ytj|�}Wn+tjk
rW}td||f�dSX|j�g}x�|D]�}|tjtjfkr�qontjj	||�}tjj
|�r�qotjj|�r�|j|�qot
|�rot|�rd}qqoqoWx#|D]}t|�rd}qqW|S(Nsrecursedown(%r)
is%s: cannot list directory: %r
i(tdbgR	tlistdirRRtsorttcurdirtpardirR
tjoinR
RtappendRRR(tdirnameRtnamesRtsubdirsRtfullname((s-/usr/lib64/python2.7/Tools/scripts/pathfix.pyRBs0



cCs<yt|d�}Wn(tk
r=}td||f�dSX|j�}t|�}||kr~t|d�|j�dStjj	|�\}}tjj
|d|�}yt|d�}Wn2tk
r�}|j�td||f�dSXt|d�|j|�d}	x*|j|	�}
|
s4Pn|j|
�qW|j�|j�y+tj
|�}tj||td@�Wn*tjk
r�}td||f�nXytj||d
�Wn*tjk
r�}td||f�nXytj||�Wn+tjk
r7}td||f�dSXdS(Ntrs%s: cannot open: %r
is: no change
t@tws%s: cannot create: %r
s: updating
iii�s%s: warning: chmod failed (%r)
t~s %s: warning: backup failed (%r)
s%s: rename failed (%r)
ii (topentIOErrorRtreadlinetfixlinetreptcloseR	R
tsplitR!twritetreadtstattchmodtST_MODERtrename(tfilenametfRtlinetfixedtheadttailttempnametgtBUFSIZEtbuftstatbuf((s-/usr/lib64/python2.7/Tools/scripts/pathfix.pyRXsX




cCs+|jd�s|Sd|kr#|SdtS(Ns#!tpythons#! %s
(t
startswithR(R:((s-/usr/lib64/python2.7/Tools/scripts/pathfix.pyR.�s
t__main__(RtreR	R4RtstderrR2RRtstdoutR/tNoneRRtcompileRRRRR.t__name__(((s-/usr/lib64/python2.7/Tools/scripts/pathfix.pyt<module>s 
				5	find_recursionlimit.py000075500000006621151732701200011174 0ustar00#! /usr/bin/python2.7
"""Find the maximum recursion limit that prevents interpreter termination.

This script finds the maximum safe recursion limit on a particular
platform.  If you need to change the recursion limit on your system,
this script will tell you a safe upper bound.  To use the new limit,
call sys.setrecursionlimit().

This module implements several ways to create infinite recursion in
Python.  Different implementations end up pushing different numbers of
C stack frames, depending on how many calls through Python's abstract
C API occur.

After each round of tests, it prints a message:
"Limit of NNNN is fine".

The highest printed value of "NNNN" is therefore the highest potentially
safe limit for your system (which depends on the OS, architecture, but also
the compilation flags). Please note that it is practically impossible to
test all possible recursion paths in the interpreter, so the results of
this test should not be trusted blindly -- although they give a good hint
of which values are reasonable.

NOTE: When the C stack space allocated by your system is exceeded due
to excessive recursion, exact behaviour depends on the platform, although
the interpreter will always fail in a likely brutal way: either a
segmentation fault, a MemoryError, or just a silent abort.

NB: A program that does not use __methods__ can set a higher limit.
"""

import sys
import itertools

class RecursiveBlowup1:
    def __init__(self):
        self.__init__()

def test_init():
    return RecursiveBlowup1()

class RecursiveBlowup2:
    def __repr__(self):
        return repr(self)

def test_repr():
    return repr(RecursiveBlowup2())

class RecursiveBlowup4:
    def __add__(self, x):
        return x + self

def test_add():
    return RecursiveBlowup4() + RecursiveBlowup4()

class RecursiveBlowup5:
    def __getattr__(self, attr):
        return getattr(self, attr)

def test_getattr():
    return RecursiveBlowup5().attr

class RecursiveBlowup6:
    def __getitem__(self, item):
        return self[item - 2] + self[item - 1]

def test_getitem():
    return RecursiveBlowup6()[5]

def test_recurse():
    return test_recurse()

def test_cpickle(_cache={}):
    try:
        import cPickle
    except ImportError:
        print "cannot import cPickle, skipped!"
        return
    l = None
    for n in itertools.count():
        try:
            l = _cache[n]
            continue  # Already tried and it works, let's save some time
        except KeyError:
            for i in range(100):
                l = [l]
        cPickle.dumps(l, protocol=-1)
        _cache[n] = l

def check_limit(n, test_func_name):
    sys.setrecursionlimit(n)
    if test_func_name.startswith("test_"):
        print test_func_name[5:]
    else:
        print test_func_name
    test_func = globals()[test_func_name]
    try:
        test_func()
    # AttributeError can be raised because of the way e.g. PyDict_GetItem()
    # silences all exceptions and returns NULL, which is usually interpreted
    # as "missing attribute".
    except (RuntimeError, AttributeError):
        pass
    else:
        print "Yikes!"

limit = 1000
while 1:
    check_limit(limit, "test_recurse")
    check_limit(limit, "test_add")
    check_limit(limit, "test_repr")
    check_limit(limit, "test_init")
    check_limit(limit, "test_getattr")
    check_limit(limit, "test_getitem")
    check_limit(limit, "test_cpickle")
    print "Limit of %d is fine" % limit
    limit = limit + 100
fixps.py000075500000001575151732701200006260 0ustar00#! /usr/bin/python2.7

# Fix Python script(s) to reference the interpreter via /usr/bin/env python.
# Warning: this overwrites the file without making a backup.

import sys
import re


def main():
    for filename in sys.argv[1:]:
        try:
            f = open(filename, 'r')
        except IOError, msg:
            print filename, ': can\'t open :', msg
            continue
        line = f.readline()
        if not re.match('^#! */usr/local/bin/python', line):
            print filename, ': not a /usr/local/bin/python script'
            f.close()
            continue
        rest = f.read()
        f.close()
        line = re.sub('/usr/local/bin/python',
                      '/usr/bin/env python', line)
        print filename, ':', repr(line)
        f = open(filename, "w")
        f.write(line)
        f.write(rest)
        f.close()

if __name__ == '__main__':
    main()
md5sum.py000075500000004521151732701200006333 0ustar00#! /usr/bin/python2.7

"""Python utility to print MD5 checksums of argument files.
"""


bufsize = 8096
fnfilter = None
rmode = 'rb'

usage = """
usage: sum5 [-b] [-t] [-l] [-s bufsize] [file ...]
-b        : read files in binary mode (default)
-t        : read files in text mode (you almost certainly don't want this!)
-l        : print last pathname component only
-s bufsize: read buffer size (default %d)
file ...  : files to sum; '-' or no files means stdin
""" % bufsize

import sys
import os
import getopt
import md5

def sum(*files):
    sts = 0
    if files and isinstance(files[-1], file):
        out, files = files[-1], files[:-1]
    else:
        out = sys.stdout
    if len(files) == 1 and not isinstance(files[0], str):
        files = files[0]
    for f in files:
        if isinstance(f, str):
            if f == '-':
                sts = printsumfp(sys.stdin, '<stdin>', out) or sts
            else:
                sts = printsum(f, out) or sts
        else:
            sts = sum(f, out) or sts
    return sts

def printsum(filename, out=sys.stdout):
    try:
        fp = open(filename, rmode)
    except IOError, msg:
        sys.stderr.write('%s: Can\'t open: %s\n' % (filename, msg))
        return 1
    if fnfilter:
        filename = fnfilter(filename)
    sts = printsumfp(fp, filename, out)
    fp.close()
    return sts

def printsumfp(fp, filename, out=sys.stdout):
    m = md5.new()
    try:
        while 1:
            data = fp.read(bufsize)
            if not data:
                break
            m.update(data)
    except IOError, msg:
        sys.stderr.write('%s: I/O error: %s\n' % (filename, msg))
        return 1
    out.write('%s %s\n' % (m.hexdigest(), filename))
    return 0

def main(args = sys.argv[1:], out=sys.stdout):
    global fnfilter, rmode, bufsize
    try:
        opts, args = getopt.getopt(args, 'blts:')
    except getopt.error, msg:
        sys.stderr.write('%s: %s\n%s' % (sys.argv[0], msg, usage))
        return 2
    for o, a in opts:
        if o == '-l':
            fnfilter = os.path.basename
        elif o == '-b':
            rmode = 'rb'
        elif o == '-t':
            rmode = 'r'
        elif o == '-s':
            bufsize = int(a)
    if not args:
        args = ['-']
    return sum(args, out)

if __name__ == '__main__' or __name__ == sys.argv[0]:
    sys.exit(main(sys.argv[1:], sys.stdout))
texi2html.pyc000064400000242573151732701200007214 0ustar00�
�fc@sbddlZddlZddlZddlZdZejd�Zejd�Zejd�Zejd�Z	ejd�Z
dfd	��YZd
efd��YZdfd
��YZ
de
fd��YZdfd��YZd�Zd�Zejd�Zd�Zd�ZejejdZd�Zd�Zd�Zedkr^e�ndS(i����Ns\input texinfos^@([a-z]+)([ 	]|$)s^[ 	]*$s@[a-z]+s	[
@{}&<>]s.^\* ([^:]*):(:|[ 	]*([^	,
.]+)([^ 	
]*))[ 	
]*tHTMLNodecBsteZdZdZdZdZdZd�Zd�Zd�Z	d
d
d�Zd	�Zd
�Z
d�Zd�ZRS(s�Some of the parser's functionality is separated into this class.

    A Node accumulates its contents, takes care of links to other Nodes
    and saves itself when it is finished and all links are resolved.
    s2<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">its</BODY></HTML>
cCs^||_||_|r$||_n	||_||_||_||_||_g|_dS(N(tdirnametnamettopnamettitletnexttprevtuptlines(tselftdirRRRRRR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt__init__gs							cGst|jj|�dS(N(tmapR	tappend(R
R	((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytwritetscCsat|jdt|j�d�}|j|j�|j|j�|j|j�|j�dS(Nt/tw(	topenRtmakefileRRtprologuettexttepiloguetclose(R
tfp((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytflushws
#cCs�|r�|j�dkr'd}d}nt|�}d|}|j|d|d|r_d|pbd|rrd|pud|d	|d
�
ndS(Ns(dir)s../dir.htmlRs TITLE="%s"s: <A HREF="t"s REL=s REV=t>s</A>  
(tlowerRR(R
tlabeltnodenametreltrevtaddrR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytlink~s	
cCs�t|j�}dj|j�|_g|_|j�|j�|j�dj|j�}g|_|jd|jdt	|j
�d|j
dt	|j�d|jdt	|j�d|jd||_
|dkr�d	||_ndS(
NRsF
<HTML><HEAD>
  <!-- Converted with texi2html and Python -->
  <TITLE>s </TITLE>
  <LINK REL=Next HREF="s	" TITLE="s">
  <LINK REL=Previous HREF="s">
  <LINK REL=Up HREF="s">
</HEAD><BODY>
is<P>
%s</BODY></HTML>
(tlenR	tjoinRt
open_linkstoutput_linkstclose_linkstDOCTYPERRRRRRR(R
tlengthtlinks((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytfinalize�s	


	i
cCs|jd�dS(Ns<HR>
(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR%�scCs|jd�dS(Ns<HR>
(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR'�scCs�|j|jkr(|jd|j�n|jd|jdd�|jd|jdd�|jd|jdd�|j|jkr�|jd	|j�ndS(
Ns  Conts  NextRtNexts  PrevtPreviouss  UptUps  Top(tcontRR"RRRR(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR&�sN(t__name__t
__module__t__doc__R(ttypeR/RRRRtNoneR"R+R%R'R&(((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRZs	
		
			t	HTML3NodecBs eZdZd�Zd�ZRS(s;<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML Level 3//EN//3.0">cCs|jd�dS(Ns<DIV CLASS=Navigation>
 <HR>
(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR%�scCs|jd�dS(Ns
 <HR>
</DIV>
(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR'�s(R0R1R(R%R'(((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR5�s	t
TexinfoParsercBs�
eZdZdZdedZdedZdZeZd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d �Z"d!�Z#d"�Z$d#�Z%d$�Z&d%�Z'd&�Z(d'�Z)d(�Z*d)�Z+d*�Z,d+�Z-d,�Z.d-�Z/d.�Z0d/�Z1d0�Z2d1�Z3d2�Z4d3�Z5d4�Z6d5�Z7d6�Z8d7�Z9d8�Z:d9�Z;d:�Z<d;�Z=d<�Z>d=�Z?d>�Z@d?�ZAd@�ZBdA�ZCdB�ZDdC�ZEdD�ZFdE�ZGdF�ZHdG�ZIdH�ZJdI�ZKdJ�ZLdK�ZMdL�ZNdM�ZOdN�ZPdO�ZQdP�ZRdQ�ZSdR�ZTdS�ZUdT�ZVdU�ZWdV�ZXdW�ZYdX�ZZdY�Z[dZ�Z\d[�Z]d\�Z^e]Z_e^Z`d]�Zad^�Zbd_�Zcd`�Zdda�Zedb�Zfdc�Zgdd�Zhde�Zidf�Zjdg�Zkdh�Zldi�Zmdj�Zndk�Zodl�Zpdm�Zqdn�Zrdo�Zsdp�Ztdq�Zudr�Zvds�Zwdt�Zxdu�Zydv�Zzdw�Z{dx�Z|dy�Z}dz�Z~d{�Zd|�Z�d}�Z�d~�Z�d�Z�d��Z�d��Z�d��Z�d��Z�e]Z�e^Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�e�Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�e�Z�e�Z�e�Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�e�Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�e�Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�e�Z�d��Z�d��Z�e�Z�d��Z�d��Z�e�Z�d��Z�d��Z�e�Z�d��Z�d��Z�e�Z�d��Z�d��Z�e�Z�d��Z�d��Z�e�Z�d��Z�d��Z�e�Z�d��Z�d��Z�e�Z�d��Z�d��Z�e�Z�d��Z�d��Z�e�Z�d��Z�d��Ze�Zd��Zd��Ze�Zd��Zd��ZeZd��Zd��Z	e�Z
d��Zd��Zd��Z
d��Zd��Zd��Zd��Zd��Zd��Zd��Zd��Zd��ZeZd��Zd��Zd��Zd��Zd��Zd��Zd��Zd��ZeZ eZ!eZ"eZ#e Z$e!Z%eZ&eZ'e&Z(e'Z)d��Z*d��Z+d��Z,d��Z-d��Z.d��Z/d��Z0d��Z1d��Z2d��Z3d��Z4d�Z5d�Z6d�Z7d�Z8d�Z9d�Z:d�Z;d�Z<e<Z=d�Z>d	�Z?d
�Z@RS(s&copy;s(%(id)s)s5<A NAME=footnoteref%(id)s HREF="#footnotetext%(id)s">s</A>s5<A NAME=footnotetext%(id)s HREF="#footnoteref%(id)s">s</A>
%(text)s<P>
sJ
<P>
<HR NOSHADE SIZE=1 WIDTH=200>
<STRONG><EM>Footnotes</EM></STRONG>
<P>cCsi|_i|_d|_d|_d|_d|_d|_d|_g|_	d|_
d|_d|_d|_
d|_d|_|j�g|_g|_d|_idd6|_i|_g|_d|_d|_d|_d|_g|_d|_d|_dS(Nittmpt.Rithtml(tunknownt	filenamest	debuggingt
print_headersR4tnodefpt
nodelinenoR*tsavetextt	savestackthtmlhelpRt
includedirRRRt
resetindextcontentst	numberingtnofilltvaluest	stackinfot	footnotestitemargt
itemnumbert	itemindextnodet	nodestackR/tincludedepth(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�s:															
											cCs
||_dS(N(RB(R
RB((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytsethtmlhelp�scCs
||_dS(N(R(R
R((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
setdirname�scCs
||_dS(N(RC(R
RC((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
setincludedir�scCs�|j�}d}x?|rS|ddks:tj|�rS|j�}|d}qW|tt� tkr}tdtf�n|j||�dS(Niit%sfile does not begin with %r(treadlinetblprogtmatchR#tMAGICtSyntaxErrort	parserest(R
Rtlinetlineno((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytparse�s(c
Cs<|}d|_d|_g|_g}x�|js�|j�}|jd|_|s�|r}|jst|j|�ng}n|dkr�dGHnPn|d}tj|�}|r-|jd�\}}|||!}	|	dkr�|j	|�q�|r|js|j|�ng}n|j
||�q*tj|�r�d|jkr�d|jkr�|r�|js�|j|�|jr�|j
d�n
|j
d	�g}q�q�q*|j	|�q*W|jr�d
GHn|jr�dGHdG|jGHn|jdkr8x<|jr4|jd
j�|jd
j�|jd
=q�WndS(Niis*** EOF before @byetnoindenttrefilltformattexamples
s<P>
s*** Still skipping at the ends*** Stack not empty at the ends***i����(R^R_(tdonetskiptstackRUR?tprocesstcmprogRWtspanRtcommandRVRGRRPROR+R(
R
Rtinitial_linenoR\taccuR[tmotatbtcmd((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRZsb					

			
	
		cCs2|jdkr%|jj|j�nd|_dS(NR(R@R4RAR(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytstartsaving@scCsN|j}t|j�dkr;|jd|_|jd=n	d|_|pMdS(Nii����R(R@R#RAR4(R
R@((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytcollectsavingsGs	
	cGs�ydj|�}Wn|GHt�nX|jdkrJ|j||_n8|jrf|jj|�n|jr�|jj|�ndS(NR(R$t	TypeErrorR@R4R>RRN(R
targsR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRQs
		cCs�|jdkr#dGH|j�}n|jr9|j�n|jr|jdkr�|jd�|jd \}}}}|j	d|�|j	d|�|j	d|�|j
|jkr�|j	d|j�n|jd�n|jd	�|jj�d|_n�|j
r�|jrf|j
jsI|j
jrf|j
jrf|j
jrf|j
j�|j
j�n|jj|j
�d|_
nd
|_
dS(Ns$*** Still saving text at end of nodeis<HR>
iR,tPrevR.tTops</BODY>
R(R@R4RpRJtwritefootnotesR>R?Rt	nodelinksR"RRRRNR/R3RRRR+RROR(R
tdummyRRRR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytendnode_s6	
	


	

$
c	Cs�|jdkrdd|jGdG|jG|jG|rA|dd Gn|ddsY|dr`dGnHn|j�r�xa|D]:}tj|�}|s�|j�d}|j|�qwn|jd�\}}|jd�\}}|jd�\}}	|jd	�\}
}|jd
�\}}
|||!}|||	!}|ddkrQ|}n
||
|!}|||
!}|j	dt
|�d
|d|d�|jj|�|j||�qwWndj
|�}|j|�dS(Nit!sprocess:iis...s
iiit:s  <LI><A HREF="s">s</A>R(R<RcRdtinmenutmiprogRWtstriptexpandRgRRRBtmenuitemR$(R
RjR[RktbgntendRlRmtctdtetftgthRRtpunctR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyResB



	

		
cCss|j}xS|r^|ddkr^y|jt|�r<dSWntk
rPnX|d }qW|or|ddkS(Ni����tifsettifclearitmenu(R�R�(RdRIR#tKeyError(R
Rd((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR{�s	
c
Cs'g}d}t|�}x�||kr|}tj||�}|rT|j�}n|j||�P|j|||!�||}|d}|dkr�|jd�qn|dkr�|jd�qn|dkr�|jd�qn|dkr
|jd	�qn|d
kr)|jd�qn|dkr�|sSd
GH|jd�qn|d}|d=yt|d|�}	Wn!tk
r�|j|�qnX|	�qn|dkr�t	d|�n|}x-||kr�||t
jkr�|d}q�W||krC|d}|||!}|dkr0q|j|�qn|||!}||kr�||d
kr�|d}|j|�yt|d|�}	Wn!tk
r�|j|�qnX|	�qnyt|d|�}	Wn!tk
r|j
|�qnX|	�qW|r#dG|GHndS(Niis
t<s&lt;Rs&gt;t&s&amp;t{Rt}s*** Unmatched }i����tclose_t@sunexpected funny %rRztopen_thandle_s*** Stack not empty at para:(R#tspprogtsearchtstartRRtgetattrtAttributeErrort
unknown_closetRuntimeErrortstringt
ascii_letterstunknown_opentunknown_handle(
R
RRdtitnR�RkR�Rntmethod((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR~�s�










"









cCsed|dGH|d}|jd|�|jj|�sId|j|<n|j|d|j|<dS(Ns*** No open func for @s{...}R�R�i(RR:thas_key(R
Rn((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�s

cCsbd|dGHd|}|jd�|jj|�sFd|j|<n|j|d|j|<dS(Ns*** No close func for @s{...}R�i(RR:R�(R
Rn((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�
s


cCsWd|GH|jd|�|jj|�s;d|j|<n|j|d|j|<dS(Ns*** No handler for @R�i(RR:R�(R
Rn((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�s
	cCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pythandle_noindent"RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
handle_refill$RcCs�|}tjj|j|�}yt|d�}Wn#tk
rV}dGt|�GHdSXd|jGdGt|�GH|j}|j	}|j
}|jd|_|j|d�|jd|_|j
�||_||_	||_
d|jGdGt|�GHdS(Ntrs*** Can't open include fileRys--> fileiis<-- file(tostpathR$RCRtIOErrortreprR<RbRcRdRPRZR(R
RrtfileRtmsgt	save_donet	save_skipt
save_stack((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
do_include(s&			
			cCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_dmn?RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	close_dmn@RcCs|jd�dS(Ns...(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	open_dotsBRcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
close_dotsCRcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_bulletERcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_bulletFRcCs|jd�dS(NtTeX(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_TeXHRcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	close_TeXIRcCs|j|j�dS(N(RtCOPYRIGHT_SYMBOL(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pythandle_copyrightKRcCs|j|j�dS(N(RR�(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_copyrightLRcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_copyrightMRcCs|jd�dS(Nt-(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
open_minusORcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_minusPRcCs|jd�dS(Ns&#161;(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_exclamdownvRcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_exclamdownwRcCs|jd�dS(Ns&#191;(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_questiondownxRcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_questiondownyRcCs|jd�dS(Ns&#229;(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_aazRcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_aa{RcCs|jd�dS(Ns&#197;(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_AA|RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_AA}RcCs|jd�dS(Ns&#230;(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_ae~RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_aeRcCs|jd�dS(Ns&#198;(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_AE�RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_AE�RcCs|jd�dS(Ns&#248;(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_o�RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_o�RcCs|jd�dS(Ns&#216;(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_O�RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_O�RcCs|jd�dS(Ns&#223;(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_ss�RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_ss�RcCs|jd�dS(Ntoe(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_oe�RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_oe�RcCs|jd�dS(NtOE(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_OE�RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_OE�RcCs|jd�dS(Nsl/(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_l�RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_l�RcCs|jd�dS(NsL/(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_L�RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_L�RcCs|jd�dS(Ns=&gt;(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_result�RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_result�RcCs|jd�dS(Ns==&gt;(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_expansion�RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_expansion�RcCs|jd�dS(Ns-|(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
open_print�RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_print�RcCs|jd�dS(Nserror--&gt;(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
open_error�RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_error�RcCs|jd�dS(Ns==(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
open_equiv�RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_equiv�RcCs|jd�dS(Ns-!-(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
open_point�RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_point�RcCs|jd�|j�dS(Nssee (RRo(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
open_pxref�s
cCs|j�dS(N(tmakeref(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_pxref�scCs|jd�|j�dS(NsSee (RRo(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	open_xref�s
cCs|j�dS(N(R�(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
close_xref�scCs|j�dS(N(Ro(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_ref�scCs|j�dS(N(R�(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	close_ref�scCs|jd�|j�dS(NsSee info file (RRo(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_inforef�s
cCs�|j�}g|jd�D]}|j�^q}x#t|�dkrY|jd�q7W|d}|d}|jd|d|d�dS(	Nt,iRiit`s	', node `s'(RptsplitR}R#RR(R
RtsRrRNR�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
close_inforef�s(

c	Cs�|j�}g|jd�D]}|j�^q}x#t|�dkrY|jd�q7W|d}}|dr|d}n|d}|d}t|�}|r�d|d	|}n|jd
|d|d�dS(
NR�iRiiiis../Rs	<A HREF="s">s</A>(RpR�R}R#RRR(	R
RR�RrRRR�Rthref((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR��s(



cCs|j�dS(N(Ro(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	open_uref�scCs�|j�}g|jd�D]}|j�^q}x#t|�dkrY|jd�q7W|d}|d}|s}|}n|jd|d|d�dS(	NR�iRiis	<A HREF="s">s</A>(RpR�R}R#RR(R
RR�RrR�R((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
close_uref�s(

	cCs|j�dS(N(Ro(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
open_image�scCs|j�dS(N(t	makeimage(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_image�sc
Cs~|j�}g|jd�D]}|j�^q}x#t|�dkrY|jd�q7W|d}|d}|d}|d}|d}|jd	|}	tjj|	d
�r�|d
7}nOtjj|	d�r�|d7}n,tjj|	d�r|d7}n	d
|	GH|j	d|d|r2d|dp5d|rId|dpLd|r`d|dpcdd�|j
j|	�dS(NR�iRiiiiiRs.pngs.jpgs.gifs*** Cannot find image s
<IMG SRC="Rs WIDTH="s	 HEIGHT="s ALT="s/>(RpR�R}R#RRR�R�texistsRRBtaddimage(
R
RR�Rrtfilenametwidththeighttalttextt
imagelocation((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR��s.(







	cCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�
RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�RcCs|jd�dS(Ns<CITE>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	open_citeRcCs|jd�dS(Ns</CITE>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
close_citeRcCs|jd�dS(Ns<CODE>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	open_codeRcCs|jd�dS(Ns</CODE>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
close_codeRcCs|jd�dS(Ns<TT>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_tRcCs|jd�dS(Ns</TT>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_tRcCs|jd�dS(Ns<DFN>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_dfnRcCs|jd�dS(Ns</DFN>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	close_dfnRcCs|jd�dS(Ns<EM>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	open_emphRcCs|jd�dS(Ns</EM>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
close_emph RcCs|jd�dS(Ns<I>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_i"RcCs|jd�dS(Ns</I>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_i#RcCsBt|j�d}|j|jit|�d6�|j�dS(Nitid(R#RJRtFN_SOURCE_PATTERNR�Ro(R
R((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
open_footnote%s!cCs3t|j�d}|jj||j�f�dS(Ni(R#RJRRp(R
R((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_footnote,scCs_|j|j�x?|jD]4\}}|j|jit|�d6|d6�qWg|_dS(NRR(Rt	FN_HEADERRJtFN_TARGET_PATTERNR�(R
RR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRu0s
 cCs|jd�dS(Ns<CODE>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	open_file7RcCs|jd�dS(Ns</CODE>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
close_file8RcCs|jd�dS(Ns<KBD>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_kbd:RcCs|jd�dS(Ns</KBD>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	close_kbd;RcCs|jd�dS(Ns<KEY>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_key=RcCs|jd�dS(Ns</KEY>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	close_key>RcCs|jd�dS(Ns<R>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_r@RcCs|jd�dS(Ns</R>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_rARcCs|jd�dS(Ns`<SAMP>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	open_sampCRcCs|jd�dS(Ns</SAMP>'(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
close_sampDRcCs|jd�dS(Ns<SMALLCAPS>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_scFRcCs|jd�dS(Ns</SMALLCAPS>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_scGRcCs|jd�dS(Ns<STRONG>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_strongIRcCs|jd�dS(Ns	</STRONG>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_strongJRcCs|jd�dS(Ns<B>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_bLRcCs|jd�dS(Ns</B>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_bMRcCs|jd�dS(Ns<VAR>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_varORcCs|jd�dS(Ns</VAR>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	close_varPRcCs|jd�dS(Ns	<NOBREAK>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_wRRcCs|jd�dS(Ns
</NOBREAK>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_wSRcCs|j�dS(N(Ro(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_urlURcCs)|j�}|jd|d|d�dS(Ns	<A HREF="s">s</A>(RpR(R
R((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	close_urlVscCs|j�dS(N(Ro(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
open_emailZRcCs)|j�}|jd|d|d�dS(Ns<A HREF="mailto:s">s</A>(RpR(R
R((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_email[scCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
open_smallbRcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_smallcRcCs#|jd�\}}|||!}||j�}|jdkrnd|jGdG|jG|jGd|G|GHnyt|d|�}Wnttk
r�yt|d|�}Wn.tk
r�|js�|j||�ndSX|jj|�||�dSX|js|dkr||�ndS(NiRyscommand:R�tdo_tbgn_R�(	RgR}R<RcRdR�R�tunknown_cmdR(R
R[RkRlRmRnRrtfunc((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRhes(


	
cCsOdGd|G|GH|jj|�s3d|j|<n|j|d|j|<dS(Ns*** unknownR�i(R:R�(R
RnRr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR2|scCs�|j�}|sdGHn�|d}|jsA|jd|krQdG|GdGHn
|jd=yt|d|�}Wntk
r�|j|�dSX|�dS(Ns*** @end w/o argsii����s*** @endt
unexpectedtend_(R�RdR�R�tunknown_end(R
RrtwordsRnR3((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_end�s



cCsUd|}dGd|GH|jj|�s9d|j|<n|j|d|j|<dS(Nsend s*** unknownR�i(R:R�(R
Rn((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR6�s


cCsdS(N((R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
do_comment�RcCsdS(N((R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
bgn_ifinfo�RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
end_ifinfo�RcCs|jd|_dS(Ni(Rc(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	bgn_iftex�RcCs|jd|_dS(Ni(Rc(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	end_iftex�RcCs|jd|_dS(Ni(Rc(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
bgn_ignore�RcCs|jd|_dS(Ni(Rc(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
end_ignore�RcCs|jd|_dS(Ni(Rc(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytbgn_tex�RcCs|jd|_dS(Ni(Rc(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytend_tex�RcCsX|jd�}|d}t|�dkr4d}ndj|d�}||j|<dS(Nt ii(R�R#R$RH(R
Rrtfieldstkeytvalue((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_set�s
	cCsd|j|<dS(N(R4RH(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_clear�scCsk||jj�ks(|j|dkrQ|jd|_d|jt|j�<nd|jt|j�<dS(Nii(RHtkeysR4RcRIR#Rd(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	bgn_ifset�s
cCsvyH|jt|j�dr0|jd|_n|jt|j�d=Wn'tk
rqdGt|j�dGHnXdS(Nis*** end_ifset: KeyError :(RIR#RdRcR�(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	end_ifset�s
cCsk||jj�krQ|j|dk	rQ|jd|_d|jt|j�<nd|jt|j�<dS(Nii(RHRHR4RcRIR#Rd(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytbgn_ifclear�s
cCsvyH|jt|j�dr0|jd|_n|jt|j�d=Wn'tk
rqdGt|j�dGHnXdS(Nis*** end_ifclear: KeyError :(RIR#RdRcR�(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytend_ifclear�s
cCs|j�dS(N(Ro(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
open_value�scCsE|j�}||jj�kr8|j|j|�n	dG|GHdS(Ns*** Undefined value: (RpRHRHR(R
RD((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_value�scCs*|j�|j|�|j�|_dS(N(RoR~RpR(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_settitle�s

cCsdS(N((R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
do_parskip�RcCs|j�d|_dS(Ni(RxRb(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_bye�s
cCs|jd|_dS(Ni(Rc(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
bgn_titlepage�RcCs|jd|_dS(Ni(Rc(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
end_titlepage�RcCsdS(N((R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_shorttitlepage�RcCs+|jd�|j|�|jd�dS(Ns<H1>s</H1>
(RR~(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	do_center�s

c
Cs�|j�d|_g|jd�D]}|j�^q#}x#t|�dkr`|jd�q>W||_|d \}}}}|jdt|�}|j	j
|�r�dG|GHn |jr�d|jGdG|GHnd	|j	|<||_|j
r|jr|j|jd
_
n|js(||_n|}	|jrK|	d|j}	n|j|j|j|j|	|||�|_|jj|j||||�dS(NiR�iRRs*** Filename already in use: Rys--- writingii����s -- (RxR?R�R}R#RRvRRR;R�R<RR/RORRtNodeRNRBtaddnode(
R
RrR�tpartsRRRRR�R((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_nodes0
	(		
			c	CsV|rR|j�dkr!d}nt|�}|j|d|d|d|d�ndS(Ns(dir)s../dir.htmls: <A HREF="s" TYPE="s">s</A>  
(RRR(R
RRR!((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR".s	cCs7|jr3||j_x|jr/|jdj|krf|jdj�|jdj�|jd=q|jdj|kr�|jdjs�|jj|jd_n|jjs�|jdj|j_n|jdj�|jdj�|jd=q|dkr+|jjr+|jdj|j_nPqWndS(Ni����i(	RNR3ROR+RRRRR(R
R3((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytpopstack9s$	

cCs$|jd|d�|jd�dS(NtH1ii(theadingRZ(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
do_chapterNscCs$|jd|d�|jd�dS(NR[i����i(R\RZ(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
do_unnumberedRscCs$|jd|d�|jd�dS(NR[i����i(R\RZ(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_appendixUscCs|jd|d�dS(NR[i����(R\(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_topXscCs|jd|d�dS(NR[i����(R\(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_chapheadingZscCs|jd|d�dS(NR[i����(R\(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_majorheading\scCs$|jd|d�|jd�dS(NR[ii(R\RZ(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
do_section_scCs$|jd|d�|jd�dS(NR[i����i(R\RZ(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_unnumberedseccscCs$|jd|d�|jd�dS(NR[i����i(R\RZ(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_appendixsecfscCs|jd|d�dS(NR[i����(R\(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
do_headingjscCs$|jd|d�|jd�dS(NtH2ii(R\RZ(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
do_subsectionmscCs$|jd|d�|jd�dS(NRgi����i(R\RZ(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_unnumberedsubsecpscCs$|jd|d�|jd�dS(NRgi����i(R\RZ(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_appendixsubsecsscCs|jd|d�dS(NRgi����(R\(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
do_subheadingvscCs$|jd|d�|jd�dS(NtH3ii(R\RZ(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_subsubsectionyscCs$|jd|d�|jd�dS(NRli����i(R\RZ(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_unnumberedsubsubsec|scCs$|jd|d�|jd�dS(NRli����i(R\RZ(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_appendixsubsubsecscCs|jd|d�dS(NRli����(R\(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_subsubheading�scCs|dkr�x)t|j�|kr7|jjd�qW|j|d3|j|d|j|<d}x%|jD]}|t|�d}qnW|d|}|jj|||jf�n|jd|d�|j|�|jd|d	�|js�|j	r
d
G|GHndS(NiiRR8RBR�Rs</s>
s---(
R#RFRR�RERRR~R<R=(R
R3RrtleveltxR�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR\�s
cCs|jdd�dS(NsTable of Contentsi�(tlistcontents(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_contents�scCsdS(N((R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_shortcontents�scCs!|jd|d�dg}x�|jD]�\}}}||krGq&n||dkr|jd|dd�|j|�nI||dkr�x6||dkr�|d=|jd|dd�q�Wn|jd|dt|�d	�|j|�|jd
�q&W|jdt|��dS(Ns<H1>s</H1>
<UL COMPACT PLAIN>
ii����s  s<UL PLAIN>
s</UL>
s<LI> <A HREF="s">s</A>
(RRERRR~R#(R
Rtmaxlevelt
prevlevelsRqRN((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRs�s$	
cCsdS(N((R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_page�RcCsdS(N((R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_need�RcCsdS(N((R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	bgn_group�RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	end_group�RcCs*|jr|jd�n
|jd�dS(Ns
s<P>
(RGR(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_sp�s	cCs|jd�dS(Ns<HR>(R(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_hline�scCs|jd�|j|�dS(Ns<DL>(Rt	do_deffnx(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	bgn_deffn�s
cCs|jd�dS(Ns</DL>
(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	end_deffn�scCs�|jd�t|d�}|d |d\}}}|jd|�x%|D]}|jdt|��qOW|jd�|jd|�dS(Ns<DT>is@b{%s}RBs
<DD>tfn(Rt
splitwordsR~tmakevartindex(R
RrR7tcategoryRtresttword((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR~�s


cCs|jd|�dS(Ns	Function (R(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	bgn_defun�RcCs|jd|�dS(Ns	Function (R~(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	do_defunx�RcCs|jd|�dS(NsMacro (R(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
bgn_defmac�RcCs|jd|�dS(NsMacro (R~(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
do_defmacx�RcCs|jd|�dS(Ns{Special Form} (R(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytbgn_defspec�RcCs|jd|�dS(Ns{Special Form} (R~(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_defspecx�RcCs|jd�|j|�dS(Ns<DL>(Rt	do_defvrx(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	bgn_defvr�s
cCs�|jd�t|d�}|d |d\}}}|jd|�x|D]}|jd|�qOW|jd�|jd|�dS(Ns<DT>is	@code{%s}RBs
<DD>tvr(RR�R~R�(R
RrR7R�RR�R�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR��s


cCs|jd|�dS(Ns	Variable (R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
bgn_defvar�RcCs|jd|�dS(Ns	Variable (R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
do_defvarx�RcCs|jd|�dS(Ns{User Option} (R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
bgn_defopt�RcCs|jd|�dS(Ns{User Option} (R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
do_defoptxRcCs|jd�|j|�dS(Ns<DL>(Rt
do_deftypefnx(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
bgn_deftypefns
cCs�|jd�t|d�}|d |d\}}}}|jd||f�x%|D]}|jdt|��qXW|jd�|jd|�dS(Ns<DT>is@code{%s} @b{%s}RBs
<DD>R�(RR�R~R�R�(R
RrR7R�tdatatypeRR�R�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�s


cCs|jd|�dS(Ns	Function (R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytbgn_deftypefunRcCs|jd|�dS(Ns	Function (R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_deftypefunxRcCs|jd�|j|�dS(Ns<DL>(Rt
do_deftypevrx(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
bgn_deftypevrs
cCs�|jd�t|d�}|d |d\}}}}|jd||f�x|D]}|jd|�qXW|jd�|jd|�dS(Ns<DT>is@code{%s} @b{%s}RBs
<DD>R�(RR�R~R�(R
RrR7R�R�RR�R�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR� s


cCs|jd|�dS(Ns	Variable (R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytbgn_deftypevar+scCs|jd|�dS(Ns	Variable (R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_deftypevarx.scCs|jd�|j|�dS(Ns<DL>(Rt	do_defcvx(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	bgn_defcv3s
cCs�|jd�t|d�}|d |d\}}}}|jd|�x|D]}|jd|�qRW|jd�|jdd||f�dS(Ns<DT>is@b{%s}RBs
<DD>R�s%s @r{on %s}(RR�R~R�(R
RrR7R�t	classnameRR�R�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�9s


cCs|jd|�dS(Ns{Instance Variable} (R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytbgn_defivarDscCs|jd|�dS(Ns{Instance Variable} (R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_defivarxGscCs|jd�|j|�dS(Ns<DL>(Rt	do_defopx(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	bgn_defopJs
cCs�|jd�t|d�}|d |d\}}}}|jd|�x%|D]}|jdt|��qRW|jd�|jdd||f�dS(Ns<DT>is@b{%s}RBs
<DD>R�s%s @r{on %s}(RR�R~R�R�(R
RrR7R�R�RR�R�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�Ps


cCs|jd|�dS(NsMethod (R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
bgn_defmethodZscCs|jd|�dS(NsMethod (R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
do_defmethodx]scCs|jd�|j|�dS(Ns<DL>(Rt	do_deftpx(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	bgn_deftpbs
cCs�|jd�t|d�}|d |d\}}}|jd|�x|D]}|jd|�qOW|jd�|jd|�dS(Ns<DT>is@b{%s}RBs
<DD>ttp(RR�R~R�(R
RrR7R�RR�R�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�hs


cCs\|s,|jd�d|jt|j�<n,||_|jd�d|jt|j�<dS(Ns<OL>
s</OL>
s<UL>
s</UL>
(RRIR#RdRL(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
bgn_enumeratets
	
cCsEd|_|j|jt|j�d�|jt|j�d=dS(Ni(R4RLRRIR#Rd(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
end_enumerate|s	!cCs||_|jd�dS(Ns<UL>
(RKR(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytbgn_itemize�s	cCsd|_|jd�dS(Ns</UL>
(R4RKR(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytend_itemize�s	cCs||_|jd�dS(Ns<DL>
(RKR(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	bgn_table�s	cCsd|_|jd�dS(Ns</DL>
(R4RKR(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	end_table�s	cCsd|_|j|�dS(NR�(RMR�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
bgn_ftable�s	cCsd|_|j�dS(N(R4RMR�(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
end_ftable�s	cCsd|_|j|�dS(NR�(RMR�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
bgn_vtable�s	cCsd|_|j�dS(N(R4RMR�(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
end_vtable�s	cCsv|jr|j|j|�n|jr�|jddkrv|jdrv|jdtjkrv|jd|d}q�|jd|}n|jdkr�|jd|}t|j�|_n|jr|jdd	kr|j	d
�|j
|�|j	d�nm|jrK|jddkrK|j	d
�|j
|�|j	d�n'|j	d�|j
|�|j	d�dS(NiR�iR�R�RBs. i����ttables<DT>s
<DD>t
multitables<TR><TD>s</TD>
</TR>
s<LI>s  (RMR�RKR�R�RLR4t	incrementRdRR~(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_item�s*		 





cCsd|_|jd�dS(Ns<TABLE BORDER="">
(R4RKR(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytbgn_multitable�s	cCsd|_|jd�dS(Ns</TABLE>
<BR>
(R4RKR(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytend_multitable�s	cCs
d|_dS(N(R4RK(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pythandle_columnfractions�scCs|jd�dS(Ns</TD>
    <TD>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
handle_tab�scCs|jd�dS(Ns<BLOCKQUOTE>(R(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
bgn_quotation�RcCs|jd�dS(Ns</BLOCKQUOTE>
(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
end_quotation�RcCs!|jd|_|jd�dS(Nis<PRE>(RGR(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytbgn_example�scCs!|jd�|jd|_dS(Ns</PRE>
i(RRG(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytend_example�s
cCs|j|d�dS(Ns
(R~(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	do_exdent�RcCs!|jd|_|jd�dS(Nis<PRE>
(RGR(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
bgn_flushleft�scCs!|jd�|jd|_dS(Ns</PRE>
i(RRG(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
end_flushleft�s
cCs!|jd|_|jd�dS(Nis<ADDRESS COMPACT>
(RGR(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytbgn_flushright�scCs!|jd�|jd|_dS(Ns</ADDRESS>
i(RRG(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytend_flushright�s
cCs+|jd�|jd�|jj�dS(Ns<DIR>
s$  <STRONG><EM>Menu</EM></STRONG><P>
(RRBt	beginmenu(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytbgn_menu�s

cCs|jd�|jj�dS(Ns</DIR>
(RRBtendmenu(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytend_menu�s
cCsdS(N((R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
bgn_cartouche�RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
end_cartouche�RcCs�dg|_i|_d|jd<d|jd<d|jd<d|jd<d	|jd
<d|jd<i|_x$|jj�D]}g|j|<q|WdS(
NtcptConcepttFunctionR�tKeywordtkytProgramtpgtTypeR�tVariableR�(tnoncodeindicest
indextitlet
whichindexRH(R
R((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRD�s	





	cCs8|jj|�r%|j||�ndGt|�GHdS(Ns*** No index named(R�R�R�R�(R
RRr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
user_indexscCs|jd|�dS(NR�(R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	do_cindexRcCs|jd|�dS(NR�(R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	do_findexRcCs|jd|�dS(NR�(R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	do_kindexRcCs|jd|�dS(NR�(R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	do_pindexRcCs|jd|�dS(NR�(R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	do_tindexRcCs|jd|�dS(NR�(R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	do_vindexRcCs7|j|j||jf�|jj||j�dS(N(R�RRRBR�(R
RRr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�scCs�|j�}t|�dkr+dG|GHdS|\}}|jj|�s]|jj|�rjdG|GHdS||kr�|j||j|k	r�|j|}|j||t|�)||j|<ndS(Nis*** bad @synindexs*** bad key(s) in @synindex(R�R#R�R�(R
RrR7toldtnewtinew((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_synindexs		
cCsR|j�}x?|D]7}|jj|�r;|j|�qdGt|�GHqWdS(Ns*** No index named(R�R�R�tprindexR�(R
RrR7R((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
do_printindex.s

cCs�||jk}|j|}|s&dS|jrQd|jGdG|j|GdGHng}tjd�}xr|D]j\}}|j�}|}	x3|j|�}
|
s�Pn|
j�}||}q�W|j	|||f�qmW|2|j
�|jd�d}}
x�|D]�\}}}||f||
fkr4qn|jdkr^d|jG|GdG|GHn|jd�|r�d	|d
}n||kr�|j
|�n|jdt|�|f�||}}
qW|jd�dS(
NRys--- GeneratingR�s^(@[a-z]+)?{s
<DL COMPACT>
iRzs<DT>s@code{R�s
<DD><A HREF="%s">%s</A>
s</DL>
(R�R�R<R�tretcompileRRWR�RtsortRR4R~R(R
RtiscodeindexR�tindex1tjunkprogRDRNtsortkeyt
oldsortkeyRkR�tprevkeytprevnode((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�6sH
	



cCsX|jrTdGH|jj�}|j�x*|D]}|jd�G|j|GHq.WndS(Ns--- Unrecognized commands ---i(R:RHR�tljust(R
tcmdsRn((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytreport^s	

(AR0R1R�t
FN_ID_PATTERNRRRRRVRRQRRRSR]RZRoRpRRxReR{R~R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�t	open_asist
close_asisRRRRRR	R
RRR
RRRRRuRRRRRRRRRRR R!R"R#R$R%R&R'R(R)R*R+R,R-topen_titlefonttclose_titlefontR.R/RhR2R8R6R9tdo_cR:R;R<R=R>R?R@RARFRGRIRJRKRLRMRNtdo_finalouttdo_setchapternewpagetdo_setfilenameRORPRQRRRSRTRUtdo_titletdo_subtitlet	do_authortdo_vskiptdo_vfilltdo_smallbooktdo_paragraphindenttdo_headingstdo_footnotestyletdo_evenheadingtdo_evenfootingt
do_oddheadingt
do_oddfootingtdo_everyheadingtdo_everyfootingRYR"RZR]R^R_R`RaRbRcRdRetdo_appendixsectionRfRhRiRjRkRmRnRoRpR\RtRutdo_summarycontentsRsRxRyRzR{R|R}RR�R~R�t	end_defunR�R�t
end_defmacR�R�tend_defspecR�R�t	end_defvrR�R�t
end_defvarR�R�t
end_defoptR�R�t
end_deftypefnR�R�tend_deftypefunR�R�t
end_deftypevrR�R�tend_deftypevarR�R�t	end_defcvR�R�tend_defivarR�R�t	end_defopR�R�t
end_defmethodR�R�t	end_deftpR�R�R�R�R�R�R�R�R�R�R�R�tdo_itemxR�R�R�R�R�R�R�R�tbgn_lisptend_lisptbgn_smallexampletend_smallexamplet
bgn_smalllispt
end_smalllisptbgn_displaytend_displayt
bgn_formatt
end_formatR�R�R�R�R�R�R�R�R�RDR�R�R�R�R�R�R�R�R�tdo_syncodeindexR�R�R�(((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR6�s~	!					8		
		 	#		T																					&																																																				&																																															
																																																												
																										
																																												(tTexinfoParserHTML3cBs�eZdZdZdedZdedZdZeZd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�ZRS(s&copy;s[%(id)s]s3<A ID=footnoteref%(id)s HREF="#footnotetext%(id)s">s</A>s;<FN ID=footnotetext%(id)s>
<P><A HREF="#footnoteref%(id)s">s</A>
%(text)s</P></FN>
s[<DIV CLASS=footnotes>
  <HR NOSHADE WIDTH=200>
  <STRONG><EM>Footnotes</EM></STRONG>
  <P>
cCs|jd�dS(Ns<BQ>(R(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�uRcCs|jd�dS(Ns</BQ>
(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�vRcCs!|jd|_|jd�dS(Nis<PRE CLASS=example><CODE>(RGR(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�xscCs!|jd�|jd|_dS(Ns</CODE></PRE>
i(RRG(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�}s
cCs!|jd|_|jd�dS(Nis<PRE CLASS=flushleft>
(RGR(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR��scCs!|jd|_|jd�dS(Nis4<DIV ALIGN=right CLASS=flushright><ADDRESS COMPACT>
(RGR(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR��scCs!|jd�|jd|_dS(Ns</ADDRESS></DIV>
i(RRG(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR��s
cCs|jd�|jd�dS(Ns<UL PLAIN CLASS=menu>
s  <LH>Menu</LH>
(R(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR��s
cCs|jd�dS(Ns</UL>
(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR��s(R0R1R�R�RRRR5RVR�R�R�R�R�R�R�R�R�(((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR&gs								tHTMLHelpcBs�eZdZejd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd	�Z
ejd
�Zejd�Zdejd
�Zdejd�Zd�Zejd�Zd�ZRS(s�
    This class encapsulates support for HTML Help. Node names,
    file names, menu items, index items, and image file names are
    accumulated until a call to finalize(). At that time, three
    output files are created in the current directory:

        `helpbase`.hhp  is a HTML Help Workshop project file.
                        It contains various information, some of
                        which I do not understand; I just copied
                        the default project info from a fresh
                        installation.
        `helpbase`.hhc  is the Contents file for the project.
        `helpbase`.hhk  is the Index file for the project.

    When these files are used as input to HTML Help Workshop,
    the resulting file will be named:

        `helpbase`.chm

    If none of the defaults in `helpbase`.hhp are changed,
    the .CHM file will have Contents, Index, Search, and
    Favorites tabs.
    s@code{(.*?)}cCsy||_||_d|_d|_d|_g|_i|_i|_i|_	g|_
d|_i|_i|_
dS(NR(thelpbaseRR4tprojectfiletcontentfilet	indexfiletnodelistt	nodenamest	nodeindexR;t	indexlisttcurrenttmenudicttdumped(R
R(R((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�s												cCse|||||f}||j|<t|j�|j|<|jj|�||_g|j|j<dS(N(R;R#R,R.RR0R1(R
RRRRR�RN((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRW�s
	cCs!|j|j}|j|�dS(N(R1R0R(R
RR�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�scCs||j|<dS(N(R;(R
t	imagename((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR��scCs|jj||f�dS(N(R/R(R
RrR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR��scCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR��scCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR��scCs�|js
dS|jd}|jd}|jd}|jd}|j}|jd\}}}}	}
|
}y*t|d�}|dIJ|dIJ|d	IJ|d
IJ|dIJ|d|d
IJ|d|d
IJ|d|d
IJ|dIJ|d|d
IJ|d|d
IJ|dIJ|dIJ|dIJ|d
IJ|dIJ|d|d|dIJ|d
IJ|dIJ|d
IJ|j|�|j�Wn-tk
r�}
|GdG|
GHtjd�nXy�t|d�}|dIJ|dIJ|dIJ|d IJ|d!IJ|d"IJ|d#IJ|d$IJ|d%IJ|d&IJ|d'IJ|d(IJ|d)IJ|j|�|d*IJ|d+IJ|j�Wn-tk
r�}
|GdG|
GHtjd�nXy�t|d�}|dIJ|d,IJ|dIJ|d IJ|d!IJ|d"IJ|d#IJ|d$IJ|d-IJ|d.IJ|j	|�|d*IJ|d+IJ|j�Wn-tk
r�}
|GdG|
GHtjd�nXdS(/Ns.chms.hhps.hhcs.hhkiRs	[OPTIONS]sAuto Index=Yess
Binary TOC=NosBinary Index=YessCompatibility=1.1sCompiled file=RsContents file=sDefault topic=sError log file=ErrorLog.logsIndex file=sTitle=sDisplay compile progress=YessFull-text search=YessDefault window=mains	[WINDOWS]smain=,"s","s=","","",,,,,0x23520,222,0x1046,[10,10,780,560],0xB0000,,,,,,0s[FILES]Rzis.<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">s0<!-- This file defines the table of contents -->s<HTML>s<HEAD>sG<meta name="GENERATOR" content="Microsoft&reg; HTML Help Workshop 4.1">s<!-- Sitemap 1.0 -->s</HEAD>s<BODY>s'   <OBJECT type="text/site properties">s2     <param name="Window Styles" value="0x800025">s*     <param name="comment" value="title:">s)     <param name="comment" value="base:">s   </OBJECT>s</BODY>s</HTML>s$<!-- This file defines the index -->s$<OBJECT type="text/site properties">s	</OBJECT>(
R(R,Rt	dumpfilesRR�tsystexitt	dumpnodest	dumpindex(R
t
resultfileR)R*R+RRttopnextttopprevttopupttopfiletdefaulttopicRR�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR+�s�	



	














































cCs8|jj�}|j�x|D]}||IJq WdS(N(R;RHR�(R
toutfiletfilelistR�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR4;s

cCsyi|_|jr:|jd\}}}}}||_n|dIJx$|jD]}|j|d|�qNW|dIJdS(Nis<UL>s</UL>(R2R,ttopnodetdumpnode(R
R?RRwRN((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR7As		
ic
Cs�|r�|\}}}}}||_|jj|�r:dSd|j|<|d|I|dI|d|dI|d|dI|dIJy(|j|}	|j|	|d|�Wq�tk
r�q�XndS(	NiRBs <LI><OBJECT type="text/sitemap">s<param name="Name" value="s">s<param name="Local" value="s	</OBJECT>i(R0R2R�R1tdumpmenuR�(
R
RNtindentR?RRRRR�R�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRBLs 	




cCs�|r�|j}||jkr=|d|dIJ|d7}nx0|D](}|j|�}|j|||�qDW||jkr�|d|dIJ|d8}q�ndS(NRBs<UL>is</UL>(R0RAtgetnodeRB(R
R�RDR?tcurrentnodetitemtmenunode((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRCes	

cCsFy|j|}|j|SWn#tk
r0dStk
rAdSXdS(N(R.R,R�R4t
IndexError(R
RR�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRErs


cCs�|dIJx{|jD]p\}}|j|�}t|�}|jd|}|dI|d|dI|d|dI|dIJqW|dIJdS(	Ns<UL>Rs <LI><OBJECT type="text/sitemap">s<param name="Name" value="s">s<param name="Local" value="s	</OBJECT>s</UL>(R/t
codeexpandRR(R
R?RDtlocation((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR8|s

cCsg|jj|�}|s|S|jd�\}}|jd�\}}|| |||!||}|S(Nii(tcodeprogRWRg(R
R[tcoR�R�RlRm((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRJ�s(R0R1R2R�R�RLRRWRR�R�R�R�R+R5tstdoutR4R7RBRCRER8RJ(((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR'�s"								_
	
cCsd|dS(Ns@var{R�((tstr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR��scCs�g}d}t|�}xy||kr�x*||krS||dkrS|d}q*W||krdPn|}t|||�}|j|||!�qWx#t|�|kr�|jd�q�W|S(Nis 	
iR(R#tfindwordendR(ROt	minlengthR7R�R�R�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR��ss[@{} ]cCs�d}x�||kr�tj||�}|s1Pn|j�}||}|d}|dkrj|d}q	|dkr�|d}q	|dkr�|d}q	|dkr	|dkr	|dSq	W|S(NiiR�R�R�RB(tfwprogR�R�(ROR�R�RqRkR�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRP�s"




cCs|j�}t|�dS(Ns.html(R}t
fixfunnychars(R((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�ss!@-=+.cCsld}x_|t|�krg||}|tkrTd}|| |||d}n|t|�}q	W|S(NiR�i(R#t	goodchars(R!R�R�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRS�s
cCs�|s
dSx�tjtjtjfD]�}|d}||kr#|j|�d}|t|�kr�t|�dkr�|dd}|dkr�d}q�q�t|d �|d}n|d ||}|Sq#W|S(Nt1i����iiit00t10(R�tdigitst	lowercaset	uppercaseR�R#R�(R�tsequencetlastcR�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR��s
cCs/ddl}d}d}d}d}d}x.|jddgkrZ|d}|jd=q-W|jddkr�d}|jd=n|jddkr�d}|jd=n|jddkr�d}|jd=n|jdd	kr�|jd
}|jdd5nt|j�dkr+dGd
GH|jd
�n|r=t�}n	t�}||_||_||_|jd}|jd
}	|j	|	�|j
tjj
|��t||	�}|j|�yt|d�}
Wn-tk
r�}|GdG|GH|jd�nX|j|
�|
j�|j�|j�dS(Ni����iRis-ds-ps-cs-3s-Hiis5usage: texi2hh [-d [-d]] [-p] [-c] [-3] [-H htmlhelp]sinputfile outputdirectoryR�Rz(R5targvR#R6R&R6R/R<R=RRRSR�R�RR'RQRR�R]RR�R+(R5R<R=R/thtml3RBR(tparserR�RRR�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyttest�s\




				







t__main__(R�R5R�R�RXR�RfRVtkwprogR�R|RR5R6R&R'R�R�RRRPRR�RXRTRSR�R`R0(((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt<module>Bs<	Z������-�							9nm2def.pyo000064400000005620151732701200006451 0ustar00�
�fc@s�dZddlZddlZdejd dZdejdejdd	Zd
Zedd�Zd�ZdZ	dZ
e
d�Zd�Ze
dkr�e�ndS(sEnm2def.py

Helpers to extract symbols from Unix libs and auto-generate
Windows definition files from them. Depends on nm(1). Tested
on Linux and Solaris only (-p option to nm is for Solaris only).

By Marc-Andre Lemburg, Aug 1998.

Additional notes: the output of nm is supposed to look like this:

acceler.o:
000001fd T PyGrammar_AddAccelerators
         U PyGrammar_FindDFA
00000237 T PyGrammar_RemoveAccelerators
         U _IO_stderr_
         U exit
         U fprintf
         U free
         U malloc
         U printf

grammar1.o:
00000000 T PyGrammar_FindDFA
00000034 T PyGrammar_LabelRepr
         U _PyParser_TokenNames
         U abort
         U printf
         U sprintf

...

Even if this isn't the default output of your nm, there is generally an
option to produce this format (since it is the original v7 Unix format).

i����Nt	libpythonis.atPythoniis.dllsnm -p -g %stTtCtDc
Cs�tjt|�j�}g|D]}|j�^q }i}x�|D]}t|�dksEd|kroqEn|j�}t|�dkr�qEn|\}}}	||kr�qEn||f||	<qEW|S(Nit:i(tostpopentNMt	readlineststriptlentsplit(
tlibttypestlineststsymbolstlinetitemstaddressttypetname((s,/usr/lib64/python2.7/Tools/scripts/nm2def.pyR+s
cCs�g}g}xQ|j�D]C\}\}}|dkrK|jd|�q|jd|�qW|j�|jd�|j�dj|�ddj|�S(NRRs	ts DATA
s
(RR(Rtappendtsorttjoin(RtdatatcodeRtaddrR((s,/usr/lib64/python2.7/Tools/scripts/nm2def.pytexport_list<s


sEXPORTS
%s
cCsTxM|j�D]?}|d dksL|d dkr6q
||kr
||=q
q
WdS(NitPyit_Py(tkeys(RtspecialsR((s,/usr/lib64/python2.7/Tools/scripts/nm2def.pyt
filter_PythonUs
 cCsJtt�}t|�t|�}tj}|jt|�|j�dS(N(	Rt	PYTHONLIBR#RtsyststdouttwritetDEF_TEMPLATEtclose(Rtexportstf((s,/usr/lib64/python2.7/Tools/scripts/nm2def.pytmain]s
	t__main__(RRR((t__doc__RR%tversionR$tPC_PYTHONLIBRRRR(tSPECIALSR#R,t__name__(((s,/usr/lib64/python2.7/Tools/scripts/nm2def.pyt<module>$s 			cleanfuture.py000075500000020601151732701200007433 0ustar00#! /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()
pickle2db.pyc000064400000007353151732701200007126 0ustar00�
�fc@sBdZddlZyddlZWnek
r;dZnXyddlZWnek
redZnXyddlZWnek
r�dZnXyddlZWnek
r�dZnXddlZyddl	Z
Wnek
r�ddl
Z
nXejdZd�Z
d�Zedkr>ejeejd��ndS(s,
Synopsis: %(prog)s [-h|-b|-g|-r|-a|-d] [ picklefile ] dbfile

Read the given picklefile as a series of key/value pairs and write to a new
database.  If the database already exists, any contents are deleted.  The
optional flags indicate the type of the output database:

    -a - open using anydbm
    -b - open as bsddb btree file
    -d - open as dbm file
    -g - open as gdbm file
    -h - open as bsddb hash file
    -r - open as bsddb recno file

The default is hash.  If a pickle file is named it is opened for read
access.  If no pickle file is named, the pickle input is read from standard
input.

Note that recno databases can only contain integer keys, so you can't dump a
hash or btree database using db2pickle.py and reconstitute it to a recno
database with %(prog)s unless your keys are integers.

i����NicCstjjtt��dS(N(tsyststderrtwritet__doc__tglobals(((s//usr/lib64/python2.7/Tools/scripts/pickle2db.pytusage4sc	Cs�y1tj|dddddddg�\}}Wntjk
rOt�dSXt|�d	kstt|�d
krt�dSt|�dkr�tj}|d	}nNyt|d	d�}Wn*tk
r�tjj	d|d	�dSX|d}d}x�|D]�\}}|d"krOy
tj}Wq�t
k
rKtjj	d�dSXq|d#kr�y
tj}Wq�t
k
r�tjj	d�dSXq|d$kr�y
tj}Wq�t
k
r�tjj	d�dSXq|d%kry
tj}Wq�t
k
rtjj	d�dSXq|d&krSy
tj}Wq�t
k
rOtjj	d�dSXq|d'kry
tj}Wq�t
k
r�tjj	d�dSXqqW|dkr�tdkr�tjj	d�tjj	d�dStj}ny||d�}Wn9tjk
r.tjj	d |�tjj	d!�dSXx|j�D]
}||=q<Wx<ytj|�\}	}
Wntk
r}PnX|
||	<qPW|j�|j�d	S((NthbrdagthashtbtreetrecnotdbmtanydbmtgdbmiiitrbsUnable to open %s
s-hs--hashsbsddb module unavailable.
s-bs--btrees-rs--recnos-as--anydbmsanydbm module unavailable.
s-gs--gdbmsgdbm module unavailable.
s-ds--dbmsdbm module unavailable.
sbsddb module unavailable - smust specify dbtype.
tcsUnable to open %s.  s&Check for format or version mismatch.
(s-hs--hash(s-bs--btree(s-rs--recno(s-as--anydbm(s-gs--gdbm(s-ds--dbm(tgetoptterrorRtlenRtstdintopentIOErrorRRtNonetbsddbthashopentAttributeErrortbtopentrnopenRRR
tkeystpickletloadtEOFErrortclose(targstoptstpfiletdbfiletdbopentopttargtdbtktkeytval((s//usr/lib64/python2.7/Tools/scripts/pickle2db.pytmain7s�$	

















t__main__i(RRRtImportErrorRR
RRRtcPickleRtargvtprogRR+t__name__texit(((s//usr/lib64/python2.7/Tools/scripts/pickle2db.pyt<module>s6









		[fixdiv.pyc000064400000033031151732701200006550 0ustar00�
�fc@s�dZddlZddlZddlZddlZdad�Zd�ZdZd�Z	d�Z
d	�Zd
�Zddd��YZ
d
�Zd�Zedkr�eje��ndS(s(fixdiv - tool to fix division operators.

To use this tool, first run `python -Qwarnall yourscript.py 2>warnings'.
This runs the script `yourscript.py' while writing warning messages
about all uses of the classic division operator to the file
`warnings'.  The warnings look like this:

  <file>:<line>: DeprecationWarning: classic <type> division

The warnings are written to stderr, so you must use `2>' for the I/O
redirect.  I know of no way to redirect stderr on Windows in a DOS
box, so you will have to modify the script to set sys.stderr to some
kind of log file if you want to do this on Windows.

The warnings are not limited to the script; modules imported by the
script may also trigger warnings.  In fact a useful technique is to
write a test script specifically intended to exercise all code in a
particular module or set of modules.

Then run `python fixdiv.py warnings'.  This first reads the warnings,
looking for classic division warnings, and sorts them by file name and
line number.  Then, for each file that received at least one warning,
it parses the file and tries to match the warnings up to the division
operators found in the source code.  If it is successful, it writes
its findings to stdout, preceded by a line of dashes and a line of the
form:

  Index: <file>

If the only findings found are suggestions to change a / operator into
a // operator, the output is acceptable input for the Unix 'patch'
program.

Here are the possible messages on stdout (N stands for a line number):

- A plain-diff-style change ('NcN', a line marked by '<', a line
  containing '---', and a line marked by '>'):

  A / operator was found that should be changed to //.  This is the
  recommendation when only int and/or long arguments were seen.

- 'True division / operator at line N' and a line marked by '=':

  A / operator was found that can remain unchanged.  This is the
  recommendation when only float and/or complex arguments were seen.

- 'Ambiguous / operator (..., ...) at line N', line marked by '?':

  A / operator was found for which int or long as well as float or
  complex arguments were seen.  This is highly unlikely; if it occurs,
  you may have to restructure the code to keep the classic semantics,
  or maybe you don't care about the classic semantics.

- 'No conclusive evidence on line N', line marked by '*':

  A / operator was found for which no warnings were seen.  This could
  be code that was never executed, or code that was only executed
  with user-defined objects as arguments.  You will have to
  investigate further.  Note that // can be overloaded separately from
  /, using __floordiv__.  True division can also be separately
  overloaded, using __truediv__.  Classic division should be the same
  as either of those.  (XXX should I add a warning for division on
  user-defined objects, to disambiguate this case from code that was
  never executed?)

- 'Phantom ... warnings for line N', line marked by '*':

  A warning was seen for a line not containing a / operator.  The most
  likely cause is a warning about code executed by 'exec' or eval()
  (see note below), or an indirect invocation of the / operator, for
  example via the div() function in the operator module.  It could
  also be caused by a change to the file between the time the test
  script was run to collect warnings and the time fixdiv was run.

- 'More than one / operator in line N'; or
  'More than one / operator per statement in lines N-N':

  The scanner found more than one / operator on a single line, or in a
  statement split across multiple lines.  Because the warnings
  framework doesn't (and can't) show the offset within the line, and
  the code generator doesn't always give the correct line number for
  operations in a multi-line statement, we can't be sure whether all
  operators in the statement were executed.  To be on the safe side,
  by default a warning is issued about this case.  In practice, these
  cases are usually safe, and the -m option suppresses these warning.

- 'Can't find the / operator in line N', line marked by '*':

  This really shouldn't happen.  It means that the tokenize module
  reported a '/' operator but the line it returns didn't contain a '/'
  character at the indicated position.

- 'Bad warning for line N: XYZ', line marked by '*':

  This really shouldn't happen.  It means that a 'classic XYZ
  division' warning was read with XYZ being something other than
  'int', 'long', 'float', or 'complex'.

Notes:

- The augmented assignment operator /= is handled the same way as the
  / operator.

- This tool never looks at the // operator; no warnings are ever
  generated for use of this operator.

- This tool never looks at the / operator when a future division
  statement is in effect; no warnings are generated in this case, and
  because the tool only looks at files for which at least one classic
  division warning was seen, it will never look at files containing a
  future division statement.

- Warnings may be issued for code not read from a file, but executed
  using an exec statement or the eval() function.  These may have
  <string> in the filename position, in which case the fixdiv script
  will attempt and fail to open a file named '<string>' and issue a
  warning about this failure; or these may be reported as 'Phantom'
  warnings (see above).  You're on your own to deal with these.  You
  could make all recommended changes and add a future division
  statement to all affected files, and then re-run the test script; it
  should not issue any warnings.  If there are any, and you have a
  hard time tracking down where they are generated, you can use the
  -Werror option to force an error instead of a first warning,
  generating a traceback.

- The tool should be run from the same directory as that from which
  the original script was run, otherwise it won't be able to open
  files given by relative pathnames.
i����Nic
CsJy#tjtjdd�\}}Wn!tjk
rF}t|�dSXx>|D]6\}}|dkrotGHdS|dkrNdaqNqNW|s�td�dS|dr�tjjdtjd�nt	|d�}|dkr�dS|j�}|sd	G|dGHdS|j�d}x-|D]%}t
|||�}	|p?|	}qW|S(
Nithmis-hs-ms&at least one file argument is requireds!%s: extra file arguments ignored
is&No classic division warnings read from(tgetopttsystargvterrortusaget__doc__tmulti_oktstderrtwritetreadwarningstNonetkeystsorttprocess(
toptstargstmsgtotatwarningstfilestexittfilenametx((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pytmain�s:#






cCs[tjjdtjd|f�tjjdtjd�tjjdtjd�dS(Ns%s: %s
isUsage: %s [-m] warnings
s"Try `%s -h' for more information.
(RRR	R(R((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyR�s!sL^(.+?):(\d+): DeprecationWarning: classic (int|long|float|complex) division$cCs"tjt�}yt|�}Wn(tk
rI}tjjd|�dSXi}x�|j�}|siPn|j	|�}|s�|j
d�dkrStjjd|�qSqSn|j�\}}}	|j|�}
|
dkr�g||<}
n|
jt|�t|	�f�qSW|j�|S(Nscan't open: %s
tdivisionisWarning: ignored input (tretcompiletPATTERNtopentIOErrorRRR	treadlinetmatchtfindtgroupstgetRtappendtinttinterntclose(twarningsfiletprogtfRRtlinetmRtlinenotwhattlist((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyR
�s.#
cCs@ddGH|st�yt|�}Wn(tk
rO}tjjd|�dSXdG|GHt|�}|j�d}tj	|j
�}x�t|�\}}}	}
|dkr�Pn||ko�dk	ns�t�g}xE|t
|�kr"||d|kr"|j||�|d7}q�W|r9t||�ng}xE|t
|�kr�||d|kr�|j||�|d7}qBW|	r�|r�q�|	r�|r�t|	d�q�|r�|	r�t||�q�t
|	�dkr�ts�g}
d}x?|	D]7\\}}}||kr!q�n|
j|�|}q�W|
sDt�t
|
�dkrfdG|
dGHq�d	Gd
|
d|
dfGHq�ng}g}g}xY|D]Q\}}|dkr�|j|�q�|dkr�|j|�q�|j|�q�Wd}x0|	D](\\}}}||kr&qn|}t|�}|||d!dkrgd|GHdG|GHqn|r�d|G|GHdG|GHq|r�|r�d||fGHdG|GHdGHdG|| d||GHq|r�|r�d|GHdG|GHq|r|rddj|�dj|�|fGHdG|GHqqWq�W|j�dS(Nt-iFscan't open: %s
isIndex:isNo conclusive evidences$*** More than one / operator in lines**** More than one / operator per statementsin lines %d-%di����R&tlongtfloattcomplext/s)*** Can't find the / operator in line %d:t*s*** Bad warning for line %d:s%dc%dt<s---t>s$True division / operator at line %d:t=s-*** Ambiguous / operator (%s, %s) at line %d:t|t?(R&R2(R3R4(tAssertionErrorRRRRR	tFileContextR
ttokenizetgenerate_tokensR tscanlineRtlenR%treportphantomwarningstreportRtchoptjoinR((RR0tfpRR+tindextgtstartlinenot	endlinenotslashestlineinfotorphansRtrowstlastrowtrowtcolR,tintlongtfloatcomplextbadR.R/((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyR�s�		
"))



		

	
	!c	Cs�g}d}d}xF|D]>\}}||krJ|g}|j|�n|j|�qWxM|D]E}|d}dj|d�}d||fGH|j|dd�qbWdS(NiR5is$*** Phantom %s warnings for line %d:tmarkR6(RR%RERC(	RR+tblocksROt	lastblockRPR/tblocktwhats((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyRB$s	

cCsZd}xM|D]E\\}}}||kr
d||fGHdGt|�GH|}q
q
WdS(Ns*** %s on line %d:R6(RRD(RKtmessageRORPRQR,((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyRC3sR=cBsAeZddd�Zd�Zd�Zd�Zddd�ZRS(	iicCs:||_d|_d|_d|_g|_g|_dS(Niii(RFtwindowR.teoflookaheadt	lookaheadtbuffer(tselfRFR[R.((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyt__init__<s					cCs_xXt|j�|jkrZ|jrZ|jj�}|sGd|_Pn|jj|�qWdS(Ni(RAR]R[R\RFR R%(R_R,((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pytfillCs%	cCsL|j�|jsdS|jjd�}|jj|�|jd7_|S(Ntii(RaR]tpopR^R%R.(R_R,((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyR Js
	cCs�|j�|jt|j�}|jt|j�}||koP|jknrd|j||S|j|ko~|knr�|j||jSt�dS(N(RaR.RAR^R]tKeyError(R_RGtbufstarttlookend((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyt__getitem__Rs
R6cCsn|dkr|}nxRt||d�D]=}y||}Wntk
rVd}nX|Gt|�GHq)WdS(Nis<missing line>(RtrangeRdRD(R_tfirsttlastRUtiR,((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyRC[s	

N(t__name__t
__module__R`RaR RgRRC(((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyR=;s
				c	Cs�g}d}d}xq|D]i\}}}}}|d}|dkrM|}n|dkro|j||f�n|tjkrPqqW|||fS(NiR5s/=(R5s/=(RR%R>tNEWLINE(	RHRKRIRJttypettokentstarttendR,((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyR@es
	cCs|jd�r|d S|SdS(Ns
i����(tendswith(R,((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyRDsst__main__((RRRRR>RRRRR
RRBRCR=R@RDRlR(((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyt<module>�s"	 			W		*		lfcr.pyo000064400000001560151732701200006223 0ustar00�
�fc@sMdZddlZddlZddlZd�ZedkrIe�ndS(sFReplace LF with CRLF in argument files.  Print names of changed files.i����NcCs�x�tjdD]�}tjj|�r5|GdGHqnt|d�j�}d|kre|GdGHqntjdd|�}||kr|GHt|d�}|j	|�|j
�qqWdS(	Nis
Directory!trbssBinary!s
?
s
twb(tsystargvtostpathtisdirtopentreadtretsubtwritetclose(tfilenametdatatnewdatatf((s*/usr/lib64/python2.7/Tools/scripts/lfcr.pytmains		
t__main__(t__doc__RR	RRt__name__(((s*/usr/lib64/python2.7/Tools/scripts/lfcr.pyt<module>s$	diff.py000075500000004022151732701200006025 0ustar00#! /usr/bin/python2.7
""" Command line interface to difflib.py providing diffs in four formats:

* ndiff:    lists every line and highlights interline changes.
* context:  highlights clusters of changes in a before/after format.
* unified:  highlights clusters of changes in an inline format.
* html:     generates side by side comparison with change highlights.

"""

import sys, os, time, difflib, optparse

def main():

    usage = "usage: %prog [options] fromfile tofile"
    parser = optparse.OptionParser(usage)
    parser.add_option("-c", action="store_true", default=False, help='Produce a context format diff (default)')
    parser.add_option("-u", action="store_true", default=False, help='Produce a unified format diff')
    parser.add_option("-m", action="store_true", default=False, help='Produce HTML side by side diff (can use -c and -l in conjunction)')
    parser.add_option("-n", action="store_true", default=False, help='Produce a ndiff format diff')
    parser.add_option("-l", "--lines", type="int", default=3, help='Set number of context lines (default 3)')
    (options, args) = parser.parse_args()

    if len(args) == 0:
        parser.print_help()
        sys.exit(1)
    if len(args) != 2:
        parser.error("need to specify both a fromfile and tofile")

    n = options.lines
    fromfile, tofile = args

    fromdate = time.ctime(os.stat(fromfile).st_mtime)
    todate = time.ctime(os.stat(tofile).st_mtime)
    with open(fromfile, 'U') as f:
        fromlines = f.readlines()
    with open(tofile, 'U') as f:
        tolines = f.readlines()

    if options.u:
        diff = difflib.unified_diff(fromlines, tolines, fromfile, tofile, fromdate, todate, n=n)
    elif options.n:
        diff = difflib.ndiff(fromlines, tolines)
    elif options.m:
        diff = difflib.HtmlDiff().make_file(fromlines,tolines,fromfile,tofile,context=options.c,numlines=n)
    else:
        diff = difflib.context_diff(fromlines, tolines, fromfile, tofile, fromdate, todate, n=n)

    sys.stdout.writelines(diff)

if __name__ == '__main__':
    main()
pindent.pyc000064400000026447151732701200006735 0ustar00�
�fc@s�ddlmZdZdZeZddlZddlZddlZiZ	d e	d<e	d<d!e	d<e	d	<d"e	d<d#e	d
<de	d<e	d<e	d
<e	d<e	d<d$e	d<d%Z
dd&d��YZejej
eeed�Zejej
eeed�Zejej
eeed�Zeeed�Zeeed�Zeeed�Zd�Zeeed�Zeeed�Zeeed�Zde�Zd�Zd�Zedkr�e�ndS('i����(tprint_functioniNteliftelsetendtiftwhiletfortexcepttfinallyttrytwithtdeftclasstPythonIndentercBsneZejejeeed�Zd�Z	d�Z
d�Zd�Zd�Z
d�Zd�Zd�ZRS(	cCs|||_||_||_||_d|_||_|j|_tj	d�|_
tj	d�|_tj	d�|_dS(NisC^(?:\s|\\\n)*(?P<kw>[a-z]+)((?:\s|\\\n)+(?P<id>[a-zA-Z_]\w*))?[^\w]sE^(?:\s|\\\n)*#?\s*end\s+(?P<kw>[a-z]+)(\s+(?P<id>[a-zA-Z_]\w*))?[^\w]s^[ \t]*(
tfpitfpot
indentsizettabsizetlinenot
expandtabstwritet_writetretcompiletkwprogtendprogtwsprog(tselfRRRRR((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyt__init__fs						cCs6|jr%|j|j|j��n
|j|�dS(N(RRR(Rtline((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyRzs	cCs+|jj�}|r'|jd7_n|S(Ni(RtreadlineR(RR((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyR�scGsE|r||}ntjjd|j|f�|jd|�dS(NsError at line %d: %s
s### %s ###
(tsyststderrRR(Rtfmttargs((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyterror�s
cCsG|j�}x4|ddkrB|j�}|s5Pn||7}qW|S(Ni����s\
(R(RRtline2((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytgetline�scCs{t||j|j�\}}|jj|�j�}||}|d dkrjd|d||}n|j|�dS(Nis
s
ts	t (s
s
R&(tdivmodRRRtmatchRR(RRtindentttabstspacesti((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytputline�s
cCs�g}xutr}|j�}|s%Pn|jj|�}|r�d}|jd�}|sh|jd�n&|j�d|kr�|jd�n|j|t|��q	n|j	j|�}|rd|jd�}|t
kr|j|t|��|j||f�q	ntj
|�rd|rd|j|t|�d�|d\}}||f|d<q	qdn|j|t|��q	W|r�|jd�x(|D]\}}|jd	|�q�WndS(
NRtkwsunexpected endis
unmatched endii����sunterminated keywordss	%s
(tTrueR%RR)tgroupR#tpopR.tlenRtstarttappendtnextthas_keyR(RtstackRtmR/tkw2tkwatkwb((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytreformat�s@		
cCs�d}d}x�tr�|j�}|s+Pn|jj|�}|rS|d7}qn|jj|�}|r�|jd�}|tkr�|d7}q�n|j|�qW||dkr�tj	jd�n#||dkr�tj	jd�ndS(NiiR/s5Warning: input contained more end tags than expected
s5Warning: input contained less end tags than expected
(
R0R%RR)RR1R4RRR (Rt
begin_countertend_counterRR9R/((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytdelete�s(	
cCs\g}g}d}}}}}x3trW|j�}|jj|�j�}	|jj|�}
|
r�d}|
jd�}|
jd�}n�|jj|�}
|
r�|
jd�}tj	|�s�d}n|d
kr�|
jd�}q$d}n0||	|	d!dkr|j
|�q%nd}||	 }
t|
j|j
��}t|j|j
��}x�||kr�|r�|r�d
||f}n
d|}|j||�d}}n|j�\}}}}t|j|j
��}qaW||kr�|r�|dkr/||kr"|jd�nd}}q�|sB|tkr�|r[d
||f}n
d|}|j||�d}}}q�n||kr�|j
||||f�|r�|tkr�d}n|
|||f\}}}}n|r|tkr|}}|}q|}nx|D]}|j|�q Wg}|sGPn|j|�q%WdS(NR&RR/tidRRis
t#s# end %s %s
s	# end %s
smismatched end(RR(s
RB(R0R%RR)RRR1RR6R7R5R3RRRR2R#R4(RR8ttodot	currentwstthisidtfirstkwtlastkwttopidRR-R9tthiskwtendkwtindentwsR*tcurrenttstl((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytcomplete�s�			





	!
		
(t__name__t
__module__RtstdintstdouttSTEPSIZEtTABSIZEt
EXPANDTABSRRRR#R%R.R=R@RO(((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyR
ds					
	+	cCs&t|||||�}|j�dS(N(R
RO(tinputtoutputtstepsizeRRtpi((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytcomplete_filterMscCs&t|||||�}|j�dS(N(R
R@(RWRXRYRRRZ((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyt
delete_filterSscCs&t|||||�}|j�dS(N(R
R=(RWRXRYRRRZ((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytreformat_filterYscCsGtj|�}tj�}t|||||�}|j�|j�S(N(tiotBytesIOR
ROtgetvalue(tsourceRYRRRWRXRZ((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytcomplete_string_s

cCsGtj|�}tj�}t|||||�}|j�|j�S(N(R^R_R
R@R`(RaRYRRRWRXRZ((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyt
delete_stringgs

cCsGtj|�}tj�}t|||||�}|j�|j�S(N(R^R_R
R=R`(RaRYRRRWRXRZ((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytreformat_stringos

cCs�ddl}ddl}|d}|jj|�ryy|j|�Wqy|jk
rutd|fdtj�qyXny|j	||�Wn1|jk
r�td||fdtj�nXdS(Ni����t~sCan't remove backup %rtfilesCan't rename %r to %r(
tostos.pathtpathtlexiststremoveR#tprintRR trename(tfilenameRgtbackup((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytmake_backupws
!cCs|t|d��}|j�}WdQXt||||�}||krIdSt|�t|d��}|j|�WdQXdS(Ntritwi(topentreadRbRpR(RnRYRRtfRatresult((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyt
complete_file�s
cCs|t|d��}|j�}WdQXt||||�}||krIdSt|�t|d��}|j|�WdQXdS(NRqiRri(RsRtRcRpR(RnRYRRRuRaRv((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytdelete_file�s
cCs|t|d��}|j�}WdQXt||||�}||krIdSt|�t|d��}|j|�WdQXdS(NRqiRri(RsRtRdRpR(RnRYRRRuRaRv((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyt
reformat_file�s
sG
usage: pindent (-c|-d|-r) [-s stepsize] [-t tabsize] [-e] [file] ...
-c         : complete a correctly indented program (add #end directives)
-d         : delete #end directives
-r         : reformat a completed program (use #end directives)
-s stepsize: indentation step (default %(STEPSIZE)d)
-t tabsize : the worth in spaces of a tab (default %(TABSIZE)d)
-e         : expand TABs into spaces (default OFF)
[file] ... : files are changed in place, with backups in file~
If no files are specified or a single - is given,
the program acts as a filter (reads stdin, writes stdout).
cCsEtjjd|d|dd�tjjt�tjd�dS(Ns Error: You can not specify both s and -is at the same time
i(RR Rtusagetexit(top1top2((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyt
error_both�s$cCs'ddl}y#|jtjdd�\}}WnG|jk
rx}tjjd|�tjjt�tjd�nXd}t	}t
}t}x�|D]�\}}	|dkr�|r�t||�nd}q�|dkr�|r�t||�nd	}q�|d
kr%|rt||�nd}q�|dkr@t
|	�}q�|d
kr[t
|	�}q�|dkr�t}q�q�W|s�tjjd�tjjt�tjd�n|s�|dgkr�t|d�}|tjtj|||�n4t|d�}x!|D]}
||
|||�qWdS(Ni����iscdrs:t:es
Error: %s
is-cROs-dR@s-rR=s-ss-ts-es7You must specify -c(omplete), -d(elete) or -r(eformat)
t-t_filtert_file(tgetoptRtargvR#R RRzR{tNoneRTRURVR~tintR0tevalRRRS(R�toptsR"tmsgtactionRYRRtotaRn((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyttest�sR#			
	
t__main__(RRR(RR(RR(RRRR((RRRR	R
RR((t
__future__RRTRUtFalseRVR^RRR6R4R
RRRSR[R\R]RbRcRdRpRwRxRytvarsRzR~R�RP(((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyt<module>OsB

*
�	
		3checkpip.pyo000064400000002024151732701200007057 0ustar00�
�fc@sYdZddlZddlZddlZddlZd�ZedkrUe�ndS(sa
Checks that the version of the projects bundled in ensurepip are the latest
versions available.
i����NcCs�t}x~tjD]s\}}tjtjdj|��j�j	d��}|dd}||krt
}dj|||�GHqqW|r�tjd�ndS(Ns$https://pypi.python.org/pypi/{}/jsontutf8tinfotversions<The latest version of {} on PyPI is {}, but ensurepip has {}i(
tFalset	ensurepipt	_PROJECTStjsontloadsturllib2turlopentformattreadtdecodetTruetsystexit(t	outofdatetprojectRtdatatupstream_version((s./usr/lib64/python2.7/Tools/scripts/checkpip.pytmainst__main__(t__doc__RRRRRt__name__(((s./usr/lib64/python2.7/Tools/scripts/checkpip.pyt<module>s	parseentities.pyc000064400000004035151732701200010140 0ustar00�
�fc@s�dZddlZddlZddlZejd�Zddd�Zd�Ze	dkr�e
ej�dkr�eejd�Z
n	ejZ
e
ej�d	kr�eejd	d
�Zn	ejZe
j�Zee�Zeee�ndS(s� Utility for parsing HTML entity definitions available from:

      http://www.w3.org/ as e.g.
      http://www.w3.org/TR/REC-html40/HTMLlat1.ent

    Input is read from stdin, output is written to stdout in form of a
    Python snippet defining a dictionary "entitydefs" mapping literal
    entity name to character or numeric entity.

    Marc-Andre Lemburg, mal@lemburg.com, 1999.
    Use as you like. NO WARRANTIES.

i����Ns7<!ENTITY +(\w+) +CDATA +"([^"]+)" +-- +((?:.|
)+?) *-->icCs�d}|dkr!t|�}ni}xTtj|||�}|sIPn|j�\}}}||f||<|j�}q*W|S(Ni(tNonetlententityREtsearchtgroupstend(ttexttpostendpostdtmtnametcharcodetcomment((s3/usr/lib64/python2.7/Tools/scripts/parseentities.pytparsescCs�|jd�|j�}|j�x�|D]�\}\}}|d dkr�t|dd!�}|dkrxd|}q�t|�}nt|�}tj|�}|jd|||f�q*W|jd�dS(	Nsentitydefs = {
is&#i����is'\%o's    '%s':	%s,  	# %s
s
}
(twritetitemstsorttinttreprt	TextToolstcollapse(tftdefsRRRR
tcode((s3/usr/lib64/python2.7/Tools/scripts/parseentities.pyt	writefile#s


t__main__iitw(t__doc__tretsysRtcompileRRRRt__name__RtargvtopentinfiletstdintoutfiletstdouttreadRR(((s3/usr/lib64/python2.7/Tools/scripts/parseentities.pyt<module>s			byext.py000075500000007550151732701200006261 0ustar00#! /usr/bin/python2.7

"""Show file statistics by extension."""

from __future__ import print_function

import os
import sys

class Stats:

    def __init__(self):
        self.stats = {}

    def statargs(self, args):
        for arg in args:
            if os.path.isdir(arg):
                self.statdir(arg)
            elif os.path.isfile(arg):
                self.statfile(arg)
            else:
                sys.stderr.write("Can't find %s\n" % arg)
                self.addstats("<???>", "unknown", 1)

    def statdir(self, dir):
        self.addstats("<dir>", "dirs", 1)
        try:
            names = sorted(os.listdir(dir))
        except os.error as err:
            sys.stderr.write("Can't list %s: %s\n" % (dir, err))
            self.addstats("<dir>", "unlistable", 1)
            return
        for name in names:
            if name.startswith(".#"):
                continue # Skip CVS temp files
            if name.endswith("~"):
                continue# Skip Emacs backup files
            full = os.path.join(dir, name)
            if os.path.islink(full):
                self.addstats("<lnk>", "links", 1)
            elif os.path.isdir(full):
                self.statdir(full)
            else:
                self.statfile(full)

    def statfile(self, filename):
        head, ext = os.path.splitext(filename)
        head, base = os.path.split(filename)
        if ext == base:
            ext = "" # E.g. .cvsignore is deemed not to have an extension
        ext = os.path.normcase(ext)
        if not ext:
            ext = "<none>"
        self.addstats(ext, "files", 1)
        try:
            f = open(filename, "rb")
        except IOError as err:
            sys.stderr.write("Can't open %s: %s\n" % (filename, err))
            self.addstats(ext, "unopenable", 1)
            return
        data = f.read()
        f.close()
        self.addstats(ext, "bytes", len(data))
        if b'\0' in data:
            self.addstats(ext, "binary", 1)
            return
        if not data:
            self.addstats(ext, "empty", 1)
        #self.addstats(ext, "chars", len(data))
        lines = data.splitlines()
        self.addstats(ext, "lines", len(lines))
        del lines
        words = data.split()
        self.addstats(ext, "words", len(words))

    def addstats(self, ext, key, n):
        d = self.stats.setdefault(ext, {})
        d[key] = d.get(key, 0) + n

    def report(self):
        exts = sorted(self.stats.keys())
        # Get the column keys
        columns = {}
        for ext in exts:
            columns.update(self.stats[ext])
        cols = sorted(columns.keys())
        colwidth = {}
        colwidth["ext"] = max([len(ext) for ext in exts])
        minwidth = 6
        self.stats["TOTAL"] = {}
        for col in cols:
            total = 0
            cw = max(minwidth, len(col))
            for ext in exts:
                value = self.stats[ext].get(col)
                if value is None:
                    w = 0
                else:
                    w = len("%d" % value)
                    total += value
                cw = max(cw, w)
            cw = max(cw, len(str(total)))
            colwidth[col] = cw
            self.stats["TOTAL"][col] = total
        exts.append("TOTAL")
        for ext in exts:
            self.stats[ext]["ext"] = ext
        cols.insert(0, "ext")
        def printheader():
            for col in cols:
                print("%*s" % (colwidth[col], col), end=" ")
            print()
        printheader()
        for ext in exts:
            for col in cols:
                value = self.stats[ext].get(col, "")
                print("%*s" % (colwidth[col], value), end=" ")
            print()
        printheader() # Another header at the bottom

def main():
    args = sys.argv[1:]
    if not args:
        args = [os.curdir]
    s = Stats()
    s.statargs(args)
    s.report()

if __name__ == "__main__":
    main()
lll.py000075500000001346151732701200005706 0ustar00#! /usr/bin/python2.7

# Find symbolic links and show where they point to.
# Arguments are directories to search; default is current directory.
# No recursion.
# (This is a totally different program from "findsymlinks.py"!)

import sys, os

def lll(dirname):
    for name in os.listdir(dirname):
        if name not in (os.curdir, os.pardir):
            full = os.path.join(dirname, name)
            if os.path.islink(full):
                print name, '->', os.readlink(full)
def main(args):
    if not args: args = [os.curdir]
    first = 1
    for arg in args:
        if len(args) > 1:
            if not first: print
            first = 0
            print arg + ':'
        lll(arg)

if __name__ == '__main__':
    main(sys.argv[1:])
crlf.pyc000064400000001527151732701200006212 0ustar00�
�fc@sAdZddlZddlZd�Zedkr=e�ndS(sFReplace CRLF with LF in argument files.  Print names of changed files.i����NcCs�x�tjdD]�}tjj|�r5|GdGHqnt|d�j�}d|kre|GdGHqn|jdd�}||kr|GHt|d�}|j|�|j	�qqWdS(	Nis
Directory!trbssBinary!s
s
twb(
tsystargvtostpathtisdirtopentreadtreplacetwritetclose(tfilenametdatatnewdatatf((s*/usr/lib64/python2.7/Tools/scripts/crlf.pytmains		
t__main__(t__doc__RRRt__name__(((s*/usr/lib64/python2.7/Tools/scripts/crlf.pyt<module>s	checkpyc.py000075500000003732151732701200006715 0ustar00#! /usr/bin/python2.7
# Check that all ".pyc" files exist and are up-to-date
# Uses module 'os'

import sys
import os
from stat import ST_MTIME
import imp

def main():
    silent = 0
    verbose = 0
    if sys.argv[1:]:
        if sys.argv[1] == '-v':
            verbose = 1
        elif sys.argv[1] == '-s':
            silent = 1
    MAGIC = imp.get_magic()
    if not silent:
        print 'Using MAGIC word', repr(MAGIC)
    for dirname in sys.path:
        try:
            names = os.listdir(dirname)
        except os.error:
            print 'Cannot list directory', repr(dirname)
            continue
        if not silent:
            print 'Checking ', repr(dirname), '...'
        names.sort()
        for name in names:
            if name[-3:] == '.py':
                name = os.path.join(dirname, name)
                try:
                    st = os.stat(name)
                except os.error:
                    print 'Cannot stat', repr(name)
                    continue
                if verbose:
                    print 'Check', repr(name), '...'
                name_c = name + 'c'
                try:
                    f = open(name_c, 'r')
                except IOError:
                    print 'Cannot open', repr(name_c)
                    continue
                magic_str = f.read(4)
                mtime_str = f.read(4)
                f.close()
                if magic_str <> MAGIC:
                    print 'Bad MAGIC word in ".pyc" file',
                    print repr(name_c)
                    continue
                mtime = get_long(mtime_str)
                if mtime == 0 or mtime == -1:
                    print 'Bad ".pyc" file', repr(name_c)
                elif mtime <> st[ST_MTIME]:
                    print 'Out-of-date ".pyc" file',
                    print repr(name_c)

def get_long(s):
    if len(s) <> 4:
        return -1
    return ord(s[0]) + (ord(s[1])<<8) + (ord(s[2])<<16) + (ord(s[3])<<24)

if __name__ == '__main__':
    main()
dutree.pyc000064400000004266151732701200006557 0ustar00�
�fc@sbddlZddlZddlZd�Zd�Zd�Zd�Zedkr^e�ndS(i����Nc	Csgtjddjtjd�d�}di}}x�|j�D]�}d}x||dkrl|d}qOWt|| �}x||dkr�|d}q�W||d!}|jd	�}|dd
kr�d	|d<n|t	|�dd
kr|t	|�d=nt
||||�\}}q@Wyt||�Wn+tk
rb}|j
t
jkrc�qcnXdS(Nsdu t itrit
0123456789s 	i����t/t(tostpopentjointsystargvtNonet	readlinestevaltsplittlentstoretdisplaytIOErrorterrnotEPIPE(	tpttotaltdtlinetitsizetfilenametcompste((s,/usr/lib64/python2.7/Tools/scripts/dutree.pytmains*&


cCs|gkr||fS|j|d�s@dif||d<n||d\}}t||d||�||d<||fS(Nii(thas_keyR
R(RRRRtt1td1((s,/usr/lib64/python2.7/Tools/scripts/dutree.pyRs
!cCst||d�dS(NR(tshow(RR((s,/usr/lib64/python2.7/Tools/scripts/dutree.pyR"sc
Cs9|s
dSg}d}xP|j�D]B}||\}}|j||f�|dk	r#||}q#q#W|j�|j�tt|dd��}x�|D]�\}}|dkr�|}	nH|t|�j|�d|GH|d|dddt|�d}	|j|�r�t	|||d|	�q�q�WdS(NiRit|(
tkeystappendR
tsorttreverseRtreprtrjustRR!(
RRtprefixtlisttsumtkeyttsubtdsubtwidthtpsub((s,/usr/lib64/python2.7/Tools/scripts/dutree.pyR!%s&

	 (t__main__(RRRRRRR!t__name__(((s,/usr/lib64/python2.7/Tools/scripts/dutree.pyt<module>s$					suff.py000075500000001155151732701200006064 0ustar00#! /usr/bin/python2.7

# suff
#
# show different suffixes amongst arguments

import sys

def main():
    files = sys.argv[1:]
    suffixes = {}
    for filename in files:
        suff = getsuffix(filename)
        if not suffixes.has_key(suff):
            suffixes[suff] = []
        suffixes[suff].append(filename)
    keys = suffixes.keys()
    keys.sort()
    for suff in keys:
        print repr(suff), len(suffixes[suff])

def getsuffix(filename):
    suff = ''
    for i in range(len(filename)):
        if filename[i] == '.':
            suff = filename[i:]
    return suff

if __name__ == '__main__':
    main()
analyze_dxp.py000075500000010155151732701200007437 0ustar00#! /usr/bin/python2.7
"""
Some helper functions to analyze the output of sys.getdxp() (which is
only available if Python was built with -DDYNAMIC_EXECUTION_PROFILE).
These will tell you which opcodes have been executed most frequently
in the current process, and, if Python was also built with -DDXPAIRS,
will tell you which instruction _pairs_ were executed most frequently,
which may help in choosing new instructions.

If Python was built without -DDYNAMIC_EXECUTION_PROFILE, importing
this module will raise a RuntimeError.

If you're running a script you want to profile, a simple way to get
the common pairs is:

$ PYTHONPATH=$PYTHONPATH:<python_srcdir>/Tools/scripts \
./python -i -O the_script.py --args
...
> from analyze_dxp import *
> s = render_common_pairs()
> open('/tmp/some_file', 'w').write(s)
"""

import copy
import opcode
import operator
import sys
import threading

if not hasattr(sys, "getdxp"):
    raise RuntimeError("Can't import analyze_dxp: Python built without"
                       " -DDYNAMIC_EXECUTION_PROFILE.")


_profile_lock = threading.RLock()
_cumulative_profile = sys.getdxp()

# If Python was built with -DDXPAIRS, sys.getdxp() returns a list of
# lists of ints.  Otherwise it returns just a list of ints.
def has_pairs(profile):
    """Returns True if the Python that produced the argument profile
    was built with -DDXPAIRS."""

    return len(profile) > 0 and isinstance(profile[0], list)


def reset_profile():
    """Forgets any execution profile that has been gathered so far."""
    with _profile_lock:
        sys.getdxp()  # Resets the internal profile
        global _cumulative_profile
        _cumulative_profile = sys.getdxp()  # 0s out our copy.


def merge_profile():
    """Reads sys.getdxp() and merges it into this module's cached copy.

    We need this because sys.getdxp() 0s itself every time it's called."""

    with _profile_lock:
        new_profile = sys.getdxp()
        if has_pairs(new_profile):
            for first_inst in range(len(_cumulative_profile)):
                for second_inst in range(len(_cumulative_profile[first_inst])):
                    _cumulative_profile[first_inst][second_inst] += (
                        new_profile[first_inst][second_inst])
        else:
            for inst in range(len(_cumulative_profile)):
                _cumulative_profile[inst] += new_profile[inst]


def snapshot_profile():
    """Returns the cumulative execution profile until this call."""
    with _profile_lock:
        merge_profile()
        return copy.deepcopy(_cumulative_profile)


def common_instructions(profile):
    """Returns the most common opcodes in order of descending frequency.

    The result is a list of tuples of the form
      (opcode, opname, # of occurrences)

    """
    if has_pairs(profile) and profile:
        inst_list = profile[-1]
    else:
        inst_list = profile
    result = [(op, opcode.opname[op], count)
              for op, count in enumerate(inst_list)
              if count > 0]
    result.sort(key=operator.itemgetter(2), reverse=True)
    return result


def common_pairs(profile):
    """Returns the most common opcode pairs in order of descending frequency.

    The result is a list of tuples of the form
      ((1st opcode, 2nd opcode),
       (1st opname, 2nd opname),
       # of occurrences of the pair)

    """
    if not has_pairs(profile):
        return []
    result = [((op1, op2), (opcode.opname[op1], opcode.opname[op2]), count)
              # Drop the row of single-op profiles with [:-1]
              for op1, op1profile in enumerate(profile[:-1])
              for op2, count in enumerate(op1profile)
              if count > 0]
    result.sort(key=operator.itemgetter(2), reverse=True)
    return result


def render_common_pairs(profile=None):
    """Renders the most common opcode pairs to a string in order of
    descending frequency.

    The result is a series of lines of the form:
      # of occurrences: ('1st opname', '2nd opname')

    """
    if profile is None:
        profile = snapshot_profile()
    def seq():
        for _, ops, count in common_pairs(profile):
            yield "%s: %s\n" % (count, ops)
    return ''.join(seq())
ifdef.py000075500000007206151732701200006201 0ustar00#! /usr/bin/python2.7

# Selectively preprocess #ifdef / #ifndef statements.
# Usage:
# ifdef [-Dname] ... [-Uname] ... [file] ...
#
# This scans the file(s), looking for #ifdef and #ifndef preprocessor
# commands that test for one of the names mentioned in the -D and -U
# options.  On standard output it writes a copy of the input file(s)
# minus those code sections that are suppressed by the selected
# combination of defined/undefined symbols.  The #if(n)def/#else/#else
# lines themselves (if the #if(n)def tests for one of the mentioned
# names) are removed as well.

# Features: Arbitrary nesting of recognized and unrecognized
# preprocessor statements works correctly.  Unrecognized #if* commands
# are left in place, so it will never remove too much, only too
# little.  It does accept whitespace around the '#' character.

# Restrictions: There should be no comments or other symbols on the
# #if(n)def lines.  The effect of #define/#undef commands in the input
# file or in included files is not taken into account.  Tests using
# #if and the defined() pseudo function are not recognized.  The #elif
# command is not recognized.  Improperly nesting is not detected.
# Lines that look like preprocessor commands but which are actually
# part of comments or string literals will be mistaken for
# preprocessor commands.

import sys
import getopt

defs = []
undefs = []

def main():
    opts, args = getopt.getopt(sys.argv[1:], 'D:U:')
    for o, a in opts:
        if o == '-D':
            defs.append(a)
        if o == '-U':
            undefs.append(a)
    if not args:
        args = ['-']
    for filename in args:
        if filename == '-':
            process(sys.stdin, sys.stdout)
        else:
            f = open(filename, 'r')
            process(f, sys.stdout)
            f.close()

def process(fpi, fpo):
    keywords = ('if', 'ifdef', 'ifndef', 'else', 'endif')
    ok = 1
    stack = []
    while 1:
        line = fpi.readline()
        if not line: break
        while line[-2:] == '\\\n':
            nextline = fpi.readline()
            if not nextline: break
            line = line + nextline
        tmp = line.strip()
        if tmp[:1] != '#':
            if ok: fpo.write(line)
            continue
        tmp = tmp[1:].strip()
        words = tmp.split()
        keyword = words[0]
        if keyword not in keywords:
            if ok: fpo.write(line)
            continue
        if keyword in ('ifdef', 'ifndef') and len(words) == 2:
            if keyword == 'ifdef':
                ko = 1
            else:
                ko = 0
            word = words[1]
            if word in defs:
                stack.append((ok, ko, word))
                if not ko: ok = 0
            elif word in undefs:
                stack.append((ok, not ko, word))
                if ko: ok = 0
            else:
                stack.append((ok, -1, word))
                if ok: fpo.write(line)
        elif keyword == 'if':
            stack.append((ok, -1, ''))
            if ok: fpo.write(line)
        elif keyword == 'else' and stack:
            s_ok, s_ko, s_word = stack[-1]
            if s_ko < 0:
                if ok: fpo.write(line)
            else:
                s_ko = not s_ko
                ok = s_ok
                if not s_ko: ok = 0
                stack[-1] = s_ok, s_ko, s_word
        elif keyword == 'endif' and stack:
            s_ok, s_ko, s_word = stack[-1]
            if s_ko < 0:
                if ok: fpo.write(line)
            del stack[-1]
            ok = s_ok
        else:
            sys.stderr.write('Unknown keyword %s\n' % keyword)
    if stack:
        sys.stderr.write('stack: %s\n' % stack)

if __name__ == '__main__':
    main()
methfix.py000075500000012526151732701200006571 0ustar00#! /usr/bin/python2.7

# Fix Python source files to avoid using
#       def method(self, (arg1, ..., argn)):
# instead of the more rational
#       def method(self, arg1, ..., argn):
#
# Command line arguments are files or directories to be processed.
# Directories are searched recursively for files whose name looks
# like a python module.
# Symbolic links are always ignored (except as explicit directory
# arguments).  Of course, the original file is kept as a back-up
# (with a "~" attached to its name).
# It complains about binaries (files containing null bytes)
# and about files that are ostensibly not Python files: if the first
# line starts with '#!' and does not contain the string 'python'.
#
# Changes made are reported to stdout in a diff-like format.
#
# Undoubtedly you can do this using find and sed or perl, but this is
# a nice example of Python code that recurses down a directory tree
# and uses regular expressions.  Also note several subtleties like
# preserving the file's mode and avoiding to even write a temp file
# when no changes are needed for a file.
#
# NB: by changing only the function fixline() you can turn this
# into a program for a different change to Python programs...

import sys
import re
import os
from stat import *

err = sys.stderr.write
dbg = err
rep = sys.stdout.write

def main():
    bad = 0
    if not sys.argv[1:]: # No arguments
        err('usage: ' + sys.argv[0] + ' file-or-directory ...\n')
        sys.exit(2)
    for arg in sys.argv[1:]:
        if os.path.isdir(arg):
            if recursedown(arg): bad = 1
        elif os.path.islink(arg):
            err(arg + ': will not process symbolic links\n')
            bad = 1
        else:
            if fix(arg): bad = 1
    sys.exit(bad)

ispythonprog = re.compile('^[a-zA-Z0-9_]+\.py$')
def ispython(name):
    return ispythonprog.match(name) >= 0

def recursedown(dirname):
    dbg('recursedown(%r)\n' % (dirname,))
    bad = 0
    try:
        names = os.listdir(dirname)
    except os.error, msg:
        err('%s: cannot list directory: %r\n' % (dirname, msg))
        return 1
    names.sort()
    subdirs = []
    for name in names:
        if name in (os.curdir, os.pardir): continue
        fullname = os.path.join(dirname, name)
        if os.path.islink(fullname): pass
        elif os.path.isdir(fullname):
            subdirs.append(fullname)
        elif ispython(name):
            if fix(fullname): bad = 1
    for fullname in subdirs:
        if recursedown(fullname): bad = 1
    return bad

def fix(filename):
##  dbg('fix(%r)\n' % (filename,))
    try:
        f = open(filename, 'r')
    except IOError, msg:
        err('%s: cannot open: %r\n' % (filename, msg))
        return 1
    head, tail = os.path.split(filename)
    tempname = os.path.join(head, '@' + tail)
    g = None
    # If we find a match, we rewind the file and start over but
    # now copy everything to a temp file.
    lineno = 0
    while 1:
        line = f.readline()
        if not line: break
        lineno = lineno + 1
        if g is None and '\0' in line:
            # Check for binary files
            err(filename + ': contains null bytes; not fixed\n')
            f.close()
            return 1
        if lineno == 1 and g is None and line[:2] == '#!':
            # Check for non-Python scripts
            words = line[2:].split()
            if words and re.search('[pP]ython', words[0]) < 0:
                msg = filename + ': ' + words[0]
                msg = msg + ' script; not fixed\n'
                err(msg)
                f.close()
                return 1
        while line[-2:] == '\\\n':
            nextline = f.readline()
            if not nextline: break
            line = line + nextline
            lineno = lineno + 1
        newline = fixline(line)
        if newline != line:
            if g is None:
                try:
                    g = open(tempname, 'w')
                except IOError, msg:
                    f.close()
                    err('%s: cannot create: %r\n' % (tempname, msg))
                    return 1
                f.seek(0)
                lineno = 0
                rep(filename + ':\n')
                continue # restart from the beginning
            rep(repr(lineno) + '\n')
            rep('< ' + line)
            rep('> ' + newline)
        if g is not None:
            g.write(newline)

    # End of file
    f.close()
    if not g: return 0 # No changes

    # Finishing touch -- move files

    # First copy the file's mode to the temp file
    try:
        statbuf = os.stat(filename)
        os.chmod(tempname, statbuf[ST_MODE] & 07777)
    except os.error, msg:
        err('%s: warning: chmod failed (%r)\n' % (tempname, msg))
    # Then make a backup of the original file as filename~
    try:
        os.rename(filename, filename + '~')
    except os.error, msg:
        err('%s: warning: backup failed (%r)\n' % (filename, msg))
    # Now move the temp file to the original file
    try:
        os.rename(tempname, filename)
    except os.error, msg:
        err('%s: rename failed (%r)\n' % (filename, msg))
        return 1
    # Return succes
    return 0


fixpat = '^[ \t]+def +[a-zA-Z0-9_]+ *( *self *, *(( *(.*) *)) *) *:'
fixprog = re.compile(fixpat)

def fixline(line):
    if fixprog.match(line) >= 0:
        (a, b), (c, d) = fixprog.regs[1:3]
        line = line[:a] + line[c:d] + line[b:]
    return line

if __name__ == '__main__':
    main()
texcheck.py000064400000022050151732701210006712 0ustar00""" TeXcheck.py -- rough syntax checking on Python style LaTeX documents.

   Written by Raymond D. Hettinger <python at rcn.com>
   Copyright (c) 2003 Python Software Foundation.  All rights reserved.

Designed to catch common markup errors including:
* Unbalanced or mismatched parenthesis, brackets, and braces.
* Unbalanced or mismatched \\begin and \\end blocks.
* Misspelled or invalid LaTeX commands.
* Use of forward slashes instead of backslashes for commands.
* Table line size mismatches.

Sample command line usage:
    python texcheck.py -k chapterheading -m lib/librandomtex *.tex

Options:
    -m          Munge parenthesis and brackets. [0,n) would normally mismatch.
    -k keyword: Keyword is a valid LaTeX command. Do not include the backslash.
    -d:         Delimiter check only (useful for non-LaTeX files).
    -h:         Help
    -s lineno:  Start at lineno (useful for skipping complex sections).
    -v:         Verbose.  Trace the matching of //begin and //end blocks.
"""

import re
import sys
import getopt
from itertools import izip, count, islice
import glob

cmdstr = r"""
    \section \module \declaremodule \modulesynopsis \moduleauthor
    \sectionauthor \versionadded \code \class \method \begin
    \optional \var \ref \end \subsection \lineiii \hline \label
    \indexii \textrm \ldots \keyword \stindex \index \item \note
    \withsubitem \ttindex \footnote \citetitle \samp \opindex
    \noindent \exception \strong \dfn \ctype \obindex \character
    \indexiii \function \bifuncindex \refmodule \refbimodindex
    \subsubsection \nodename \member \chapter \emph \ASCII \UNIX
    \regexp \program \production \token \productioncont \term
    \grammartoken \lineii \seemodule \file \EOF \documentclass
    \usepackage \title \input \maketitle \ifhtml \fi \url \Cpp
    \tableofcontents \kbd \programopt \envvar \refstmodindex
    \cfunction \constant \NULL \moreargs \cfuncline \cdata
    \textasciicircum \n \ABC \setindexsubitem \versionchanged
    \deprecated \seetext \newcommand \POSIX \pep \warning \rfc
    \verbatiminput \methodline \textgreater \seetitle \lineiv
    \funclineni \ulink \manpage \funcline \dataline \unspecified
    \textbackslash \mimetype \mailheader \seepep \textunderscore
    \longprogramopt \infinity \plusminus \shortversion \version
    \refmodindex \seerfc \makeindex \makemodindex \renewcommand
    \indexname \appendix \protect \indexiv \mbox \textasciitilde
    \platform \seeurl \leftmargin \labelwidth \localmoduletable
    \LaTeX \copyright \memberline \backslash \pi \centerline
    \caption \vspace \textwidth \menuselection \textless
    \makevar \csimplemacro \menuselection \bfcode \sub \release
    \email \kwindex \refexmodindex \filenq \e \menuselection
    \exindex \linev \newsgroup \verbatim \setshortversion
    \author \authoraddress \paragraph \subparagraph \cmemberline
    \textbar \C \seelink
"""

def matchclose(c_lineno, c_symbol, openers, pairmap):
    "Verify that closing delimiter matches most recent opening delimiter"
    try:
        o_lineno, o_symbol = openers.pop()
    except IndexError:
        print "\nDelimiter mismatch.  On line %d, encountered closing '%s' without corresponding open" % (c_lineno, c_symbol)
        return
    if o_symbol in pairmap.get(c_symbol, [c_symbol]): return
    print "\nOpener '%s' on line %d was not closed before encountering '%s' on line %d" % (o_symbol, o_lineno, c_symbol, c_lineno)
    return

def checkit(source, opts, morecmds=[]):
    """Check the LaTeX formatting in a sequence of lines.

    Opts is a mapping of options to option values if any:
        -m          munge parenthesis and brackets
        -d          delimiters only checking
        -v          verbose trace of delimiter matching
        -s lineno:  linenumber to start scan (default is 1).

    Morecmds is a sequence of LaTeX commands (without backslashes) that
    are to be considered valid in the scan.
    """

    texcmd = re.compile(r'\\[A-Za-z]+')
    falsetexcmd = re.compile(r'\/([A-Za-z]+)') # Mismarked with forward slash

    validcmds = set(cmdstr.split())
    for cmd in morecmds:
        validcmds.add('\\' + cmd)

    if '-m' in opts:
        pairmap = {']':'[(', ')':'(['}      # Munged openers
    else:
        pairmap = {']':'[', ')':'('}        # Normal opener for a given closer
    openpunct = set('([')                   # Set of valid openers

    delimiters = re.compile(r'\\(begin|end){([_a-zA-Z]+)}|([()\[\]])')
    braces = re.compile(r'({)|(})')
    doubledwords = re.compile(r'(\b[A-za-z]+\b) \b\1\b')
    spacingmarkup = re.compile(r'\\(ABC|ASCII|C|Cpp|EOF|infinity|NULL|plusminus|POSIX|UNIX)\s')

    openers = []                            # Stack of pending open delimiters
    bracestack = []                         # Stack of pending open braces

    tablestart = re.compile(r'\\begin{(?:long)?table([iv]+)}')
    tableline = re.compile(r'\\line([iv]+){')
    tableend = re.compile(r'\\end{(?:long)?table([iv]+)}')
    tablelevel = ''
    tablestartline = 0

    startline = int(opts.get('-s', '1'))
    lineno = 0

    for lineno, line in izip(count(startline), islice(source, startline-1, None)):
        line = line.rstrip()

        # Check balancing of open/close parenthesis, brackets, and begin/end blocks
        for begend, name, punct in delimiters.findall(line):
            if '-v' in opts:
                print lineno, '|', begend, name, punct,
            if begend == 'begin' and '-d' not in opts:
                openers.append((lineno, name))
            elif punct in openpunct:
                openers.append((lineno, punct))
            elif begend == 'end' and '-d' not in opts:
                matchclose(lineno, name, openers, pairmap)
            elif punct in pairmap:
                matchclose(lineno, punct, openers, pairmap)
            if '-v' in opts:
                print '   --> ', openers

        # Balance opening and closing braces
        for open, close in braces.findall(line):
            if open == '{':
                bracestack.append(lineno)
            if close == '}':
                try:
                    bracestack.pop()
                except IndexError:
                    print r'Warning, unmatched } on line %s.' % (lineno,)

        # Optionally, skip LaTeX specific checks
        if '-d' in opts:
            continue

        # Warn whenever forward slashes encountered with a LaTeX command
        for cmd in falsetexcmd.findall(line):
            if '822' in line or '.html' in line:
                continue    # Ignore false positives for urls and for /rfc822
            if '\\' + cmd in validcmds:
                print 'Warning, forward slash used on line %d with cmd: /%s' % (lineno, cmd)

        # Check for markup requiring {} for correct spacing
        for cmd in spacingmarkup.findall(line):
            print r'Warning, \%s should be written as \%s{} on line %d' % (cmd, cmd, lineno)

        # Validate commands
        nc = line.find(r'\newcommand')
        if nc != -1:
            start = line.find('{', nc)
            end = line.find('}', start)
            validcmds.add(line[start+1:end])
        for cmd in texcmd.findall(line):
            if cmd not in validcmds:
                print r'Warning, unknown tex cmd on line %d: \%s' % (lineno, cmd)

        # Check table levels (make sure lineii only inside tableii)
        m = tablestart.search(line)
        if m:
            tablelevel = m.group(1)
            tablestartline = lineno
        m = tableline.search(line)
        if m and m.group(1) != tablelevel:
            print r'Warning, \line%s on line %d does not match \table%s on line %d' % (m.group(1), lineno, tablelevel, tablestartline)
        if tableend.search(line):
            tablelevel = ''

        # Style guide warnings
        if 'e.g.' in line or 'i.e.' in line:
            print r'Style warning, avoid use of i.e or e.g. on line %d' % (lineno,)

        for dw in doubledwords.findall(line):
            print r'Doubled word warning.  "%s" on line %d' % (dw, lineno)

    lastline = lineno
    for lineno, symbol in openers:
        print "Unmatched open delimiter '%s' on line %d" % (symbol, lineno)
    for lineno in bracestack:
        print "Unmatched { on line %d" % (lineno,)
    print 'Done checking %d lines.' % (lastline,)
    return 0

def main(args=None):
    if args is None:
        args = sys.argv[1:]
    optitems, arglist = getopt.getopt(args, "k:mdhs:v")
    opts = dict(optitems)
    if '-h' in opts or args==[]:
        print __doc__
        return 0

    if len(arglist) < 1:
        print 'Please specify a file to be checked'
        return 1

    for i, filespec in enumerate(arglist):
        if '*' in filespec or '?' in filespec:
            arglist[i:i+1] = glob.glob(filespec)

    morecmds = [v for k,v in optitems if k=='-k']
    err = []

    for filename in arglist:
        print '=' * 30
        print "Checking", filename
        try:
            f = open(filename)
        except IOError:
            print 'Cannot open file %s.' % arglist[0]
            return 2

        try:
            err.append(checkit(f, opts, morecmds))
        finally:
            f.close()

    return max(err)

if __name__ == '__main__':
    sys.exit(main())
checkpyc.pyo000064400000003670151732701210007073 0ustar00�
�fc@s`ddlZddlZddlmZddlZd�Zd�Zedkr\e�ndS(i����N(tST_MTIMEcCsgd}d}tjdrTtjddkr5d}qTtjddkrTd}qTntj�}|sxdGt|�GHnx�tjD]�}ytj|�}Wn&tjk
r�dGt|�GHq�nX|s�dGt|�GdGHn|j	�xr|D]j}|d	d
kr�tjj
||�}ytj|�}Wn&tjk
rWdGt|�GHq�nX|rtdGt|�GdGHn|d
}yt|d�}Wn#t
k
r�dGt|�GHq�nX|jd�}	|jd�}
|j�|	|krdGt|�GHq�nt|
�}|dks$|dkr6dGt|�GHq[||tkr[dGt|�GHq[q�q�Wq�WdS(Niis-vs-ssUsing MAGIC wordsCannot list directorys	Checking s...i����s.pysCannot stattChecktctrsCannot openisBad MAGIC word in ".pyc" filei����sBad ".pyc" filesOut-of-date ".pyc" file(tsystargvtimpt	get_magictreprtpathtostlistdirterrortsorttjointstattopentIOErrortreadtclosetget_longR(tsilenttverbosetMAGICtdirnametnamestnametsttname_ctft	magic_strt	mtime_strtmtime((s./usr/lib64/python2.7/Tools/scripts/checkpyc.pytmain
s`
	




cCsZt|�dkrdSt|d�t|d�d>t|d�d>t|d�d	>S(
Nii����iiiiiii(tlentord(ts((s./usr/lib64/python2.7/Tools/scripts/checkpyc.pyR<st__main__(RR
RRRR!Rt__name__(((s./usr/lib64/python2.7/Tools/scripts/checkpyc.pyt<module>s	2	checkpyc.pyc000064400000003670151732701210007057 0ustar00�
�fc@s`ddlZddlZddlmZddlZd�Zd�Zedkr\e�ndS(i����N(tST_MTIMEcCsgd}d}tjdrTtjddkr5d}qTtjddkrTd}qTntj�}|sxdGt|�GHnx�tjD]�}ytj|�}Wn&tjk
r�dGt|�GHq�nX|s�dGt|�GdGHn|j	�xr|D]j}|d	d
kr�tjj
||�}ytj|�}Wn&tjk
rWdGt|�GHq�nX|rtdGt|�GdGHn|d
}yt|d�}Wn#t
k
r�dGt|�GHq�nX|jd�}	|jd�}
|j�|	|krdGt|�GHq�nt|
�}|dks$|dkr6dGt|�GHq[||tkr[dGt|�GHq[q�q�Wq�WdS(Niis-vs-ssUsing MAGIC wordsCannot list directorys	Checking s...i����s.pysCannot stattChecktctrsCannot openisBad MAGIC word in ".pyc" filei����sBad ".pyc" filesOut-of-date ".pyc" file(tsystargvtimpt	get_magictreprtpathtostlistdirterrortsorttjointstattopentIOErrortreadtclosetget_longR(tsilenttverbosetMAGICtdirnametnamestnametsttname_ctft	magic_strt	mtime_strtmtime((s./usr/lib64/python2.7/Tools/scripts/checkpyc.pytmain
s`
	




cCsZt|�dkrdSt|d�t|d�d>t|d�d>t|d�d	>S(
Nii����iiiiiii(tlentord(ts((s./usr/lib64/python2.7/Tools/scripts/checkpyc.pyR<st__main__(RR
RRRR!Rt__name__(((s./usr/lib64/python2.7/Tools/scripts/checkpyc.pyt<module>s	2	fixdiv.pyo000064400000032706151732701210006575 0ustar00�
�fc@s�dZddlZddlZddlZddlZdad�Zd�ZdZd�Z	d�Z
d	�Zd
�Zddd��YZ
d
�Zd�Zedkr�eje��ndS(s(fixdiv - tool to fix division operators.

To use this tool, first run `python -Qwarnall yourscript.py 2>warnings'.
This runs the script `yourscript.py' while writing warning messages
about all uses of the classic division operator to the file
`warnings'.  The warnings look like this:

  <file>:<line>: DeprecationWarning: classic <type> division

The warnings are written to stderr, so you must use `2>' for the I/O
redirect.  I know of no way to redirect stderr on Windows in a DOS
box, so you will have to modify the script to set sys.stderr to some
kind of log file if you want to do this on Windows.

The warnings are not limited to the script; modules imported by the
script may also trigger warnings.  In fact a useful technique is to
write a test script specifically intended to exercise all code in a
particular module or set of modules.

Then run `python fixdiv.py warnings'.  This first reads the warnings,
looking for classic division warnings, and sorts them by file name and
line number.  Then, for each file that received at least one warning,
it parses the file and tries to match the warnings up to the division
operators found in the source code.  If it is successful, it writes
its findings to stdout, preceded by a line of dashes and a line of the
form:

  Index: <file>

If the only findings found are suggestions to change a / operator into
a // operator, the output is acceptable input for the Unix 'patch'
program.

Here are the possible messages on stdout (N stands for a line number):

- A plain-diff-style change ('NcN', a line marked by '<', a line
  containing '---', and a line marked by '>'):

  A / operator was found that should be changed to //.  This is the
  recommendation when only int and/or long arguments were seen.

- 'True division / operator at line N' and a line marked by '=':

  A / operator was found that can remain unchanged.  This is the
  recommendation when only float and/or complex arguments were seen.

- 'Ambiguous / operator (..., ...) at line N', line marked by '?':

  A / operator was found for which int or long as well as float or
  complex arguments were seen.  This is highly unlikely; if it occurs,
  you may have to restructure the code to keep the classic semantics,
  or maybe you don't care about the classic semantics.

- 'No conclusive evidence on line N', line marked by '*':

  A / operator was found for which no warnings were seen.  This could
  be code that was never executed, or code that was only executed
  with user-defined objects as arguments.  You will have to
  investigate further.  Note that // can be overloaded separately from
  /, using __floordiv__.  True division can also be separately
  overloaded, using __truediv__.  Classic division should be the same
  as either of those.  (XXX should I add a warning for division on
  user-defined objects, to disambiguate this case from code that was
  never executed?)

- 'Phantom ... warnings for line N', line marked by '*':

  A warning was seen for a line not containing a / operator.  The most
  likely cause is a warning about code executed by 'exec' or eval()
  (see note below), or an indirect invocation of the / operator, for
  example via the div() function in the operator module.  It could
  also be caused by a change to the file between the time the test
  script was run to collect warnings and the time fixdiv was run.

- 'More than one / operator in line N'; or
  'More than one / operator per statement in lines N-N':

  The scanner found more than one / operator on a single line, or in a
  statement split across multiple lines.  Because the warnings
  framework doesn't (and can't) show the offset within the line, and
  the code generator doesn't always give the correct line number for
  operations in a multi-line statement, we can't be sure whether all
  operators in the statement were executed.  To be on the safe side,
  by default a warning is issued about this case.  In practice, these
  cases are usually safe, and the -m option suppresses these warning.

- 'Can't find the / operator in line N', line marked by '*':

  This really shouldn't happen.  It means that the tokenize module
  reported a '/' operator but the line it returns didn't contain a '/'
  character at the indicated position.

- 'Bad warning for line N: XYZ', line marked by '*':

  This really shouldn't happen.  It means that a 'classic XYZ
  division' warning was read with XYZ being something other than
  'int', 'long', 'float', or 'complex'.

Notes:

- The augmented assignment operator /= is handled the same way as the
  / operator.

- This tool never looks at the // operator; no warnings are ever
  generated for use of this operator.

- This tool never looks at the / operator when a future division
  statement is in effect; no warnings are generated in this case, and
  because the tool only looks at files for which at least one classic
  division warning was seen, it will never look at files containing a
  future division statement.

- Warnings may be issued for code not read from a file, but executed
  using an exec statement or the eval() function.  These may have
  <string> in the filename position, in which case the fixdiv script
  will attempt and fail to open a file named '<string>' and issue a
  warning about this failure; or these may be reported as 'Phantom'
  warnings (see above).  You're on your own to deal with these.  You
  could make all recommended changes and add a future division
  statement to all affected files, and then re-run the test script; it
  should not issue any warnings.  If there are any, and you have a
  hard time tracking down where they are generated, you can use the
  -Werror option to force an error instead of a first warning,
  generating a traceback.

- The tool should be run from the same directory as that from which
  the original script was run, otherwise it won't be able to open
  files given by relative pathnames.
i����Nic
CsJy#tjtjdd�\}}Wn!tjk
rF}t|�dSXx>|D]6\}}|dkrotGHdS|dkrNdaqNqNW|s�td�dS|dr�tjjdtjd�nt	|d�}|dkr�dS|j�}|sd	G|dGHdS|j�d}x-|D]%}t
|||�}	|p?|	}qW|S(
Nithmis-hs-ms&at least one file argument is requireds!%s: extra file arguments ignored
is&No classic division warnings read from(tgetopttsystargvterrortusaget__doc__tmulti_oktstderrtwritetreadwarningstNonetkeystsorttprocess(
toptstargstmsgtotatwarningstfilestexittfilenametx((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pytmain�s:#






cCs[tjjdtjd|f�tjjdtjd�tjjdtjd�dS(Ns%s: %s
isUsage: %s [-m] warnings
s"Try `%s -h' for more information.
(RRR	R(R((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyR�s!sL^(.+?):(\d+): DeprecationWarning: classic (int|long|float|complex) division$cCs"tjt�}yt|�}Wn(tk
rI}tjjd|�dSXi}x�|j�}|siPn|j	|�}|s�|j
d�dkrStjjd|�qSqSn|j�\}}}	|j|�}
|
dkr�g||<}
n|
jt|�t|	�f�qSW|j�|S(Nscan't open: %s
tdivisionisWarning: ignored input (tretcompiletPATTERNtopentIOErrorRRR	treadlinetmatchtfindtgroupstgetRtappendtinttinterntclose(twarningsfiletprogtfRRtlinetmRtlinenotwhattlist((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyR
�s.#
cCsddGHyt|�}Wn(tk
rC}tjjd|�dSXdG|GHt|�}|j�d}tj|j	�}xzt
|�\}}}	}
|dkr�Png}xE|t|�kr�||d|kr�|j
||�|d7}q�W|rt||�ng}xE|t|�krX||d|krX|j
||�|d7}qW|	rj|rjq~|	r�|r�t|	d�q~|r�|	r�t||�q~t|	�dkrMtsMg}
d}x?|	D]7\\}}}||kr�q�n|
j
|�|}q�Wt|
�dkr,dG|
dGHqJd	Gd
|
d|
dfGHqMng}g}g}xY|D]Q\}}|dkr�|j
|�qf|dkr�|j
|�qf|j
|�qfWd}x0|	D](\\}}}||kr�q�n|}t|�}|||d!dkr-d|GHdG|GHq�n|rLd|G|GHdG|GHq�|r�|r�d||fGHdG|GHdGHdG|| d||GHq�|r�|r�d|GHdG|GHq�|r�|r�ddj|�dj|�|fGHdG|GHq�q�Wq~W|j�dS(Nt-iFscan't open: %s
isIndex:isNo conclusive evidences$*** More than one / operator in lines**** More than one / operator per statementsin lines %d-%di����R&tlongtfloattcomplext/s)*** Can't find the / operator in line %d:t*s*** Bad warning for line %d:s%dc%dt<s---t>s$True division / operator at line %d:t=s-*** Ambiguous / operator (%s, %s) at line %d:t|t?(R&R2(R3R4(RRRRR	tFileContextR
ttokenizetgenerate_tokensR tscanlineRtlenR%treportphantomwarningstreportRtchoptjoinR((RR0tfpRR+tindextgtstartlinenot	endlinenotslashestlineinfotorphansRtrowstlastrowtrowtcolR,tintlongtfloatcomplextbadR.R/((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyR�s�		
))



		

	
	!c	Cs�g}d}d}xF|D]>\}}||krJ|g}|j|�n|j|�qWxM|D]E}|d}dj|d�}d||fGH|j|dd�qbWdS(NiR5is$*** Phantom %s warnings for line %d:tmarkR6(RR%RDRB(	RR+tblocksRNt	lastblockROR/tblocktwhats((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyRA$s	

cCsZd}xM|D]E\\}}}||kr
d||fGHdGt|�GH|}q
q
WdS(Ns*** %s on line %d:R6(RRC(RJtmessageRNRORPR,((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyRB3sR<cBsAeZddd�Zd�Zd�Zd�Zddd�ZRS(	iicCs:||_d|_d|_d|_g|_g|_dS(Niii(REtwindowR.teoflookaheadt	lookaheadtbuffer(tselfRERZR.((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyt__init__<s					cCs_xXt|j�|jkrZ|jrZ|jj�}|sGd|_Pn|jj|�qWdS(Ni(R@R\RZR[RER R%(R^R,((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pytfillCs%	cCsL|j�|jsdS|jjd�}|jj|�|jd7_|S(Ntii(R`R\tpopR]R%R.(R^R,((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyR Js
	cCs�|j�|jt|j�}|jt|j�}||koP|jknrd|j||S|j|ko~|knr�|j||jSt�dS(N(R`R.R@R]R\tKeyError(R^RFtbufstarttlookend((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyt__getitem__Rs
R6cCsn|dkr|}nxRt||d�D]=}y||}Wntk
rVd}nX|Gt|�GHq)WdS(Nis<missing line>(RtrangeRcRC(R^tfirsttlastRTtiR,((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyRB[s	

N(t__name__t
__module__R_R`R RfRRB(((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyR<;s
				c	Cs�g}d}d}xq|D]i\}}}}}|d}|dkrM|}n|dkro|j||f�n|tjkrPqqW|||fS(NiR5s/=(R5s/=(RR%R=tNEWLINE(	RGRJRHRIttypettokentstarttendR,((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyR?es
	cCs|jd�r|d S|SdS(Ns
i����(tendswith(R,((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyRCsst__main__((RRRRR=RRRRR
RRARBR<R?RCRkR(((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyt<module>�s"	 			W		*		lfcr.pyc000064400000001560151732701210006210 0ustar00�
�fc@sMdZddlZddlZddlZd�ZedkrIe�ndS(sFReplace LF with CRLF in argument files.  Print names of changed files.i����NcCs�x�tjdD]�}tjj|�r5|GdGHqnt|d�j�}d|kre|GdGHqntjdd|�}||kr|GHt|d�}|j	|�|j
�qqWdS(	Nis
Directory!trbssBinary!s
?
s
twb(tsystargvtostpathtisdirtopentreadtretsubtwritetclose(tfilenametdatatnewdatatf((s*/usr/lib64/python2.7/Tools/scripts/lfcr.pytmains		
t__main__(t__doc__RR	RRt__name__(((s*/usr/lib64/python2.7/Tools/scripts/lfcr.pyt<module>s$	serve.py000075500000002173151732701210006247 0ustar00#! /usr/bin/python2.7
'''
Small wsgiref based web server. Takes a path to serve from and an
optional port number (defaults to 8000), then tries to serve files.
Mime types are guessed from the file names, 404 errors are raised
if the file is not found. Used for the make serve target in Doc.
'''
import sys
import os
import mimetypes
from wsgiref import simple_server, util

def app(environ, respond):

    fn = os.path.join(path, environ['PATH_INFO'][1:])
    if '.' not in fn.split(os.path.sep)[-1]:
        fn = os.path.join(fn, 'index.html')
    type = mimetypes.guess_type(fn)[0]

    if os.path.exists(fn):
        respond('200 OK', [('Content-Type', type)])
        return util.FileWrapper(open(fn))
    else:
        respond('404 Not Found', [('Content-Type', 'text/plain')])
        return ['not found']

if __name__ == '__main__':
    path = sys.argv[1]
    port = int(sys.argv[2]) if len(sys.argv) > 2 else 8000
    httpd = simple_server.make_server('', port, app)
    print "Serving %s on port %s, control-C to stop" % (path, port)
    try:
        httpd.serve_forever()
    except KeyboardInterrupt:
        print "\b\bShutting down."
byteyears.pyo000064400000002566151732701210007314 0ustar00�
�fc@sQddlZddlZddlZddlTd�ZedkrMe�ndS(i����N(t*c
Cs�y
tj}Wntk
r)tj}nXtjddkrPt}tjd=nRtjddkrvt}tjd=n,tjddkr�t}tjd=nt}d}tj�}d}d}x*tjdD]}t	|t
|��}q�Wx�tjdD]�}y||�}Wn<tjk
rO}tjj
d	||f�d}d
}nX|r�||}	|t}
||	}t|
�t|�|}|j|�Gtt|��jd
�GHq�q�Wtj|�dS(Nis-ms-cs-ag�v@g8@g �@iscan't stat %r: %r
ig�@g8~A((tostlstattAttributeErrortstattsystargvtST_MTIMEtST_CTIMEttimetmaxtlenterrortstderrtwritetST_SIZEtfloattljusttreprtinttrjusttexit(
tstatfunctitimet
secs_per_yeartnowtstatustmaxlentfilenametsttmsgtanytimetsizetaget	byteyears((s//usr/lib64/python2.7/Tools/scripts/byteyears.pytmainsF










!t__main__(RRR	RR#t__name__(((s//usr/lib64/python2.7/Tools/scripts/byteyears.pyt<module>	s$
	0byteyears.py000075500000003145151732701210007132 0ustar00#! /usr/bin/python2.7

# Print the product of age and size of each file, in suitable units.
#
# Usage: byteyears [ -a | -m | -c ] file ...
#
# Options -[amc] select atime, mtime (default) or ctime as age.

import sys, os, time
from stat import *

def main():

    # Use lstat() to stat files if it exists, else stat()
    try:
        statfunc = os.lstat
    except AttributeError:
        statfunc = os.stat

    # Parse options
    if sys.argv[1] == '-m':
        itime = ST_MTIME
        del sys.argv[1]
    elif sys.argv[1] == '-c':
        itime = ST_CTIME
        del sys.argv[1]
    elif sys.argv[1] == '-a':
        itime = ST_CTIME
        del sys.argv[1]
    else:
        itime = ST_MTIME

    secs_per_year = 365.0 * 24.0 * 3600.0   # Scale factor
    now = time.time()                       # Current time, for age computations
    status = 0                              # Exit status, set to 1 on errors

    # Compute max file name length
    maxlen = 1
    for filename in sys.argv[1:]:
        maxlen = max(maxlen, len(filename))

    # Process each argument in turn
    for filename in sys.argv[1:]:
        try:
            st = statfunc(filename)
        except os.error, msg:
            sys.stderr.write("can't stat %r: %r\n" % (filename, msg))
            status = 1
            st = ()
        if st:
            anytime = st[itime]
            size = st[ST_SIZE]
            age = now - anytime
            byteyears = float(size) * float(age) / secs_per_year
            print filename.ljust(maxlen),
            print repr(int(byteyears)).rjust(8)

    sys.exit(status)

if __name__ == '__main__':
    main()
pysource.pyo000064400000007651151732701210007156 0ustar00�
�fc@s�dZdZddddgZddlZddlZejd�ZeZd	�Z	d
�Z
d�Zd�Zd
�Z
edd�Zedkr�xedg�D]ZeGHq�WdGHx%edgde
�D]ZeGHq�WndS(sCList 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.
sOleg Broytmann, Georg Brandlthas_python_exttlooks_like_pythontcan_be_compiledtwalk_python_filesi����Ns	[--]cCstr|GHndS(N(tdebug(tmsg((s./usr/lib64/python2.7/Tools/scripts/pysource.pytprint_debugscCs�ytj|�j}Wn(tk
r@}td||f�dSX|dkretd||f�dSyt|d�SWn(tk
r�}td||f�dSXdS(Ns%s: permission denied: %sis!%s: the file is too big: %d bytestrUs%s: access denied: %si(toststattst_sizetOSErrorRtNonetopentIOError(tfullpathtsizeterr((s./usr/lib64/python2.7/Tools/scripts/pysource.pyt_open!scCs|jd�p|jd�S(Ns.pys.pyw(tendswith(R((s./usr/lib64/python2.7/Tools/scripts/pysource.pyR2scCs�t|�}|dkrtS|j�}|j�tj|�rStd|�tS|jd�sq|jd�rut	Sd|kr�t	StS(Ns%s: appears to be binarys.pys.pywtpython(
RRtFalsetreadlinetcloset	binary_retsearchRRtTrue(Rtinfiletline((s./usr/lib64/python2.7/Tools/scripts/pysource.pyR5s
cCsut|�}|dkrtS|j�}|j�yt||d�Wn(tk
rp}td||f�tSXtS(Ntexecs%s: cannot compile: %s(	RRRtreadRtcompilet	ExceptionRR(RRtcodeR((s./usr/lib64/python2.7/Tools/scripts/pysource.pyRJs
c
cs"|dkrg}nx|D]�}td|�tjj|�rY||�r|Vqqtjj|�rtd�x�tj|�D]�\}}}x*|D]"}||kr�|j|�q�q�WxE|D]=}tjj||�}	td|	�||	�r�|	Vq�q�Wq�Wqtd�qWdS(s^    Recursively yield all Python source files below the given paths.

    paths: a list of files and/or directories to be checked.
    is_python: a function that takes a file name and checks whether it is a
               Python source file
    exclude_dirs: a list of directory base names that should be excluded in
                  the search
    stesting: %ss    it is a directorys    unknown typeN(	RRRtpathtisfiletisdirtwalktremovetjoin(
tpathst	is_pythontexclude_dirsR"tdirpathtdirnamest	filenamestexcludetfilenameR((s./usr/lib64/python2.7/Tools/scripts/pysource.pyR[s&
	



t__main__t.s
----------R)(t__doc__t
__author__t__all__RtreRRRRRRRRRRRt__name__R(((s./usr/lib64/python2.7/Tools/scripts/pysource.pyt<module>s"					!	h2py.py000075500000013501151732701210006002 0ustar00#! /usr/bin/python2.7

# Read #define's and translate to Python code.
# Handle #include statements.
# Handle #define macros with one argument.
# Anything that isn't recognized or doesn't translate into valid
# Python is ignored.

# Without filename arguments, acts as a filter.
# If one or more filenames are given, output is written to corresponding
# filenames in the local directory, translated to all uppercase, with
# the extension replaced by ".py".

# By passing one or more options of the form "-i regular_expression"
# you can specify additional strings to be ignored.  This is useful
# e.g. to ignore casts to u_long: simply specify "-i '(u_long)'".

# XXX To do:
# - turn trailing C comments into Python comments
# - turn C Boolean operators "&& || !" into Python "and or not"
# - what to do about #if(def)?
# - what to do about macros with multiple parameters?

import sys, re, getopt, os

p_define = re.compile('^[\t ]*#[\t ]*define[\t ]+([a-zA-Z0-9_]+)[\t ]+')

p_macro = re.compile(
  '^[\t ]*#[\t ]*define[\t ]+'
  '([a-zA-Z0-9_]+)\(([_a-zA-Z][_a-zA-Z0-9]*)\)[\t ]+')

p_include = re.compile('^[\t ]*#[\t ]*include[\t ]+<([^>\n]+)>')

p_comment = re.compile(r'/\*([^*]+|\*+[^/])*(\*+/)?')
p_cpp_comment = re.compile('//.*')

ignores = [p_comment, p_cpp_comment]

p_char = re.compile(r"'(\\.[^\\]*|[^\\])'")

p_hex = re.compile(r"0x([0-9a-fA-F]+)L?")

filedict = {}
importable = {}

try:
    searchdirs=os.environ['include'].split(';')
except KeyError:
    try:
        searchdirs=os.environ['INCLUDE'].split(';')
    except KeyError:
        try:
            if  sys.platform.find("beos") == 0:
                searchdirs=os.environ['BEINCLUDES'].split(';')
            elif sys.platform.startswith("atheos"):
                searchdirs=os.environ['C_INCLUDE_PATH'].split(':')
            else:
                raise KeyError
        except KeyError:
            searchdirs=['/usr/include']
            try:
                searchdirs.insert(0, os.path.join('/usr/include',
                                                  os.environ['MULTIARCH']))
            except KeyError:
                pass


def main():
    global filedict
    opts, args = getopt.getopt(sys.argv[1:], 'i:')
    for o, a in opts:
        if o == '-i':
            ignores.append(re.compile(a))
    if not args:
        args = ['-']
    for filename in args:
        if filename == '-':
            sys.stdout.write('# Generated by h2py from stdin\n')
            process(sys.stdin, sys.stdout)
        else:
            fp = open(filename, 'r')
            outfile = os.path.basename(filename)
            i = outfile.rfind('.')
            if i > 0: outfile = outfile[:i]
            modname = outfile.upper()
            outfile = modname + '.py'
            outfp = open(outfile, 'w')
            outfp.write('# Generated by h2py from %s\n' % filename)
            filedict = {}
            for dir in searchdirs:
                if filename[:len(dir)] == dir:
                    filedict[filename[len(dir)+1:]] = None  # no '/' trailing
                    importable[filename[len(dir)+1:]] = modname
                    break
            process(fp, outfp)
            outfp.close()
            fp.close()

def pytify(body):
    # replace ignored patterns by spaces
    for p in ignores:
        body = p.sub(' ', body)
    # replace char literals by ord(...)
    body = p_char.sub("ord('\\1')", body)
    # Compute negative hexadecimal constants
    start = 0
    UMAX = 2*(sys.maxint+1)
    while 1:
        m = p_hex.search(body, start)
        if not m: break
        s,e = m.span()
        val = long(body[slice(*m.span(1))], 16)
        if val > sys.maxint:
            val -= UMAX
            body = body[:s] + "(" + str(val) + ")" + body[e:]
        start = s + 1
    return body

def process(fp, outfp, env = {}):
    lineno = 0
    while 1:
        line = fp.readline()
        if not line: break
        lineno = lineno + 1
        match = p_define.match(line)
        if match:
            # gobble up continuation lines
            while line[-2:] == '\\\n':
                nextline = fp.readline()
                if not nextline: break
                lineno = lineno + 1
                line = line + nextline
            name = match.group(1)
            body = line[match.end():]
            body = pytify(body)
            ok = 0
            stmt = '%s = %s\n' % (name, body.strip())
            try:
                exec stmt in env
            except:
                sys.stderr.write('Skipping: %s' % stmt)
            else:
                outfp.write(stmt)
        match = p_macro.match(line)
        if match:
            macro, arg = match.group(1, 2)
            body = line[match.end():]
            body = pytify(body)
            stmt = 'def %s(%s): return %s\n' % (macro, arg, body)
            try:
                exec stmt in env
            except:
                sys.stderr.write('Skipping: %s' % stmt)
            else:
                outfp.write(stmt)
        match = p_include.match(line)
        if match:
            regs = match.regs
            a, b = regs[1]
            filename = line[a:b]
            if importable.has_key(filename):
                outfp.write('from %s import *\n' % importable[filename])
            elif not filedict.has_key(filename):
                filedict[filename] = None
                inclfp = None
                for dir in searchdirs:
                    try:
                        inclfp = open(dir + '/' + filename)
                        break
                    except IOError:
                        pass
                if inclfp:
                    outfp.write(
                            '\n# Included from %s\n' % filename)
                    process(inclfp, outfp, env)
                else:
                    sys.stderr.write('Warning - could not find file %s\n' %
                                     filename)

if __name__ == '__main__':
    main()
ndiff.pyc000064400000007423151732701210006354 0ustar00�
�fc@s�dZdZddlZddlZd�Zd�Zd�Zd	�Zd
�Ze	dkr�ej
dZdekr�ddlZddl
Z
ejd�d
Zejde�e
je�Zej�jd�j�q�ee�ndS(s�ndiff [-q] file1 file2
    or
ndiff (-r1 | -r2) < ndiff_output > file1_or_file2

Print a human-friendly file difference report to stdout.  Both inter-
and intra-line differences are noted.  In the second form, recreate file1
(-r1) or file2 (-r2) on stdout, from an ndiff report on stdin.

In the first form, if -q ("quiet") is not specified, the first two lines
of output are

-: file1
+: file2

Each remaining line begins with a two-letter code:

    "- "    line unique to file1
    "+ "    line unique to file2
    "  "    line common to both files
    "? "    line not present in either input file

Lines beginning with "? " attempt to guide the eye to intraline
differences, and were not present in either input file.  These lines can be
confusing if the source files contain tab characters.

The first file can be recovered by retaining only lines that begin with
"  " or "- ", and deleting those 2-character prefixes; use ndiff with -r1.

The second file can be recovered similarly, but by retaining only "  " and
"+ " lines; use ndiff with -r2; or, on Unix, the second file can be
recovered by piping the output through

    sed -n '/^[+ ] /s/^..//p'
iiii����NcCs(tjj}||d�|t�dS(Ns

i(tsyststderrtwritet__doc__(tmsgtout((s+/usr/lib64/python2.7/Tools/scripts/ndiff.pytfail5s
cCsDyt|d�SWn,tk
r?}td|dt|��SXdS(NtUscouldn't open s: (topentIOErrorRtstr(tfnametdetail((s+/usr/lib64/python2.7/Tools/scripts/ndiff.pytfopen=scCs{t|�}t|�}|s&|r*dS|j�}|j�|j�}|j�xtj||�D]
}|GqiWdS(Nii(R
t	readlinestclosetdifflibtndiff(tf1nametf2nametf1tf2tatbtline((s+/usr/lib64/python2.7/Tools/scripts/ndiff.pytfcompareDs

cCsKddl}y|j|d�\}}Wn#|jk
rM}tt|��SXd}d}}xJ|D]B\}}|dkr�d}d}qe|dkred}|}	qeqeW|r�|r�td�S|r�|r�td�S|	dkr�t|	�dStd�St|�dkrtd
�S|\}
}|r>dG|
GHdG|GHnt|
|�S(Ni����sqr:iis-qs-rscan't specify both -q and -rsno args allowed with -r optiont1t2s-r value must be 1 or 2isneed 2 filename argss-:s+:(RR(tgetoptterrorRR
trestoretlenR(targsRtoptsRtnoisytqseentrseentopttvalt	whichfileRR((s+/usr/lib64/python2.7/Tools/scripts/ndiff.pytmainTs<
	





	cCs/tjtjj�|�}tjj|�dS(N(RRRtstdinRtstdoutt
writelines(twhichtrestored((s+/usr/lib64/python2.7/Tools/scripts/ndiff.pyRwst__main__s-profiles	ndiff.pros
main(args)ttime(iii(Rt__version__RRRR
RR(Rt__name__targvR tprofiletpstatstremovetstatftruntStatststatst
strip_dirst
sort_statstprint_stats(((s+/usr/lib64/python2.7/Tools/scripts/ndiff.pyt<module>/s"				#	

ptags.pyo000064400000002577151732701210006425 0ustar00�
�fc@skddlZddlZddlZgZd�ZdZeje�Zd�Ze	dkrge�ndS(i����NcCsltjd}x|D]}t|�qWtrhtdd�}tj�xtD]}|j|�qNWndS(Nittagstw(tsystargvt
treat_fileRtopentsorttwrite(targstfilenametfpts((s+/usr/lib64/python2.7/Tools/scripts/ptags.pytmains



s/^[ 	]*(def|class)[ 	]+([a-zA-Z0-9_]+)[ 	]*[:\(]cCsyt|d�}Wntjjd|�dSXtjj|�}|ddkra|d }n|d|dd}tj|�xw|j	�}|s�Pnt
j|�}|r�|jd�}|jd�}|d|d	|d
}tj|�q�q�WdS(NtrsCannot open %s
i����s.pys	s1
iis	/^s/
(
RRtstderrRtostpathtbasenameRtappendtreadlinetmatchertmatchtgroup(R	R
tbaseRtlinetmtcontenttname((s+/usr/lib64/python2.7/Tools/scripts/ptags.pyRs(

t__main__(
RtreRRRtexprtcompileRRt__name__(((s+/usr/lib64/python2.7/Tools/scripts/ptags.pyt<module>
s$	
	mkreal.pyo000064400000003674151732701210006561 0ustar00�
�fc@soddlZddlZddlTejjZdZd
Zd�Zd�Zd�Z	e
d	krke	�ndS(i����N(t*smkreal errori icCs�tj|�}t|t�}tj|�}t|d�}tj|�t|d�}x*|jt�}|suPn|j	|�q\W~tj
||�dS(Ntrtw(toststattS_IMODEtST_MODEtreadlinktopentunlinktreadtBUFSIZEtwritetchmod(tnametsttmodetlinktotf_intf_outtbuf((s,/usr/lib64/python2.7/Tools/scripts/mkreal.pyt
mkrealfiles
cCs�tj|�}t|t�}tj|�}tj|�}tj|�tj||�tj||�t	tj
|�}xK|D]C}|tjtj
fkr�tjt	||�t	||��q�q�WdS(N(
RRRRRtlistdirR	tmkdirR
tjointpardirtcurdirtsymlink(RRRRtfilestfilename((s,/usr/lib64/python2.7/Tools/scripts/mkreal.pyt	mkrealdirs

cCs�tjt_tjjtjd�}|dkr:d}ntjd}|sjdG|GdGHtjd�nd}xg|D]_}tjj|�s�|dG|dGd	GHd}qwtjj	|�r�t
|�qwt|�qwWtj|�dS(
Nis-ctmkrealisusage:spath ...it:s
not a symlink(tsyststderrtstdoutRtpathtbasenametargvtexittislinktisdirRR(tprognametargststatusR((s,/usr/lib64/python2.7/Tools/scripts/mkreal.pytmain-s"	


	
t__main__i�(R!RRR$RterrorRRRR-t__name__(((s,/usr/lib64/python2.7/Tools/scripts/mkreal.pyt<module>s
			texi2html.py000075500000210301151732701210007035 0ustar00#! /usr/bin/python2.7

# Convert GNU texinfo files into HTML, one file per node.
# Based on Texinfo 2.14.
# Usage: texi2html [-d] [-d] [-c] inputfile outputdirectory
# The input file must be a complete texinfo file, e.g. emacs.texi.
# This creates many files (one per info node) in the output directory,
# overwriting existing files of the same name.  All files created have
# ".html" as their extension.


# XXX To do:
# - handle @comment*** correctly
# - handle @xref {some words} correctly
# - handle @ftable correctly (items aren't indexed?)
# - handle @itemx properly
# - handle @exdent properly
# - add links directly to the proper line from indices
# - check against the definitive list of @-cmds; we still miss (among others):
# - @defindex (hard)
# - @c(omment) in the middle of a line (rarely used)
# - @this* (not really needed, only used in headers anyway)
# - @today{} (ever used outside title page?)

# More consistent handling of chapters/sections/etc.
# Lots of documentation
# Many more options:
#       -top    designate top node
#       -links  customize which types of links are included
#       -split  split at chapters or sections instead of nodes
#       -name   Allow different types of filename handling. Non unix systems
#               will have problems with long node names
#       ...
# Support the most recent texinfo version and take a good look at HTML 3.0
# More debugging output (customizable) and more flexible error handling
# How about icons ?

# rpyron 2002-05-07
# Robert Pyron <rpyron@alum.mit.edu>
# 1. BUGFIX: In function makefile(), strip blanks from the nodename.
#    This is necessary to match the behavior of parser.makeref() and
#    parser.do_node().
# 2. BUGFIX fixed KeyError in end_ifset (well, I may have just made
#    it go away, rather than fix it)
# 3. BUGFIX allow @menu and menu items inside @ifset or @ifclear
# 4. Support added for:
#       @uref        URL reference
#       @image       image file reference (see note below)
#       @multitable  output an HTML table
#       @vtable
# 5. Partial support for accents, to match MAKEINFO output
# 6. I added a new command-line option, '-H basename', to specify
#    HTML Help output. This will cause three files to be created
#    in the current directory:
#       `basename`.hhp  HTML Help Workshop project file
#       `basename`.hhc  Contents file for the project
#       `basename`.hhk  Index file for the project
#    When fed into HTML Help Workshop, the resulting file will be
#    named `basename`.chm.
# 7. A new class, HTMLHelp, to accomplish item 6.
# 8. Various calls to HTMLHelp functions.
# A NOTE ON IMAGES: Just as 'outputdirectory' must exist before
# running this program, all referenced images must already exist
# in outputdirectory.

import os
import sys
import string
import re

MAGIC = '\\input texinfo'

cmprog = re.compile('^@([a-z]+)([ \t]|$)')        # Command (line-oriented)
blprog = re.compile('^[ \t]*$')                   # Blank line
kwprog = re.compile('@[a-z]+')                    # Keyword (embedded, usually
                                                  # with {} args)
spprog = re.compile('[\n@{}&<>]')                 # Special characters in
                                                  # running text
                                                  #
                                                  # menu item (Yuck!)
miprog = re.compile('^\* ([^:]*):(:|[ \t]*([^\t,\n.]+)([^ \t\n]*))[ \t\n]*')
#                   0    1     1 2        3          34         42        0
#                         -----            ----------  ---------
#                                 -|-----------------------------
#                    -----------------------------------------------------




class HTMLNode:
    """Some of the parser's functionality is separated into this class.

    A Node accumulates its contents, takes care of links to other Nodes
    and saves itself when it is finished and all links are resolved.
    """

    DOCTYPE = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">'

    type = 0
    cont = ''
    epilogue = '</BODY></HTML>\n'

    def __init__(self, dir, name, topname, title, next, prev, up):
        self.dirname = dir
        self.name = name
        if topname:
            self.topname = topname
        else:
            self.topname = name
        self.title = title
        self.next = next
        self.prev = prev
        self.up = up
        self.lines = []

    def write(self, *lines):
        map(self.lines.append, lines)

    def flush(self):
        fp = open(self.dirname + '/' + makefile(self.name), 'w')
        fp.write(self.prologue)
        fp.write(self.text)
        fp.write(self.epilogue)
        fp.close()

    def link(self, label, nodename, rel=None, rev=None):
        if nodename:
            if nodename.lower() == '(dir)':
                addr = '../dir.html'
                title = ''
            else:
                addr = makefile(nodename)
                title = ' TITLE="%s"' % nodename
            self.write(label, ': <A HREF="', addr, '"', \
                       rel and (' REL=' + rel) or "", \
                       rev and (' REV=' + rev) or "", \
                       title, '>', nodename, '</A>  \n')

    def finalize(self):
        length = len(self.lines)
        self.text = ''.join(self.lines)
        self.lines = []
        self.open_links()
        self.output_links()
        self.close_links()
        links = ''.join(self.lines)
        self.lines = []
        self.prologue = (
            self.DOCTYPE +
            '\n<HTML><HEAD>\n'
            '  <!-- Converted with texi2html and Python -->\n'
            '  <TITLE>' + self.title + '</TITLE>\n'
            '  <LINK REL=Next HREF="'
                + makefile(self.next) + '" TITLE="' + self.next + '">\n'
            '  <LINK REL=Previous HREF="'
                + makefile(self.prev) + '" TITLE="' + self.prev  + '">\n'
            '  <LINK REL=Up HREF="'
                + makefile(self.up) + '" TITLE="' + self.up  + '">\n'
            '</HEAD><BODY>\n' +
            links)
        if length > 20:
            self.epilogue = '<P>\n%s</BODY></HTML>\n' % links

    def open_links(self):
        self.write('<HR>\n')

    def close_links(self):
        self.write('<HR>\n')

    def output_links(self):
        if self.cont != self.next:
            self.link('  Cont', self.cont)
        self.link('  Next', self.next, rel='Next')
        self.link('  Prev', self.prev, rel='Previous')
        self.link('  Up', self.up, rel='Up')
        if self.name <> self.topname:
            self.link('  Top', self.topname)


class HTML3Node(HTMLNode):

    DOCTYPE = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML Level 3//EN//3.0">'

    def open_links(self):
        self.write('<DIV CLASS=Navigation>\n <HR>\n')

    def close_links(self):
        self.write(' <HR>\n</DIV>\n')


class TexinfoParser:

    COPYRIGHT_SYMBOL = "&copy;"
    FN_ID_PATTERN = "(%(id)s)"
    FN_SOURCE_PATTERN = '<A NAME=footnoteref%(id)s' \
                        ' HREF="#footnotetext%(id)s">' \
                        + FN_ID_PATTERN + '</A>'
    FN_TARGET_PATTERN = '<A NAME=footnotetext%(id)s' \
                        ' HREF="#footnoteref%(id)s">' \
                        + FN_ID_PATTERN + '</A>\n%(text)s<P>\n'
    FN_HEADER = '\n<P>\n<HR NOSHADE SIZE=1 WIDTH=200>\n' \
                '<STRONG><EM>Footnotes</EM></STRONG>\n<P>'


    Node = HTMLNode

    # Initialize an instance
    def __init__(self):
        self.unknown = {}       # statistics about unknown @-commands
        self.filenames = {}     # Check for identical filenames
        self.debugging = 0      # larger values produce more output
        self.print_headers = 0  # always print headers?
        self.nodefp = None      # open file we're writing to
        self.nodelineno = 0     # Linenumber relative to node
        self.links = None       # Links from current node
        self.savetext = None    # If not None, save text head instead
        self.savestack = []     # If not None, save text head instead
        self.htmlhelp = None    # html help data
        self.dirname = 'tmp'    # directory where files are created
        self.includedir = '.'   # directory to search @include files
        self.nodename = ''      # name of current node
        self.topname = ''       # name of top node (first node seen)
        self.title = ''         # title of this whole Texinfo tree
        self.resetindex()       # Reset all indices
        self.contents = []      # Reset table of contents
        self.numbering = []     # Reset section numbering counters
        self.nofill = 0         # Normal operation: fill paragraphs
        self.values={'html': 1} # Names that should be parsed in ifset
        self.stackinfo={}       # Keep track of state in the stack
        # XXX The following should be reset per node?!
        self.footnotes = []     # Reset list of footnotes
        self.itemarg = None     # Reset command used by @item
        self.itemnumber = None  # Reset number for @item in @enumerate
        self.itemindex = None   # Reset item index name
        self.node = None
        self.nodestack = []
        self.cont = 0
        self.includedepth = 0

    # Set htmlhelp helper class
    def sethtmlhelp(self, htmlhelp):
        self.htmlhelp = htmlhelp

    # Set (output) directory name
    def setdirname(self, dirname):
        self.dirname = dirname

    # Set include directory name
    def setincludedir(self, includedir):
        self.includedir = includedir

    # Parse the contents of an entire file
    def parse(self, fp):
        line = fp.readline()
        lineno = 1
        while line and (line[0] == '%' or blprog.match(line)):
            line = fp.readline()
            lineno = lineno + 1
        if line[:len(MAGIC)] <> MAGIC:
            raise SyntaxError, 'file does not begin with %r' % (MAGIC,)
        self.parserest(fp, lineno)

    # Parse the contents of a file, not expecting a MAGIC header
    def parserest(self, fp, initial_lineno):
        lineno = initial_lineno
        self.done = 0
        self.skip = 0
        self.stack = []
        accu = []
        while not self.done:
            line = fp.readline()
            self.nodelineno = self.nodelineno + 1
            if not line:
                if accu:
                    if not self.skip: self.process(accu)
                    accu = []
                if initial_lineno > 0:
                    print '*** EOF before @bye'
                break
            lineno = lineno + 1
            mo = cmprog.match(line)
            if mo:
                a, b = mo.span(1)
                cmd = line[a:b]
                if cmd in ('noindent', 'refill'):
                    accu.append(line)
                else:
                    if accu:
                        if not self.skip:
                            self.process(accu)
                        accu = []
                    self.command(line, mo)
            elif blprog.match(line) and \
                 'format' not in self.stack and \
                 'example' not in self.stack:
                if accu:
                    if not self.skip:
                        self.process(accu)
                        if self.nofill:
                            self.write('\n')
                        else:
                            self.write('<P>\n')
                        accu = []
            else:
                # Append the line including trailing \n!
                accu.append(line)
        #
        if self.skip:
            print '*** Still skipping at the end'
        if self.stack:
            print '*** Stack not empty at the end'
            print '***', self.stack
        if self.includedepth == 0:
            while self.nodestack:
                self.nodestack[-1].finalize()
                self.nodestack[-1].flush()
                del self.nodestack[-1]

    # Start saving text in a buffer instead of writing it to a file
    def startsaving(self):
        if self.savetext <> None:
            self.savestack.append(self.savetext)
            # print '*** Recursively saving text, expect trouble'
        self.savetext = ''

    # Return the text saved so far and start writing to file again
    def collectsavings(self):
        savetext = self.savetext
        if len(self.savestack) > 0:
            self.savetext = self.savestack[-1]
            del self.savestack[-1]
        else:
            self.savetext = None
        return savetext or ''

    # Write text to file, or save it in a buffer, or ignore it
    def write(self, *args):
        try:
            text = ''.join(args)
        except:
            print args
            raise TypeError
        if self.savetext <> None:
            self.savetext = self.savetext + text
        elif self.nodefp:
            self.nodefp.write(text)
        elif self.node:
            self.node.write(text)

    # Complete the current node -- write footnotes and close file
    def endnode(self):
        if self.savetext <> None:
            print '*** Still saving text at end of node'
            dummy = self.collectsavings()
        if self.footnotes:
            self.writefootnotes()
        if self.nodefp:
            if self.nodelineno > 20:
                self.write('<HR>\n')
                [name, next, prev, up] = self.nodelinks[:4]
                self.link('Next', next)
                self.link('Prev', prev)
                self.link('Up', up)
                if self.nodename <> self.topname:
                    self.link('Top', self.topname)
                self.write('<HR>\n')
            self.write('</BODY>\n')
            self.nodefp.close()
            self.nodefp = None
        elif self.node:
            if not self.cont and \
               (not self.node.type or \
                (self.node.next and self.node.prev and self.node.up)):
                self.node.finalize()
                self.node.flush()
            else:
                self.nodestack.append(self.node)
            self.node = None
        self.nodename = ''

    # Process a list of lines, expanding embedded @-commands
    # This mostly distinguishes between menus and normal text
    def process(self, accu):
        if self.debugging > 1:
            print '!'*self.debugging, 'process:', self.skip, self.stack,
            if accu: print accu[0][:30],
            if accu[0][30:] or accu[1:]: print '...',
            print
        if self.inmenu():
            # XXX should be done differently
            for line in accu:
                mo = miprog.match(line)
                if not mo:
                    line = line.strip() + '\n'
                    self.expand(line)
                    continue
                bgn, end = mo.span(0)
                a, b = mo.span(1)
                c, d = mo.span(2)
                e, f = mo.span(3)
                g, h = mo.span(4)
                label = line[a:b]
                nodename = line[c:d]
                if nodename[0] == ':': nodename = label
                else: nodename = line[e:f]
                punct = line[g:h]
                self.write('  <LI><A HREF="',
                           makefile(nodename),
                           '">', nodename,
                           '</A>', punct, '\n')
                self.htmlhelp.menuitem(nodename)
                self.expand(line[end:])
        else:
            text = ''.join(accu)
            self.expand(text)

    # find 'menu' (we might be inside 'ifset' or 'ifclear')
    def inmenu(self):
        #if 'menu' in self.stack:
        #    print 'inmenu   :', self.skip, self.stack, self.stackinfo
        stack = self.stack
        while stack and stack[-1] in ('ifset','ifclear'):
            try:
                if self.stackinfo[len(stack)]:
                    return 0
            except KeyError:
                pass
            stack = stack[:-1]
        return (stack and stack[-1] == 'menu')

    # Write a string, expanding embedded @-commands
    def expand(self, text):
        stack = []
        i = 0
        n = len(text)
        while i < n:
            start = i
            mo = spprog.search(text, i)
            if mo:
                i = mo.start()
            else:
                self.write(text[start:])
                break
            self.write(text[start:i])
            c = text[i]
            i = i+1
            if c == '\n':
                self.write('\n')
                continue
            if c == '<':
                self.write('&lt;')
                continue
            if c == '>':
                self.write('&gt;')
                continue
            if c == '&':
                self.write('&amp;')
                continue
            if c == '{':
                stack.append('')
                continue
            if c == '}':
                if not stack:
                    print '*** Unmatched }'
                    self.write('}')
                    continue
                cmd = stack[-1]
                del stack[-1]
                try:
                    method = getattr(self, 'close_' + cmd)
                except AttributeError:
                    self.unknown_close(cmd)
                    continue
                method()
                continue
            if c <> '@':
                # Cannot happen unless spprog is changed
                raise RuntimeError, 'unexpected funny %r' % c
            start = i
            while i < n and text[i] in string.ascii_letters: i = i+1
            if i == start:
                # @ plus non-letter: literal next character
                i = i+1
                c = text[start:i]
                if c == ':':
                    # `@:' means no extra space after
                    # preceding `.', `?', `!' or `:'
                    pass
                else:
                    # `@.' means a sentence-ending period;
                    # `@@', `@{', `@}' quote `@', `{', `}'
                    self.write(c)
                continue
            cmd = text[start:i]
            if i < n and text[i] == '{':
                i = i+1
                stack.append(cmd)
                try:
                    method = getattr(self, 'open_' + cmd)
                except AttributeError:
                    self.unknown_open(cmd)
                    continue
                method()
                continue
            try:
                method = getattr(self, 'handle_' + cmd)
            except AttributeError:
                self.unknown_handle(cmd)
                continue
            method()
        if stack:
            print '*** Stack not empty at para:', stack

    # --- Handle unknown embedded @-commands ---

    def unknown_open(self, cmd):
        print '*** No open func for @' + cmd + '{...}'
        cmd = cmd + '{'
        self.write('@', cmd)
        if not self.unknown.has_key(cmd):
            self.unknown[cmd] = 1
        else:
            self.unknown[cmd] = self.unknown[cmd] + 1

    def unknown_close(self, cmd):
        print '*** No close func for @' + cmd + '{...}'
        cmd = '}' + cmd
        self.write('}')
        if not self.unknown.has_key(cmd):
            self.unknown[cmd] = 1
        else:
            self.unknown[cmd] = self.unknown[cmd] + 1

    def unknown_handle(self, cmd):
        print '*** No handler for @' + cmd
        self.write('@', cmd)
        if not self.unknown.has_key(cmd):
            self.unknown[cmd] = 1
        else:
            self.unknown[cmd] = self.unknown[cmd] + 1

    # XXX The following sections should be ordered as the texinfo docs

    # --- Embedded @-commands without {} argument list --

    def handle_noindent(self): pass

    def handle_refill(self): pass

    # --- Include file handling ---

    def do_include(self, args):
        file = args
        file = os.path.join(self.includedir, file)
        try:
            fp = open(file, 'r')
        except IOError, msg:
            print '*** Can\'t open include file', repr(file)
            return
        print '!'*self.debugging, '--> file', repr(file)
        save_done = self.done
        save_skip = self.skip
        save_stack = self.stack
        self.includedepth = self.includedepth + 1
        self.parserest(fp, 0)
        self.includedepth = self.includedepth - 1
        fp.close()
        self.done = save_done
        self.skip = save_skip
        self.stack = save_stack
        print '!'*self.debugging, '<-- file', repr(file)

    # --- Special Insertions ---

    def open_dmn(self): pass
    def close_dmn(self): pass

    def open_dots(self): self.write('...')
    def close_dots(self): pass

    def open_bullet(self): pass
    def close_bullet(self): pass

    def open_TeX(self): self.write('TeX')
    def close_TeX(self): pass

    def handle_copyright(self): self.write(self.COPYRIGHT_SYMBOL)
    def open_copyright(self): self.write(self.COPYRIGHT_SYMBOL)
    def close_copyright(self): pass

    def open_minus(self): self.write('-')
    def close_minus(self): pass

    # --- Accents ---

    # rpyron 2002-05-07
    # I would like to do at least as well as makeinfo when
    # it is producing HTML output:
    #
    #   input               output
    #     @"o                 @"o                umlaut accent
    #     @'o                 'o                 acute accent
    #     @,{c}               @,{c}              cedilla accent
    #     @=o                 @=o                macron/overbar accent
    #     @^o                 @^o                circumflex accent
    #     @`o                 `o                 grave accent
    #     @~o                 @~o                tilde accent
    #     @dotaccent{o}       @dotaccent{o}      overdot accent
    #     @H{o}               @H{o}              long Hungarian umlaut
    #     @ringaccent{o}      @ringaccent{o}     ring accent
    #     @tieaccent{oo}      @tieaccent{oo}     tie-after accent
    #     @u{o}               @u{o}              breve accent
    #     @ubaraccent{o}      @ubaraccent{o}     underbar accent
    #     @udotaccent{o}      @udotaccent{o}     underdot accent
    #     @v{o}               @v{o}              hacek or check accent
    #     @exclamdown{}       &#161;             upside-down !
    #     @questiondown{}     &#191;             upside-down ?
    #     @aa{},@AA{}         &#229;,&#197;      a,A with circle
    #     @ae{},@AE{}         &#230;,&#198;      ae,AE ligatures
    #     @dotless{i}         @dotless{i}        dotless i
    #     @dotless{j}         @dotless{j}        dotless j
    #     @l{},@L{}           l/,L/              suppressed-L,l
    #     @o{},@O{}           &#248;,&#216;      O,o with slash
    #     @oe{},@OE{}         oe,OE              oe,OE ligatures
    #     @ss{}               &#223;             es-zet or sharp S
    #
    # The following character codes and approximations have been
    # copied from makeinfo's HTML output.

    def open_exclamdown(self): self.write('&#161;')   # upside-down !
    def close_exclamdown(self): pass
    def open_questiondown(self): self.write('&#191;') # upside-down ?
    def close_questiondown(self): pass
    def open_aa(self): self.write('&#229;') # a with circle
    def close_aa(self): pass
    def open_AA(self): self.write('&#197;') # A with circle
    def close_AA(self): pass
    def open_ae(self): self.write('&#230;') # ae ligatures
    def close_ae(self): pass
    def open_AE(self): self.write('&#198;') # AE ligatures
    def close_AE(self): pass
    def open_o(self): self.write('&#248;')  # o with slash
    def close_o(self): pass
    def open_O(self): self.write('&#216;')  # O with slash
    def close_O(self): pass
    def open_ss(self): self.write('&#223;') # es-zet or sharp S
    def close_ss(self): pass
    def open_oe(self): self.write('oe')     # oe ligatures
    def close_oe(self): pass
    def open_OE(self): self.write('OE')     # OE ligatures
    def close_OE(self): pass
    def open_l(self): self.write('l/')      # suppressed-l
    def close_l(self): pass
    def open_L(self): self.write('L/')      # suppressed-L
    def close_L(self): pass

    # --- Special Glyphs for Examples ---

    def open_result(self): self.write('=&gt;')
    def close_result(self): pass

    def open_expansion(self): self.write('==&gt;')
    def close_expansion(self): pass

    def open_print(self): self.write('-|')
    def close_print(self): pass

    def open_error(self): self.write('error--&gt;')
    def close_error(self): pass

    def open_equiv(self): self.write('==')
    def close_equiv(self): pass

    def open_point(self): self.write('-!-')
    def close_point(self): pass

    # --- Cross References ---

    def open_pxref(self):
        self.write('see ')
        self.startsaving()
    def close_pxref(self):
        self.makeref()

    def open_xref(self):
        self.write('See ')
        self.startsaving()
    def close_xref(self):
        self.makeref()

    def open_ref(self):
        self.startsaving()
    def close_ref(self):
        self.makeref()

    def open_inforef(self):
        self.write('See info file ')
        self.startsaving()
    def close_inforef(self):
        text = self.collectsavings()
        args = [s.strip() for s in text.split(',')]
        while len(args) < 3: args.append('')
        node = args[0]
        file = args[2]
        self.write('`', file, '\', node `', node, '\'')

    def makeref(self):
        text = self.collectsavings()
        args = [s.strip() for s in text.split(',')]
        while len(args) < 5: args.append('')
        nodename = label = args[0]
        if args[2]: label = args[2]
        file = args[3]
        title = args[4]
        href = makefile(nodename)
        if file:
            href = '../' + file + '/' + href
        self.write('<A HREF="', href, '">', label, '</A>')

    # rpyron 2002-05-07  uref support
    def open_uref(self):
        self.startsaving()
    def close_uref(self):
        text = self.collectsavings()
        args = [s.strip() for s in text.split(',')]
        while len(args) < 2: args.append('')
        href = args[0]
        label = args[1]
        if not label: label = href
        self.write('<A HREF="', href, '">', label, '</A>')

    # rpyron 2002-05-07  image support
    # GNU makeinfo producing HTML output tries `filename.png'; if
    # that does not exist, it tries `filename.jpg'. If that does
    # not exist either, it complains. GNU makeinfo does not handle
    # GIF files; however, I include GIF support here because
    # MySQL documentation uses GIF files.

    def open_image(self):
        self.startsaving()
    def close_image(self):
        self.makeimage()
    def makeimage(self):
        text = self.collectsavings()
        args = [s.strip() for s in text.split(',')]
        while len(args) < 5: args.append('')
        filename = args[0]
        width    = args[1]
        height   = args[2]
        alt      = args[3]
        ext      = args[4]

        # The HTML output will have a reference to the image
        # that is relative to the HTML output directory,
        # which is what 'filename' gives us. However, we need
        # to find it relative to our own current directory,
        # so we construct 'imagename'.
        imagelocation = self.dirname + '/' + filename

        if   os.path.exists(imagelocation+'.png'):
            filename += '.png'
        elif os.path.exists(imagelocation+'.jpg'):
            filename += '.jpg'
        elif os.path.exists(imagelocation+'.gif'):   # MySQL uses GIF files
            filename += '.gif'
        else:
            print "*** Cannot find image " + imagelocation
        #TODO: what is 'ext'?
        self.write('<IMG SRC="', filename, '"',                     \
                    width  and (' WIDTH="'  + width  + '"') or "",  \
                    height and (' HEIGHT="' + height + '"') or "",  \
                    alt    and (' ALT="'    + alt    + '"') or "",  \
                    '/>' )
        self.htmlhelp.addimage(imagelocation)


    # --- Marking Words and Phrases ---

    # --- Other @xxx{...} commands ---

    def open_(self): pass # Used by {text enclosed in braces}
    def close_(self): pass

    open_asis = open_
    close_asis = close_

    def open_cite(self): self.write('<CITE>')
    def close_cite(self): self.write('</CITE>')

    def open_code(self): self.write('<CODE>')
    def close_code(self): self.write('</CODE>')

    def open_t(self): self.write('<TT>')
    def close_t(self): self.write('</TT>')

    def open_dfn(self): self.write('<DFN>')
    def close_dfn(self): self.write('</DFN>')

    def open_emph(self): self.write('<EM>')
    def close_emph(self): self.write('</EM>')

    def open_i(self): self.write('<I>')
    def close_i(self): self.write('</I>')

    def open_footnote(self):
        # if self.savetext <> None:
        #       print '*** Recursive footnote -- expect weirdness'
        id = len(self.footnotes) + 1
        self.write(self.FN_SOURCE_PATTERN % {'id': repr(id)})
        self.startsaving()

    def close_footnote(self):
        id = len(self.footnotes) + 1
        self.footnotes.append((id, self.collectsavings()))

    def writefootnotes(self):
        self.write(self.FN_HEADER)
        for id, text in self.footnotes:
            self.write(self.FN_TARGET_PATTERN
                       % {'id': repr(id), 'text': text})
        self.footnotes = []

    def open_file(self): self.write('<CODE>')
    def close_file(self): self.write('</CODE>')

    def open_kbd(self): self.write('<KBD>')
    def close_kbd(self): self.write('</KBD>')

    def open_key(self): self.write('<KEY>')
    def close_key(self): self.write('</KEY>')

    def open_r(self): self.write('<R>')
    def close_r(self): self.write('</R>')

    def open_samp(self): self.write('`<SAMP>')
    def close_samp(self): self.write('</SAMP>\'')

    def open_sc(self): self.write('<SMALLCAPS>')
    def close_sc(self): self.write('</SMALLCAPS>')

    def open_strong(self): self.write('<STRONG>')
    def close_strong(self): self.write('</STRONG>')

    def open_b(self): self.write('<B>')
    def close_b(self): self.write('</B>')

    def open_var(self): self.write('<VAR>')
    def close_var(self): self.write('</VAR>')

    def open_w(self): self.write('<NOBREAK>')
    def close_w(self): self.write('</NOBREAK>')

    def open_url(self): self.startsaving()
    def close_url(self):
        text = self.collectsavings()
        self.write('<A HREF="', text, '">', text, '</A>')

    def open_email(self): self.startsaving()
    def close_email(self):
        text = self.collectsavings()
        self.write('<A HREF="mailto:', text, '">', text, '</A>')

    open_titlefont = open_
    close_titlefont = close_

    def open_small(self): pass
    def close_small(self): pass

    def command(self, line, mo):
        a, b = mo.span(1)
        cmd = line[a:b]
        args = line[b:].strip()
        if self.debugging > 1:
            print '!'*self.debugging, 'command:', self.skip, self.stack, \
                  '@' + cmd, args
        try:
            func = getattr(self, 'do_' + cmd)
        except AttributeError:
            try:
                func = getattr(self, 'bgn_' + cmd)
            except AttributeError:
                # don't complain if we are skipping anyway
                if not self.skip:
                    self.unknown_cmd(cmd, args)
                return
            self.stack.append(cmd)
            func(args)
            return
        if not self.skip or cmd == 'end':
            func(args)

    def unknown_cmd(self, cmd, args):
        print '*** unknown', '@' + cmd, args
        if not self.unknown.has_key(cmd):
            self.unknown[cmd] = 1
        else:
            self.unknown[cmd] = self.unknown[cmd] + 1

    def do_end(self, args):
        words = args.split()
        if not words:
            print '*** @end w/o args'
        else:
            cmd = words[0]
            if not self.stack or self.stack[-1] <> cmd:
                print '*** @end', cmd, 'unexpected'
            else:
                del self.stack[-1]
            try:
                func = getattr(self, 'end_' + cmd)
            except AttributeError:
                self.unknown_end(cmd)
                return
            func()

    def unknown_end(self, cmd):
        cmd = 'end ' + cmd
        print '*** unknown', '@' + cmd
        if not self.unknown.has_key(cmd):
            self.unknown[cmd] = 1
        else:
            self.unknown[cmd] = self.unknown[cmd] + 1

    # --- Comments ---

    def do_comment(self, args): pass
    do_c = do_comment

    # --- Conditional processing ---

    def bgn_ifinfo(self, args): pass
    def end_ifinfo(self): pass

    def bgn_iftex(self, args): self.skip = self.skip + 1
    def end_iftex(self): self.skip = self.skip - 1

    def bgn_ignore(self, args): self.skip = self.skip + 1
    def end_ignore(self): self.skip = self.skip - 1

    def bgn_tex(self, args): self.skip = self.skip + 1
    def end_tex(self): self.skip = self.skip - 1

    def do_set(self, args):
        fields = args.split(' ')
        key = fields[0]
        if len(fields) == 1:
            value = 1
        else:
            value = ' '.join(fields[1:])
        self.values[key] = value

    def do_clear(self, args):
        self.values[args] = None

    def bgn_ifset(self, args):
        if args not in self.values.keys() \
           or self.values[args] is None:
            self.skip = self.skip + 1
            self.stackinfo[len(self.stack)] = 1
        else:
            self.stackinfo[len(self.stack)] = 0
    def end_ifset(self):
        try:
            if self.stackinfo[len(self.stack) + 1]:
                self.skip = self.skip - 1
            del self.stackinfo[len(self.stack) + 1]
        except KeyError:
            print '*** end_ifset: KeyError :', len(self.stack) + 1

    def bgn_ifclear(self, args):
        if args in self.values.keys() \
           and self.values[args] is not None:
            self.skip = self.skip + 1
            self.stackinfo[len(self.stack)] = 1
        else:
            self.stackinfo[len(self.stack)] = 0
    def end_ifclear(self):
        try:
            if self.stackinfo[len(self.stack) + 1]:
                self.skip = self.skip - 1
            del self.stackinfo[len(self.stack) + 1]
        except KeyError:
            print '*** end_ifclear: KeyError :', len(self.stack) + 1

    def open_value(self):
        self.startsaving()

    def close_value(self):
        key = self.collectsavings()
        if key in self.values.keys():
            self.write(self.values[key])
        else:
            print '*** Undefined value: ', key

    # --- Beginning a file ---

    do_finalout = do_comment
    do_setchapternewpage = do_comment
    do_setfilename = do_comment

    def do_settitle(self, args):
        self.startsaving()
        self.expand(args)
        self.title = self.collectsavings()
    def do_parskip(self, args): pass

    # --- Ending a file ---

    def do_bye(self, args):
        self.endnode()
        self.done = 1

    # --- Title page ---

    def bgn_titlepage(self, args): self.skip = self.skip + 1
    def end_titlepage(self): self.skip = self.skip - 1
    def do_shorttitlepage(self, args): pass

    def do_center(self, args):
        # Actually not used outside title page...
        self.write('<H1>')
        self.expand(args)
        self.write('</H1>\n')
    do_title = do_center
    do_subtitle = do_center
    do_author = do_center

    do_vskip = do_comment
    do_vfill = do_comment
    do_smallbook = do_comment

    do_paragraphindent = do_comment
    do_setchapternewpage = do_comment
    do_headings = do_comment
    do_footnotestyle = do_comment

    do_evenheading = do_comment
    do_evenfooting = do_comment
    do_oddheading = do_comment
    do_oddfooting = do_comment
    do_everyheading = do_comment
    do_everyfooting = do_comment

    # --- Nodes ---

    def do_node(self, args):
        self.endnode()
        self.nodelineno = 0
        parts = [s.strip() for s in args.split(',')]
        while len(parts) < 4: parts.append('')
        self.nodelinks = parts
        [name, next, prev, up] = parts[:4]
        file = self.dirname + '/' + makefile(name)
        if self.filenames.has_key(file):
            print '*** Filename already in use: ', file
        else:
            if self.debugging: print '!'*self.debugging, '--- writing', file
        self.filenames[file] = 1
        # self.nodefp = open(file, 'w')
        self.nodename = name
        if self.cont and self.nodestack:
            self.nodestack[-1].cont = self.nodename
        if not self.topname: self.topname = name
        title = name
        if self.title: title = title + ' -- ' + self.title
        self.node = self.Node(self.dirname, self.nodename, self.topname,
                              title, next, prev, up)
        self.htmlhelp.addnode(self.nodename,next,prev,up,file)

    def link(self, label, nodename):
        if nodename:
            if nodename.lower() == '(dir)':
                addr = '../dir.html'
            else:
                addr = makefile(nodename)
            self.write(label, ': <A HREF="', addr, '" TYPE="',
                       label, '">', nodename, '</A>  \n')

    # --- Sectioning commands ---

    def popstack(self, type):
        if (self.node):
            self.node.type = type
            while self.nodestack:
                if self.nodestack[-1].type > type:
                    self.nodestack[-1].finalize()
                    self.nodestack[-1].flush()
                    del self.nodestack[-1]
                elif self.nodestack[-1].type == type:
                    if not self.nodestack[-1].next:
                        self.nodestack[-1].next = self.node.name
                    if not self.node.prev:
                        self.node.prev = self.nodestack[-1].name
                    self.nodestack[-1].finalize()
                    self.nodestack[-1].flush()
                    del self.nodestack[-1]
                else:
                    if type > 1 and not self.node.up:
                        self.node.up = self.nodestack[-1].name
                    break

    def do_chapter(self, args):
        self.heading('H1', args, 0)
        self.popstack(1)

    def do_unnumbered(self, args):
        self.heading('H1', args, -1)
        self.popstack(1)
    def do_appendix(self, args):
        self.heading('H1', args, -1)
        self.popstack(1)
    def do_top(self, args):
        self.heading('H1', args, -1)
    def do_chapheading(self, args):
        self.heading('H1', args, -1)
    def do_majorheading(self, args):
        self.heading('H1', args, -1)

    def do_section(self, args):
        self.heading('H1', args, 1)
        self.popstack(2)

    def do_unnumberedsec(self, args):
        self.heading('H1', args, -1)
        self.popstack(2)
    def do_appendixsec(self, args):
        self.heading('H1', args, -1)
        self.popstack(2)
    do_appendixsection = do_appendixsec
    def do_heading(self, args):
        self.heading('H1', args, -1)

    def do_subsection(self, args):
        self.heading('H2', args, 2)
        self.popstack(3)
    def do_unnumberedsubsec(self, args):
        self.heading('H2', args, -1)
        self.popstack(3)
    def do_appendixsubsec(self, args):
        self.heading('H2', args, -1)
        self.popstack(3)
    def do_subheading(self, args):
        self.heading('H2', args, -1)

    def do_subsubsection(self, args):
        self.heading('H3', args, 3)
        self.popstack(4)
    def do_unnumberedsubsubsec(self, args):
        self.heading('H3', args, -1)
        self.popstack(4)
    def do_appendixsubsubsec(self, args):
        self.heading('H3', args, -1)
        self.popstack(4)
    def do_subsubheading(self, args):
        self.heading('H3', args, -1)

    def heading(self, type, args, level):
        if level >= 0:
            while len(self.numbering) <= level:
                self.numbering.append(0)
            del self.numbering[level+1:]
            self.numbering[level] = self.numbering[level] + 1
            x = ''
            for i in self.numbering:
                x = x + repr(i) + '.'
            args = x + ' ' + args
            self.contents.append((level, args, self.nodename))
        self.write('<', type, '>')
        self.expand(args)
        self.write('</', type, '>\n')
        if self.debugging or self.print_headers:
            print '---', args

    def do_contents(self, args):
        # pass
        self.listcontents('Table of Contents', 999)

    def do_shortcontents(self, args):
        pass
        # self.listcontents('Short Contents', 0)
    do_summarycontents = do_shortcontents

    def listcontents(self, title, maxlevel):
        self.write('<H1>', title, '</H1>\n<UL COMPACT PLAIN>\n')
        prevlevels = [0]
        for level, title, node in self.contents:
            if level > maxlevel:
                continue
            if level > prevlevels[-1]:
                # can only advance one level at a time
                self.write('  '*prevlevels[-1], '<UL PLAIN>\n')
                prevlevels.append(level)
            elif level < prevlevels[-1]:
                # might drop back multiple levels
                while level < prevlevels[-1]:
                    del prevlevels[-1]
                    self.write('  '*prevlevels[-1],
                               '</UL>\n')
            self.write('  '*level, '<LI> <A HREF="',
                       makefile(node), '">')
            self.expand(title)
            self.write('</A>\n')
        self.write('</UL>\n' * len(prevlevels))

    # --- Page lay-out ---

    # These commands are only meaningful in printed text

    def do_page(self, args): pass

    def do_need(self, args): pass

    def bgn_group(self, args): pass
    def end_group(self): pass

    # --- Line lay-out ---

    def do_sp(self, args):
        if self.nofill:
            self.write('\n')
        else:
            self.write('<P>\n')

    def do_hline(self, args):
        self.write('<HR>')

    # --- Function and variable definitions ---

    def bgn_deffn(self, args):
        self.write('<DL>')
        self.do_deffnx(args)

    def end_deffn(self):
        self.write('</DL>\n')

    def do_deffnx(self, args):
        self.write('<DT>')
        words = splitwords(args, 2)
        [category, name], rest = words[:2], words[2:]
        self.expand('@b{%s}' % name)
        for word in rest: self.expand(' ' + makevar(word))
        #self.expand(' -- ' + category)
        self.write('\n<DD>')
        self.index('fn', name)

    def bgn_defun(self, args): self.bgn_deffn('Function ' + args)
    end_defun = end_deffn
    def do_defunx(self, args): self.do_deffnx('Function ' + args)

    def bgn_defmac(self, args): self.bgn_deffn('Macro ' + args)
    end_defmac = end_deffn
    def do_defmacx(self, args): self.do_deffnx('Macro ' + args)

    def bgn_defspec(self, args): self.bgn_deffn('{Special Form} ' + args)
    end_defspec = end_deffn
    def do_defspecx(self, args): self.do_deffnx('{Special Form} ' + args)

    def bgn_defvr(self, args):
        self.write('<DL>')
        self.do_defvrx(args)

    end_defvr = end_deffn

    def do_defvrx(self, args):
        self.write('<DT>')
        words = splitwords(args, 2)
        [category, name], rest = words[:2], words[2:]
        self.expand('@code{%s}' % name)
        # If there are too many arguments, show them
        for word in rest: self.expand(' ' + word)
        #self.expand(' -- ' + category)
        self.write('\n<DD>')
        self.index('vr', name)

    def bgn_defvar(self, args): self.bgn_defvr('Variable ' + args)
    end_defvar = end_defvr
    def do_defvarx(self, args): self.do_defvrx('Variable ' + args)

    def bgn_defopt(self, args): self.bgn_defvr('{User Option} ' + args)
    end_defopt = end_defvr
    def do_defoptx(self, args): self.do_defvrx('{User Option} ' + args)

    # --- Ditto for typed languages ---

    def bgn_deftypefn(self, args):
        self.write('<DL>')
        self.do_deftypefnx(args)

    end_deftypefn = end_deffn

    def do_deftypefnx(self, args):
        self.write('<DT>')
        words = splitwords(args, 3)
        [category, datatype, name], rest = words[:3], words[3:]
        self.expand('@code{%s} @b{%s}' % (datatype, name))
        for word in rest: self.expand(' ' + makevar(word))
        #self.expand(' -- ' + category)
        self.write('\n<DD>')
        self.index('fn', name)


    def bgn_deftypefun(self, args): self.bgn_deftypefn('Function ' + args)
    end_deftypefun = end_deftypefn
    def do_deftypefunx(self, args): self.do_deftypefnx('Function ' + args)

    def bgn_deftypevr(self, args):
        self.write('<DL>')
        self.do_deftypevrx(args)

    end_deftypevr = end_deftypefn

    def do_deftypevrx(self, args):
        self.write('<DT>')
        words = splitwords(args, 3)
        [category, datatype, name], rest = words[:3], words[3:]
        self.expand('@code{%s} @b{%s}' % (datatype, name))
        # If there are too many arguments, show them
        for word in rest: self.expand(' ' + word)
        #self.expand(' -- ' + category)
        self.write('\n<DD>')
        self.index('fn', name)

    def bgn_deftypevar(self, args):
        self.bgn_deftypevr('Variable ' + args)
    end_deftypevar = end_deftypevr
    def do_deftypevarx(self, args):
        self.do_deftypevrx('Variable ' + args)

    # --- Ditto for object-oriented languages ---

    def bgn_defcv(self, args):
        self.write('<DL>')
        self.do_defcvx(args)

    end_defcv = end_deftypevr

    def do_defcvx(self, args):
        self.write('<DT>')
        words = splitwords(args, 3)
        [category, classname, name], rest = words[:3], words[3:]
        self.expand('@b{%s}' % name)
        # If there are too many arguments, show them
        for word in rest: self.expand(' ' + word)
        #self.expand(' -- %s of @code{%s}' % (category, classname))
        self.write('\n<DD>')
        self.index('vr', '%s @r{on %s}' % (name, classname))

    def bgn_defivar(self, args):
        self.bgn_defcv('{Instance Variable} ' + args)
    end_defivar = end_defcv
    def do_defivarx(self, args):
        self.do_defcvx('{Instance Variable} ' + args)

    def bgn_defop(self, args):
        self.write('<DL>')
        self.do_defopx(args)

    end_defop = end_defcv

    def do_defopx(self, args):
        self.write('<DT>')
        words = splitwords(args, 3)
        [category, classname, name], rest = words[:3], words[3:]
        self.expand('@b{%s}' % name)
        for word in rest: self.expand(' ' + makevar(word))
        #self.expand(' -- %s of @code{%s}' % (category, classname))
        self.write('\n<DD>')
        self.index('fn', '%s @r{on %s}' % (name, classname))

    def bgn_defmethod(self, args):
        self.bgn_defop('Method ' + args)
    end_defmethod = end_defop
    def do_defmethodx(self, args):
        self.do_defopx('Method ' + args)

    # --- Ditto for data types ---

    def bgn_deftp(self, args):
        self.write('<DL>')
        self.do_deftpx(args)

    end_deftp = end_defcv

    def do_deftpx(self, args):
        self.write('<DT>')
        words = splitwords(args, 2)
        [category, name], rest = words[:2], words[2:]
        self.expand('@b{%s}' % name)
        for word in rest: self.expand(' ' + word)
        #self.expand(' -- ' + category)
        self.write('\n<DD>')
        self.index('tp', name)

    # --- Making Lists and Tables

    def bgn_enumerate(self, args):
        if not args:
            self.write('<OL>\n')
            self.stackinfo[len(self.stack)] = '</OL>\n'
        else:
            self.itemnumber = args
            self.write('<UL>\n')
            self.stackinfo[len(self.stack)] = '</UL>\n'
    def end_enumerate(self):
        self.itemnumber = None
        self.write(self.stackinfo[len(self.stack) + 1])
        del self.stackinfo[len(self.stack) + 1]

    def bgn_itemize(self, args):
        self.itemarg = args
        self.write('<UL>\n')
    def end_itemize(self):
        self.itemarg = None
        self.write('</UL>\n')

    def bgn_table(self, args):
        self.itemarg = args
        self.write('<DL>\n')
    def end_table(self):
        self.itemarg = None
        self.write('</DL>\n')

    def bgn_ftable(self, args):
        self.itemindex = 'fn'
        self.bgn_table(args)
    def end_ftable(self):
        self.itemindex = None
        self.end_table()

    def bgn_vtable(self, args):
        self.itemindex = 'vr'
        self.bgn_table(args)
    def end_vtable(self):
        self.itemindex = None
        self.end_table()

    def do_item(self, args):
        if self.itemindex: self.index(self.itemindex, args)
        if self.itemarg:
            if self.itemarg[0] == '@' and self.itemarg[1] and \
                            self.itemarg[1] in string.ascii_letters:
                args = self.itemarg + '{' + args + '}'
            else:
                # some other character, e.g. '-'
                args = self.itemarg + ' ' + args
        if self.itemnumber <> None:
            args = self.itemnumber + '. ' + args
            self.itemnumber = increment(self.itemnumber)
        if self.stack and self.stack[-1] == 'table':
            self.write('<DT>')
            self.expand(args)
            self.write('\n<DD>')
        elif self.stack and self.stack[-1] == 'multitable':
            self.write('<TR><TD>')
            self.expand(args)
            self.write('</TD>\n</TR>\n')
        else:
            self.write('<LI>')
            self.expand(args)
            self.write('  ')
    do_itemx = do_item # XXX Should suppress leading blank line

    # rpyron 2002-05-07  multitable support
    def bgn_multitable(self, args):
        self.itemarg = None     # should be handled by columnfractions
        self.write('<TABLE BORDER="">\n')
    def end_multitable(self):
        self.itemarg = None
        self.write('</TABLE>\n<BR>\n')
    def handle_columnfractions(self):
        # It would be better to handle this, but for now it's in the way...
        self.itemarg = None
    def handle_tab(self):
        self.write('</TD>\n    <TD>')

    # --- Enumerations, displays, quotations ---
    # XXX Most of these should increase the indentation somehow

    def bgn_quotation(self, args): self.write('<BLOCKQUOTE>')
    def end_quotation(self): self.write('</BLOCKQUOTE>\n')

    def bgn_example(self, args):
        self.nofill = self.nofill + 1
        self.write('<PRE>')
    def end_example(self):
        self.write('</PRE>\n')
        self.nofill = self.nofill - 1

    bgn_lisp = bgn_example # Synonym when contents are executable lisp code
    end_lisp = end_example

    bgn_smallexample = bgn_example # XXX Should use smaller font
    end_smallexample = end_example

    bgn_smalllisp = bgn_lisp # Ditto
    end_smalllisp = end_lisp

    bgn_display = bgn_example
    end_display = end_example

    bgn_format = bgn_display
    end_format = end_display

    def do_exdent(self, args): self.expand(args + '\n')
    # XXX Should really mess with indentation

    def bgn_flushleft(self, args):
        self.nofill = self.nofill + 1
        self.write('<PRE>\n')
    def end_flushleft(self):
        self.write('</PRE>\n')
        self.nofill = self.nofill - 1

    def bgn_flushright(self, args):
        self.nofill = self.nofill + 1
        self.write('<ADDRESS COMPACT>\n')
    def end_flushright(self):
        self.write('</ADDRESS>\n')
        self.nofill = self.nofill - 1

    def bgn_menu(self, args):
        self.write('<DIR>\n')
        self.write('  <STRONG><EM>Menu</EM></STRONG><P>\n')
        self.htmlhelp.beginmenu()
    def end_menu(self):
        self.write('</DIR>\n')
        self.htmlhelp.endmenu()

    def bgn_cartouche(self, args): pass
    def end_cartouche(self): pass

    # --- Indices ---

    def resetindex(self):
        self.noncodeindices = ['cp']
        self.indextitle = {}
        self.indextitle['cp'] = 'Concept'
        self.indextitle['fn'] = 'Function'
        self.indextitle['ky'] = 'Keyword'
        self.indextitle['pg'] = 'Program'
        self.indextitle['tp'] = 'Type'
        self.indextitle['vr'] = 'Variable'
        #
        self.whichindex = {}
        for name in self.indextitle.keys():
            self.whichindex[name] = []

    def user_index(self, name, args):
        if self.whichindex.has_key(name):
            self.index(name, args)
        else:
            print '*** No index named', repr(name)

    def do_cindex(self, args): self.index('cp', args)
    def do_findex(self, args): self.index('fn', args)
    def do_kindex(self, args): self.index('ky', args)
    def do_pindex(self, args): self.index('pg', args)
    def do_tindex(self, args): self.index('tp', args)
    def do_vindex(self, args): self.index('vr', args)

    def index(self, name, args):
        self.whichindex[name].append((args, self.nodename))
        self.htmlhelp.index(args, self.nodename)

    def do_synindex(self, args):
        words = args.split()
        if len(words) <> 2:
            print '*** bad @synindex', args
            return
        [old, new] = words
        if not self.whichindex.has_key(old) or \
                  not self.whichindex.has_key(new):
            print '*** bad key(s) in @synindex', args
            return
        if old <> new and \
                  self.whichindex[old] is not self.whichindex[new]:
            inew = self.whichindex[new]
            inew[len(inew):] = self.whichindex[old]
            self.whichindex[old] = inew
    do_syncodeindex = do_synindex # XXX Should use code font

    def do_printindex(self, args):
        words = args.split()
        for name in words:
            if self.whichindex.has_key(name):
                self.prindex(name)
            else:
                print '*** No index named', repr(name)

    def prindex(self, name):
        iscodeindex = (name not in self.noncodeindices)
        index = self.whichindex[name]
        if not index: return
        if self.debugging:
            print '!'*self.debugging, '--- Generating', \
                  self.indextitle[name], 'index'
        #  The node already provides a title
        index1 = []
        junkprog = re.compile('^(@[a-z]+)?{')
        for key, node in index:
            sortkey = key.lower()
            # Remove leading `@cmd{' from sort key
            # -- don't bother about the matching `}'
            oldsortkey = sortkey
            while 1:
                mo = junkprog.match(sortkey)
                if not mo:
                    break
                i = mo.end()
                sortkey = sortkey[i:]
            index1.append((sortkey, key, node))
        del index[:]
        index1.sort()
        self.write('<DL COMPACT>\n')
        prevkey = prevnode = None
        for sortkey, key, node in index1:
            if (key, node) == (prevkey, prevnode):
                continue
            if self.debugging > 1: print '!'*self.debugging, key, ':', node
            self.write('<DT>')
            if iscodeindex: key = '@code{' + key + '}'
            if key != prevkey:
                self.expand(key)
            self.write('\n<DD><A HREF="%s">%s</A>\n' % (makefile(node), node))
            prevkey, prevnode = key, node
        self.write('</DL>\n')

    # --- Final error reports ---

    def report(self):
        if self.unknown:
            print '--- Unrecognized commands ---'
            cmds = self.unknown.keys()
            cmds.sort()
            for cmd in cmds:
                print cmd.ljust(20), self.unknown[cmd]


class TexinfoParserHTML3(TexinfoParser):

    COPYRIGHT_SYMBOL = "&copy;"
    FN_ID_PATTERN = "[%(id)s]"
    FN_SOURCE_PATTERN = '<A ID=footnoteref%(id)s ' \
                        'HREF="#footnotetext%(id)s">' + FN_ID_PATTERN + '</A>'
    FN_TARGET_PATTERN = '<FN ID=footnotetext%(id)s>\n' \
                        '<P><A HREF="#footnoteref%(id)s">' + FN_ID_PATTERN \
                        + '</A>\n%(text)s</P></FN>\n'
    FN_HEADER = '<DIV CLASS=footnotes>\n  <HR NOSHADE WIDTH=200>\n' \
                '  <STRONG><EM>Footnotes</EM></STRONG>\n  <P>\n'

    Node = HTML3Node

    def bgn_quotation(self, args): self.write('<BQ>')
    def end_quotation(self): self.write('</BQ>\n')

    def bgn_example(self, args):
        # this use of <CODE> would not be legal in HTML 2.0,
        # but is in more recent DTDs.
        self.nofill = self.nofill + 1
        self.write('<PRE CLASS=example><CODE>')
    def end_example(self):
        self.write("</CODE></PRE>\n")
        self.nofill = self.nofill - 1

    def bgn_flushleft(self, args):
        self.nofill = self.nofill + 1
        self.write('<PRE CLASS=flushleft>\n')

    def bgn_flushright(self, args):
        self.nofill = self.nofill + 1
        self.write('<DIV ALIGN=right CLASS=flushright><ADDRESS COMPACT>\n')
    def end_flushright(self):
        self.write('</ADDRESS></DIV>\n')
        self.nofill = self.nofill - 1

    def bgn_menu(self, args):
        self.write('<UL PLAIN CLASS=menu>\n')
        self.write('  <LH>Menu</LH>\n')
    def end_menu(self):
        self.write('</UL>\n')


# rpyron 2002-05-07
class HTMLHelp:
    """
    This class encapsulates support for HTML Help. Node names,
    file names, menu items, index items, and image file names are
    accumulated until a call to finalize(). At that time, three
    output files are created in the current directory:

        `helpbase`.hhp  is a HTML Help Workshop project file.
                        It contains various information, some of
                        which I do not understand; I just copied
                        the default project info from a fresh
                        installation.
        `helpbase`.hhc  is the Contents file for the project.
        `helpbase`.hhk  is the Index file for the project.

    When these files are used as input to HTML Help Workshop,
    the resulting file will be named:

        `helpbase`.chm

    If none of the defaults in `helpbase`.hhp are changed,
    the .CHM file will have Contents, Index, Search, and
    Favorites tabs.
    """

    codeprog = re.compile('@code{(.*?)}')

    def __init__(self,helpbase,dirname):
        self.helpbase    = helpbase
        self.dirname     = dirname
        self.projectfile = None
        self.contentfile = None
        self.indexfile   = None
        self.nodelist    = []
        self.nodenames   = {}         # nodename : index
        self.nodeindex   = {}
        self.filenames   = {}         # filename : filename
        self.indexlist   = []         # (args,nodename) == (key,location)
        self.current     = ''
        self.menudict    = {}
        self.dumped      = {}


    def addnode(self,name,next,prev,up,filename):
        node = (name,next,prev,up,filename)
        # add this file to dict
        # retrieve list with self.filenames.values()
        self.filenames[filename] = filename
        # add this node to nodelist
        self.nodeindex[name] = len(self.nodelist)
        self.nodelist.append(node)
        # set 'current' for menu items
        self.current = name
        self.menudict[self.current] = []

    def menuitem(self,nodename):
        menu = self.menudict[self.current]
        menu.append(nodename)


    def addimage(self,imagename):
        self.filenames[imagename] = imagename

    def index(self, args, nodename):
        self.indexlist.append((args,nodename))

    def beginmenu(self):
        pass

    def endmenu(self):
        pass

    def finalize(self):
        if not self.helpbase:
            return

        # generate interesting filenames
        resultfile   = self.helpbase + '.chm'
        projectfile  = self.helpbase + '.hhp'
        contentfile  = self.helpbase + '.hhc'
        indexfile    = self.helpbase + '.hhk'

        # generate a reasonable title
        title        = self.helpbase

        # get the default topic file
        (topname,topnext,topprev,topup,topfile) = self.nodelist[0]
        defaulttopic = topfile

        # PROJECT FILE
        try:
            fp = open(projectfile,'w')
            print>>fp, '[OPTIONS]'
            print>>fp, 'Auto Index=Yes'
            print>>fp, 'Binary TOC=No'
            print>>fp, 'Binary Index=Yes'
            print>>fp, 'Compatibility=1.1'
            print>>fp, 'Compiled file=' + resultfile + ''
            print>>fp, 'Contents file=' + contentfile + ''
            print>>fp, 'Default topic=' + defaulttopic + ''
            print>>fp, 'Error log file=ErrorLog.log'
            print>>fp, 'Index file=' + indexfile + ''
            print>>fp, 'Title=' + title + ''
            print>>fp, 'Display compile progress=Yes'
            print>>fp, 'Full-text search=Yes'
            print>>fp, 'Default window=main'
            print>>fp, ''
            print>>fp, '[WINDOWS]'
            print>>fp, ('main=,"' + contentfile + '","' + indexfile
                        + '","","",,,,,0x23520,222,0x1046,[10,10,780,560],'
                        '0xB0000,,,,,,0')
            print>>fp, ''
            print>>fp, '[FILES]'
            print>>fp, ''
            self.dumpfiles(fp)
            fp.close()
        except IOError, msg:
            print projectfile, ':', msg
            sys.exit(1)

        # CONTENT FILE
        try:
            fp = open(contentfile,'w')
            print>>fp, '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">'
            print>>fp, '<!-- This file defines the table of contents -->'
            print>>fp, '<HTML>'
            print>>fp, '<HEAD>'
            print>>fp, ('<meta name="GENERATOR" '
                        'content="Microsoft&reg; HTML Help Workshop 4.1">')
            print>>fp, '<!-- Sitemap 1.0 -->'
            print>>fp, '</HEAD>'
            print>>fp, '<BODY>'
            print>>fp, '   <OBJECT type="text/site properties">'
            print>>fp, '     <param name="Window Styles" value="0x800025">'
            print>>fp, '     <param name="comment" value="title:">'
            print>>fp, '     <param name="comment" value="base:">'
            print>>fp, '   </OBJECT>'
            self.dumpnodes(fp)
            print>>fp, '</BODY>'
            print>>fp, '</HTML>'
            fp.close()
        except IOError, msg:
            print contentfile, ':', msg
            sys.exit(1)

        # INDEX FILE
        try:
            fp = open(indexfile  ,'w')
            print>>fp, '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">'
            print>>fp, '<!-- This file defines the index -->'
            print>>fp, '<HTML>'
            print>>fp, '<HEAD>'
            print>>fp, ('<meta name="GENERATOR" '
                        'content="Microsoft&reg; HTML Help Workshop 4.1">')
            print>>fp, '<!-- Sitemap 1.0 -->'
            print>>fp, '</HEAD>'
            print>>fp, '<BODY>'
            print>>fp, '<OBJECT type="text/site properties">'
            print>>fp, '</OBJECT>'
            self.dumpindex(fp)
            print>>fp, '</BODY>'
            print>>fp, '</HTML>'
            fp.close()
        except IOError, msg:
            print indexfile  , ':', msg
            sys.exit(1)

    def dumpfiles(self, outfile=sys.stdout):
        filelist = self.filenames.values()
        filelist.sort()
        for filename in filelist:
            print>>outfile, filename

    def dumpnodes(self, outfile=sys.stdout):
        self.dumped = {}
        if self.nodelist:
            nodename, dummy, dummy, dummy, dummy = self.nodelist[0]
            self.topnode = nodename

        print>>outfile,  '<UL>'
        for node in self.nodelist:
            self.dumpnode(node,0,outfile)
        print>>outfile,  '</UL>'

    def dumpnode(self, node, indent=0, outfile=sys.stdout):
        if node:
            # Retrieve info for this node
            (nodename,next,prev,up,filename) = node
            self.current = nodename

            # Have we been dumped already?
            if self.dumped.has_key(nodename):
                return
            self.dumped[nodename] = 1

            # Print info for this node
            print>>outfile, ' '*indent,
            print>>outfile, '<LI><OBJECT type="text/sitemap">',
            print>>outfile, '<param name="Name" value="' + nodename +'">',
            print>>outfile, '<param name="Local" value="'+ filename +'">',
            print>>outfile, '</OBJECT>'

            # Does this node have menu items?
            try:
                menu = self.menudict[nodename]
                self.dumpmenu(menu,indent+2,outfile)
            except KeyError:
                pass

    def dumpmenu(self, menu, indent=0, outfile=sys.stdout):
        if menu:
            currentnode = self.current
            if currentnode != self.topnode:    # XXX this is a hack
                print>>outfile, ' '*indent + '<UL>'
                indent += 2
            for item in menu:
                menunode = self.getnode(item)
                self.dumpnode(menunode,indent,outfile)
            if currentnode != self.topnode:    # XXX this is a hack
                print>>outfile, ' '*indent + '</UL>'
                indent -= 2

    def getnode(self, nodename):
        try:
            index = self.nodeindex[nodename]
            return self.nodelist[index]
        except KeyError:
            return None
        except IndexError:
            return None

    # (args,nodename) == (key,location)
    def dumpindex(self, outfile=sys.stdout):
        print>>outfile,  '<UL>'
        for (key,location) in self.indexlist:
            key = self.codeexpand(key)
            location = makefile(location)
            location = self.dirname + '/' + location
            print>>outfile, '<LI><OBJECT type="text/sitemap">',
            print>>outfile, '<param name="Name" value="' + key + '">',
            print>>outfile, '<param name="Local" value="' + location + '">',
            print>>outfile, '</OBJECT>'
        print>>outfile,  '</UL>'

    def codeexpand(self, line):
        co = self.codeprog.match(line)
        if not co:
            return line
        bgn, end = co.span(0)
        a, b = co.span(1)
        line = line[:bgn] + line[a:b] + line[end:]
        return line


# Put @var{} around alphabetic substrings
def makevar(str):
    return '@var{'+str+'}'


# Split a string in "words" according to findwordend
def splitwords(str, minlength):
    words = []
    i = 0
    n = len(str)
    while i < n:
        while i < n and str[i] in ' \t\n': i = i+1
        if i >= n: break
        start = i
        i = findwordend(str, i, n)
        words.append(str[start:i])
    while len(words) < minlength: words.append('')
    return words


# Find the end of a "word", matching braces and interpreting @@ @{ @}
fwprog = re.compile('[@{} ]')
def findwordend(str, i, n):
    level = 0
    while i < n:
        mo = fwprog.search(str, i)
        if not mo:
            break
        i = mo.start()
        c = str[i]; i = i+1
        if c == '@': i = i+1 # Next character is not special
        elif c == '{': level = level+1
        elif c == '}': level = level-1
        elif c == ' ' and level <= 0: return i-1
    return n


# Convert a node name into a file name
def makefile(nodename):
    nodename = nodename.strip()
    return fixfunnychars(nodename) + '.html'


# Characters that are perfectly safe in filenames and hyperlinks
goodchars = string.ascii_letters + string.digits + '!@-=+.'

# Replace characters that aren't perfectly safe by dashes
# Underscores are bad since Cern HTTPD treats them as delimiters for
# encoding times, so you get mismatches if you compress your files:
# a.html.gz will map to a_b.html.gz
def fixfunnychars(addr):
    i = 0
    while i < len(addr):
        c = addr[i]
        if c not in goodchars:
            c = '-'
            addr = addr[:i] + c + addr[i+1:]
        i = i + len(c)
    return addr


# Increment a string used as an enumeration
def increment(s):
    if not s:
        return '1'
    for sequence in string.digits, string.lowercase, string.uppercase:
        lastc = s[-1]
        if lastc in sequence:
            i = sequence.index(lastc) + 1
            if i >= len(sequence):
                if len(s) == 1:
                    s = sequence[0]*2
                    if s == '00':
                        s = '10'
                else:
                    s = increment(s[:-1]) + sequence[0]
            else:
                s = s[:-1] + sequence[i]
            return s
    return s # Don't increment


def test():
    import sys
    debugging = 0
    print_headers = 0
    cont = 0
    html3 = 0
    htmlhelp = ''

    while sys.argv[1] == ['-d']:
        debugging = debugging + 1
        del sys.argv[1]
    if sys.argv[1] == '-p':
        print_headers = 1
        del sys.argv[1]
    if sys.argv[1] == '-c':
        cont = 1
        del sys.argv[1]
    if sys.argv[1] == '-3':
        html3 = 1
        del sys.argv[1]
    if sys.argv[1] == '-H':
        helpbase = sys.argv[2]
        del sys.argv[1:3]
    if len(sys.argv) <> 3:
        print 'usage: texi2hh [-d [-d]] [-p] [-c] [-3] [-H htmlhelp]', \
              'inputfile outputdirectory'
        sys.exit(2)

    if html3:
        parser = TexinfoParserHTML3()
    else:
        parser = TexinfoParser()
    parser.cont = cont
    parser.debugging = debugging
    parser.print_headers = print_headers

    file = sys.argv[1]
    dirname  = sys.argv[2]
    parser.setdirname(dirname)
    parser.setincludedir(os.path.dirname(file))

    htmlhelp = HTMLHelp(helpbase, dirname)
    parser.sethtmlhelp(htmlhelp)

    try:
        fp = open(file, 'r')
    except IOError, msg:
        print file, ':', msg
        sys.exit(1)

    parser.parse(fp)
    fp.close()
    parser.report()

    htmlhelp.finalize()


if __name__ == "__main__":
    test()
ptags.py000075500000002310151732701210006232 0ustar00#! /usr/bin/python2.7

# ptags
#
# Create a tags file for Python programs, usable with vi.
# Tagged are:
# - functions (even inside other defs or classes)
# - classes
# - filenames
# Warns about files it cannot open.
# No warnings about duplicate tags.

import sys, re, os

tags = []    # Modified global variable!

def main():
    args = sys.argv[1:]
    for filename in args:
        treat_file(filename)
    if tags:
        fp = open('tags', 'w')
        tags.sort()
        for s in tags: fp.write(s)


expr = '^[ \t]*(def|class)[ \t]+([a-zA-Z0-9_]+)[ \t]*[:\(]'
matcher = re.compile(expr)

def treat_file(filename):
    try:
        fp = open(filename, 'r')
    except:
        sys.stderr.write('Cannot open %s\n' % filename)
        return
    base = os.path.basename(filename)
    if base[-3:] == '.py':
        base = base[:-3]
    s = base + '\t' + filename + '\t' + '1\n'
    tags.append(s)
    while 1:
        line = fp.readline()
        if not line:
            break
        m = matcher.match(line)
        if m:
            content = m.group(0)
            name = m.group(2)
            s = name + '\t' + filename + '\t/^' + content + '/\n'
            tags.append(s)

if __name__ == '__main__':
    main()
ptags.pyc000064400000002577151732701210006411 0ustar00�
�fc@skddlZddlZddlZgZd�ZdZeje�Zd�Ze	dkrge�ndS(i����NcCsltjd}x|D]}t|�qWtrhtdd�}tj�xtD]}|j|�qNWndS(Nittagstw(tsystargvt
treat_fileRtopentsorttwrite(targstfilenametfpts((s+/usr/lib64/python2.7/Tools/scripts/ptags.pytmains



s/^[ 	]*(def|class)[ 	]+([a-zA-Z0-9_]+)[ 	]*[:\(]cCsyt|d�}Wntjjd|�dSXtjj|�}|ddkra|d }n|d|dd}tj|�xw|j	�}|s�Pnt
j|�}|r�|jd�}|jd�}|d|d	|d
}tj|�q�q�WdS(NtrsCannot open %s
i����s.pys	s1
iis	/^s/
(
RRtstderrRtostpathtbasenameRtappendtreadlinetmatchertmatchtgroup(R	R
tbaseRtlinetmtcontenttname((s+/usr/lib64/python2.7/Tools/scripts/ptags.pyRs(

t__main__(
RtreRRRtexprtcompileRRt__name__(((s+/usr/lib64/python2.7/Tools/scripts/ptags.pyt<module>
s$	
	cleanfuture.pyo000064400000016301151732701210007612 0ustar00�
�fc@s�dZddlZddlZddlZddlZdadadad�Zd�Z	d�Z
dd
d��YZed	kr�e	�ndS(s�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.
i����NicGsOtt|�}dj|�}|ddkr;|d7}ntjj|�dS(Nt i����s
(tmaptstrtjointsyststderrtwrite(targststringstmsg((s1/usr/lib64/python2.7/Tools/scripts/cleanfuture.pyterrprint2s

cCs�ddl}y#|jtjdd�\}}Wn!|jk
rR}t|�dSXx_|D]W\}}|dkrtd7aqZ|dkr�td7aqZ|dkrZtd7aqZqZW|s�tdt�dSx|D]}t	|�q�WdS(Ni����itdrvs-ds-rs-vsUsage:(
tgetoptRtargvterrorR
tdryruntrecursetverboset__doc__tcheck(RtoptsRR	totatarg((s1/usr/lib64/python2.7/Tools/scripts/cleanfuture.pytmain9s$#




cCs�tjj|�r�tjj|�r�tr7dG|GHntj|�}xp|D]h}tjj||�}tr�tjj|�r�tjj|�s�|j�j	d�rMt
|�qMqMWdStr�dG|GdGnyt|�}Wn.tk
r}t
d|t|�f�dSXt||�}|j�}|rA|j�n|j�|r�trmdGHtrmdGHqmnxw|D]o\}}	}
d||d	|	d	fGHx&t||	d	�D]}|j|Gq�W|
dkr�d
GHqtdGH|
GqtWts�|d}tjj|�rtj|�ntj||�trCd
G|GdG|GHnt|d�}
|j|
�|
j�tr~dG|GHq~q�ntr�dGHndS(Nslisting directorys.pytcheckings...s%r: I/O Error: %sschanged.s+But this is a dry run, so leaving it alone.s%r lines %d-%dis
-- deleteds
-- change to:s.baktrenamedttotws	wrote news
unchanged.(tostpathtisdirtislinkRtlistdirRRtlowertendswithRtopentIOErrorR
RtFutureFindertrunt
gettheresttcloseRtrangetlinestNonetexiststremovetrenameR(tfiletnamestnametfullnametfR	tfftchangedtstetlinetitbaktg((s1/usr/lib64/python2.7/Tools/scripts/cleanfuture.pyRNsd%





R&cBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCs1||_||_d|_g|_g|_dS(Ni(R4tfnametateofR+R6(tselfR4R=((s1/usr/lib64/python2.7/Tools/scripts/cleanfuture.pyt__init__�s
				cCsH|jr
dS|jj�}|dkr4d|_n|jj|�|S(Nti(R>R4treadlineR+tappend(R?R9((s1/usr/lib64/python2.7/Tools/scripts/cleanfuture.pytgetline�s	cCs	tj}tj}tj}tj}tj}tj}|j}tj|j	�j
}|�\}	}
\}}\}
}}x=|	|||fkr�|�\}	}
\}}\}
}}q{Wx4|	|kr�|�\}	}
\}}\}
}}q�Wxx=|	|||fkr1|�\}	}
\}}\}
}}q�W|	|koG|
dksNPn|d}|�\}	}
\}}\}
}}|	|ko�|
dks�Pn|�\}	}
\}}\}
}}|	|ko�|
dks�Pn|�\}	}
\}}\}
}}g}x�|	|kr�|j|
�|�\}	}
\}}\}
}}|	|koW|
dks^Pn|�\}	}
\}}\}
}}qWd}|	|kr�|
}|�\}	}
\}}\}
}}n|	|k	r�t
d|j||f�gS|d}g}xs|D]k}tt|d�}|dkr:|j|�q|j�}|dksq|tjkrdq|j|�qWt|�t|�kr�t|�dkr�d}n@d}|d	j|�7}|dk	r�|d
|7}n|d7}|j|||f�q�q�W|S(Ntfromit
__future__timportt,s)Skipping file %r; can't parse line %d:
%sisfrom __future__ import s, Rs
(ttokenizetSTRINGtNLtNEWLINEtCOMMENTtNAMEtOPR6tgenerate_tokensRDtnextRCR,R
R=tgetattrRFtgetMandatoryReleaseRtversion_infotlenR(R?RJRKRLRMRNROR6tgetttypettokentsrowtscolterowtecolR9t	startlinetfeaturestcommenttendlinet
okfeaturesR4tobjecttreleased((s1/usr/lib64/python2.7/Tools/scripts/cleanfuture.pyR'�sz							$(((
$$$
$('

	
cCs+|jrd|_n|jj�|_dS(NRA(R>ttherestR4tread(R?((s1/usr/lib64/python2.7/Tools/scripts/cleanfuture.pyR(�s	cCs�|j}g|_|j�xN|D]F\}}}|dkrR|j||d5q#|g|j||d+q#W|j|j�|jr�|j|j�ndS(Ni(R6treverseR,R+t
writelinesRdR(R?R4R6R7R8R9((s1/usr/lib64/python2.7/Tools/scripts/cleanfuture.pyRs		
	(t__name__t
__module__R@RDR'R(R(((s1/usr/lib64/python2.7/Tools/scripts/cleanfuture.pyR&�s
	
	
	_	t__main__((
RRFRIRRRRRR
RRR&Rh(((s1/usr/lib64/python2.7/Tools/scripts/cleanfuture.pyt<module>'s			8�which.pyc000064400000003140151732701210006360 0ustar00�
�fc@szddlZejdd	kr,ejd=nddlZddlZddlTd�Zd�Zedkrve�ndS(
i����Nit.t(t*cCstjj|d�dS(Ns
(tsyststderrtwrite(tstr((s+/usr/lib64/python2.7/Tools/scripts/which.pytmsg
sc
Cs�tjdjtj�}d}d}tjdrctjdd dkrctjd}tjd=nx]tjdD]N}d}x"|D]}tjj||�}ytj|�}Wntj	k
r�q�nXt
|t�s�t|d�npt
|t�}|d@rO|s|GH|d	 }q]|d	 |kr8d
}	nd}	t|	|�nt|d�|r�tjd
|d|�}|r�tdt|��q�q�q�W|sqt|d�d}qqqqWtj|�dS(NtPATHiRiis-ls: not a disk fileiIis	same as: salso: s: not executablesls t s"ls -l" exit status: s: not found((tostenvirontsplittpathsepRtargvtpathtjointstatterrortS_ISREGtST_MODERtS_IMODEtsystemtreprtexit(
tpathlisttststlonglisttprogtidenttdirtfilenametsttmodets((s+/usr/lib64/python2.7/Tools/scripts/which.pytmainsD$




	
t__main__(RR(RRR
RRR#t__name__(((s+/usr/lib64/python2.7/Tools/scripts/which.pyt<module>s

		+h2py.pyo000064400000010450151732701210006156 0ustar00�
�fc@sddlZddlZddlZddlZejd�Zejd�Zejd�Zejd�Zejd�Z	ee	gZ
ejd�Zejd�Zia
iZyejd	jd
�ZWnek
r�yejdjd
�ZWq�ek
r�yfejjd�d
kr9ejdjd
�Zn1ejjd�rdejdjd�Zne�Wq�ek
r�dgZy*ejd
ejjdejd��Wq�ek
r�q�Xq�Xq�XnXd�Zd�Zid�Zedkre�ndS(i����Ns+^[	 ]*#[	 ]*define[	 ]+([a-zA-Z0-9_]+)[	 ]+sG^[	 ]*#[	 ]*define[	 ]+([a-zA-Z0-9_]+)\(([_a-zA-Z][_a-zA-Z0-9]*)\)[	 ]+s"^[	 ]*#[	 ]*include[	 ]+<([^>
]+)>s/\*([^*]+|\*+[^/])*(\*+/)?s//.*s'(\\.[^\\]*|[^\\])'s0x([0-9a-fA-F]+)L?tincludet;tINCLUDEtbeosit
BEINCLUDEStatheostC_INCLUDE_PATHt:s/usr/includet	MULTIARCHcCs�tjtjdd�\}}x9|D]1\}}|dkr&tjtj|��q&q&W|smdg}nxA|D]9}|dkr�tjjd�t	tj
tj�qtt|d�}tj
j|�}|jd�}|dkr�|| }n|j�}|d	}t|d
�}	|	jd|�iaxXtD]P}
|t|
� |
kr8dt|t|
�d<|t|t|
�d<Pq8q8Wt	||	�|	j�|j�qtWdS(Nisi:s-it-s# Generated by h2py from stdin
trt.is.pytws# Generated by h2py from %s
(tgetopttsystargvtignorestappendtretcompiletstdouttwritetprocesststdintopentostpathtbasenametrfindtuppertfiledictt
searchdirstlentNonet
importabletclose(toptstargstotatfilenametfptoutfiletitmodnametoutfptdir((s*/usr/lib64/python2.7/Tools/scripts/h2py.pytmainDs8





cCs�x tD]}|jd|�}qWtjd|�}d}dtjd}x�tj||�}|skPn|j�\}}t|t	|jd��d�}|tjkr�||8}|| dt
|�d||}n|d}qOW|S(	Nt s	ord('\1')iiiit(t)(Rtsubtp_charRtmaxinttp_hextsearchtspantlongtslicetstr(tbodytptstarttUMAXtmtstetval((s*/usr/lib64/python2.7/Tools/scripts/h2py.pytpytifycs 
"
'cBs�d}x�|j�}|sPn|d}ej|�}|rx>|ddkr~|j�}|sgPn|d}||}qAW|jd�}||j�}e|�}d}	d||j�f}
y|
|UWnejj	d|
�qX|j	|
�ne
j|�}|r�|jdd�\}}||j�}e|�}d|||f}
y|
|UWnejj	d|
�q�X|j	|
�nej|�}|r	|j}
|
d\}}|||!}e
j|�r�|j	d	e
|�q�ej|�s�de|<d}x;eD]3}ye|d
|�}PWqek
rPqXqW|r|j	d|�e|||�q�ejj	d|�q�q	q	WdS(
Niii����s\
s%s = %s
sSkipping: %sisdef %s(%s): return %s
sfrom %s import *
t/s
# Included from %s
s!Warning - could not find file %s
(treadlinetp_definetmatchtgrouptendRDtstripRtstderrRtp_macrot	p_includetregsR"thas_keyRR!RRtIOErrorR(R)R-tenvtlinenotlineRHtnextlinetnameR<toktstmttmacrotargROR'tbR(tinclfpR.((s*/usr/lib64/python2.7/Tools/scripts/h2py.pyRwsr

	



t__main__(RRR
RRRGRMRNt	p_commentt
p_cpp_commentRR4R6RR"tenvirontsplitRtKeyErrortplatformtfindt
startswithtinsertRtjoinR/RDRt__name__(((s*/usr/lib64/python2.7/Tools/scripts/h2py.pyt<module>sF0	



	
		=logmerge.pyo000064400000011733151732701210007102 0ustar00�
�fc@s�dZddlZddlZddlZddlZdddZdddZd�Zd	�Zdd
�Z
d�Zedkr�ye�Wq�e
k
r�Zejejkr��q�q�XndS(
s�Consolidate a bunch of CVS or RCS logs read from stdin.

Input should be the output of a CVS or RCS logging command, e.g.

    cvs log -rrelease14:

which dumps all log messages from release1.4 upwards (assuming that
release 1.4 was tagged with tag 'release14').  Note the trailing
colon!

This collects all the revision records and outputs them sorted by date
rather than by file, collapsing duplicate revision record, i.e.,
records with the same message for different files.

The -t option causes it to truncate (discard) the last revision log
entry; this is useful when using something like the above cvs log
command, which shows the revisions including the given tag, while you
probably want everything *since* that tag.

The -r option reverses the output (oldest first; the default is oldest
last).

The -b tag option restricts the output to *only* checkin messages
belonging to the given branch tag.  The form -b HEAD restricts the
output to checkin messages belonging to the CVS head (trunk).  (It
produces some output if tag is a non-branch tag, but this output is
not very useful.)

-h prints this message and exits.

XXX This code was created by reverse engineering CVS 1.9 and RCS 5.7
from their output.
i����Nt=iMs
t-ic
Cs(d}d}d	}tjtjdd�\}}xt|D]l\}}|dkrYd}q8|dkrnd}q8|dkr�|}q8|dkr8tGHtjd�q8q8Wg}xLttj�}|s�Pnt||�}	|r�|	d=n|	|t	|�)q�W|j
�|s|j�nt|�d	S(
sMain programiistrb:hs-ts-rs-bs-hi����N(
tNonetgetopttsystargvt__doc__texitt
read_chunktstdintdigest_chunktlentsorttreverset
format_output(
t
truncate_lastR
tbranchtoptstargstotatdatabasetchunktrecords((s./usr/lib64/python2.7/Tools/scripts/logmerge.pytmain*s6			


cCs�g}g}xx|j�}|s%Pn|tkrK|rG|j|�nPn|tkrv|r�|j|�g}q�q|j|�qW|S(skRead a chunk -- data for one file, ending with sep1.

    Split the chunk in parts separated by sep2.

    (treadlinetsep1tappendtsep2(tfpRtlinestline((s./usr/lib64/python2.7/Tools/scripts/logmerge.pyRHs 
cCs5|d}d}t|�}x8|D]*}|| |kr#||j�}Pq#q#Wd}|dkrfn"|dkr�tjd�}ni}d}d}x~|D]v}||kr�d}q�|r�|ddkr
|j�\}	}
|	dd	kr�|	d }	n|
||	<qd}q�q�W|j|�}
tjd
�}|
r�|
jd�dkr�|
jdd�}
tjd
tj	|
�d�}q�ng}x�|dD]�}|d}|d}
|d}|
j�}d}t|�dkr|ddkr|d}|d}|ddkr"|d }n|d|}t|�dkr�|ddkr�|d}|ddkr||d }q|q�nd}|j
d|�|j�}t|�dkr�|ddkr�|d}
nd}
|j
d|�|r|
dks�|j|
�rq�qn|j|||
||f�q�W|S(s9Digest a chunk -- extract working file name and revisionsis
Working file:tHEADs
^\d+\.\d+$ssymbolic names:
is	 i����t:s^<>$s.0.t.t^s\.\d+$iisdate:t;t isauthor:itrevisionN(
RtstripRtretcompiletsplittgettfindtreplacetescapetinserttmatchR(RRRtkeytkeylenRtworking_filet	revisionstfoundttagtrevRtrevlinetdatelinettexttwordstauthortdatewordttimewordtdate((s./usr/lib64/python2.7/Tools/scripts/logmerge.pyR
`sx


	


&


"


"
"
	 cCs�d}g}|jd�x�|D]�\}}}}}||kr�|r�tGx+|D]#\}}	}
}|G|G|	G|
GHqRWtjj|�ng}n|j||||f�|}q WdS(N(NNNNN(RRRRtstdoutt
writelines(RtprevtexttprevR?R3R7R<R:tp_datetp_working_filetp_revtp_author((s./usr/lib64/python2.7/Tools/scripts/logmerge.pyR�s
	t__main__(RRterrnoRR(RRRRRR
Rt__name__tIOErrortetEPIPE(((s./usr/lib64/python2.7/Tools/scripts/logmerge.pyt<module>#s0		E	combinerefs.pyc000064400000010240151732701210007551 0ustar00�
�fc@sTdZddlZddlZd�Zd�ZedkrPeejd�ndS(sL

combinerefs path

A helper for analyzing PYTHONDUMPREFS output.

When the PYTHONDUMPREFS envar is set in a debug build, at Python shutdown
time Py_Finalize() prints the list of all live objects twice:  first it
prints the repr() of each object while the interpreter is still fully intact.
After cleaning up everything it can, it prints all remaining live objects
again, but the second time just prints their addresses, refcounts, and type
names (because the interpreter has been torn down, calling repr methods at
this point can get into infinite loops or blow up).

Save all this output into a file, then run this script passing the path to
that file.  The script finds both output chunks, combines them, then prints
a line of output for each object still alive at the end:

    address refcnt typename repr

address is the address of the object, in whatever format the platform C
produces for a %p format code.

refcnt is of the form

    "[" ref "]"

when the object's refcount is the same in both PYTHONDUMPREFS output blocks,
or

    "[" ref_before "->" ref_after "]"

if the refcount changed.

typename is object->ob_type->tp_name, extracted from the second PYTHONDUMPREFS
output block.

repr is repr(object), extracted from the first PYTHONDUMPREFS output block.
CAUTION:  If object is a container type, it may not actually contain all the
objects shown in the repr:  the repr was captured from the first output block,
and some of the containees may have been released since then.  For example,
it's common for the line showing the dict of interned strings to display
strings that no longer exist at the end of Py_Finalize; this can be recognized
(albeit painfully) because such containees don't have a line of their own.

The objects are listed in allocation order, with most-recently allocated
printed first, and the first object allocated printed last.


Simple examples:

    00857060 [14] str '__len__'

The str object '__len__' is alive at shutdown time, and both PYTHONDUMPREFS
output blocks said there were 14 references to it.  This is probably due to
C modules that intern the string "__len__" and keep a reference to it in a
file static.

    00857038 [46->5] tuple ()

46-5 = 41 references to the empty tuple were removed by the cleanup actions
between the times PYTHONDUMPREFS produced output.

    00858028 [1025->1456] str '<dummy key>'

The string '<dummy key>', which is used in dictobject.c to overwrite a real
key that gets deleted, grew several hundred references during cleanup.  It
suggests that stuff did get removed from dicts by cleanup, but that the dicts
themselves are staying alive for some reason. i����Nccs9x2|D]*}t|j|��|kr0|VqPqWdS(N(tbooltmatch(tfileitertpatt
whilematchtline((s1/usr/lib64/python2.7/Tools/scripts/combinerefs.pytreadQs
c
Cs�t|�}t|�}x#t|tjd�t�D]}q4Wtjd�}i}i}d}xkt|tjd�t�D]N}|j|�}|r�|j�\}	||	<||	<|d7}q{dG|GHq{Wd}
x�t||t�D]�}|
d7}
|j|�}|st	�|j�\}	}}|	|krGdG|j
�GHq�n|	G|||	krfd|Gnd	||	|fG|G||	GHq�W|j�d
||
fGHdS(Ns^Remaining objects:$s([a-zA-Z\d]+) \[(\d+)\] (.*)is^Remaining object addresses:$is??? skipped:s*??? new object created while tearing down:s[%s]s[%s->%s]s%d objects before, %d after(tfiletiterRtretcompiletFalseRtgroupstTruetAssertionErrortrstriptclose(
tfnametftfiRtcracktaddr2rct	addr2gutstbeforetmtaddrtaftertrctguts((s1/usr/lib64/python2.7/Tools/scripts/combinerefs.pytcombineXs<""



t__main__i(t__doc__R	tsysRRt__name__targv(((s1/usr/lib64/python2.7/Tools/scripts/combinerefs.pyt<module>Fs		&combinerefs.pyo000064400000010177151732701210007576 0ustar00�
�fc@sTdZddlZddlZd�Zd�ZedkrPeejd�ndS(sL

combinerefs path

A helper for analyzing PYTHONDUMPREFS output.

When the PYTHONDUMPREFS envar is set in a debug build, at Python shutdown
time Py_Finalize() prints the list of all live objects twice:  first it
prints the repr() of each object while the interpreter is still fully intact.
After cleaning up everything it can, it prints all remaining live objects
again, but the second time just prints their addresses, refcounts, and type
names (because the interpreter has been torn down, calling repr methods at
this point can get into infinite loops or blow up).

Save all this output into a file, then run this script passing the path to
that file.  The script finds both output chunks, combines them, then prints
a line of output for each object still alive at the end:

    address refcnt typename repr

address is the address of the object, in whatever format the platform C
produces for a %p format code.

refcnt is of the form

    "[" ref "]"

when the object's refcount is the same in both PYTHONDUMPREFS output blocks,
or

    "[" ref_before "->" ref_after "]"

if the refcount changed.

typename is object->ob_type->tp_name, extracted from the second PYTHONDUMPREFS
output block.

repr is repr(object), extracted from the first PYTHONDUMPREFS output block.
CAUTION:  If object is a container type, it may not actually contain all the
objects shown in the repr:  the repr was captured from the first output block,
and some of the containees may have been released since then.  For example,
it's common for the line showing the dict of interned strings to display
strings that no longer exist at the end of Py_Finalize; this can be recognized
(albeit painfully) because such containees don't have a line of their own.

The objects are listed in allocation order, with most-recently allocated
printed first, and the first object allocated printed last.


Simple examples:

    00857060 [14] str '__len__'

The str object '__len__' is alive at shutdown time, and both PYTHONDUMPREFS
output blocks said there were 14 references to it.  This is probably due to
C modules that intern the string "__len__" and keep a reference to it in a
file static.

    00857038 [46->5] tuple ()

46-5 = 41 references to the empty tuple were removed by the cleanup actions
between the times PYTHONDUMPREFS produced output.

    00858028 [1025->1456] str '<dummy key>'

The string '<dummy key>', which is used in dictobject.c to overwrite a real
key that gets deleted, grew several hundred references during cleanup.  It
suggests that stuff did get removed from dicts by cleanup, but that the dicts
themselves are staying alive for some reason. i����Nccs9x2|D]*}t|j|��|kr0|VqPqWdS(N(tbooltmatch(tfileitertpatt
whilematchtline((s1/usr/lib64/python2.7/Tools/scripts/combinerefs.pytreadQs
c
Cs�t|�}t|�}x#t|tjd�t�D]}q4Wtjd�}i}i}d}xkt|tjd�t�D]N}|j|�}|r�|j�\}	||	<||	<|d7}q{dG|GHq{Wd}
x�t||t�D]�}|
d7}
|j|�}|j�\}	}}|	|kr;dG|j	�GHq�n|	G|||	krZd|Gnd	||	|fG|G||	GHq�W|j
�d
||
fGHdS(Ns^Remaining objects:$s([a-zA-Z\d]+) \[(\d+)\] (.*)is^Remaining object addresses:$is??? skipped:s*??? new object created while tearing down:s[%s]s[%s->%s]s%d objects before, %d after(tfiletiterRtretcompiletFalseRtgroupstTruetrstriptclose(
tfnametftfiRtcracktaddr2rct	addr2gutstbeforetmtaddrtaftertrctguts((s1/usr/lib64/python2.7/Tools/scripts/combinerefs.pytcombineXs:""



t__main__i(t__doc__R	tsysRRt__name__targv(((s1/usr/lib64/python2.7/Tools/scripts/combinerefs.pyt<module>Fs		&classfix.pyo000064400000010135151732701210007110 0ustar00�
�fc@s�ddlZddlZddlZddlTejjZeZejjZ	d�Z
ejd�Zd�Z
d�Zd�ZdZeje�Zd	Zeje�Zd
�Zedkr�e
�ndS(i����N(t*cCs�d}tjds<tdtjdd�tjd�nx}tjdD]n}tjj|�rzt|�r�d}q�qJtjj|�r�t|d�d}qJt	|�rJd}qJqJWtj|�dS(Niisusage: s file-or-directory ...
is": will not process symbolic links
(
tsystargvterrtexittostpathtisdirtrecursedowntislinktfix(tbadtarg((s./usr/lib64/python2.7/Tools/scripts/classfix.pytmain)s
	
s^[a-zA-Z0-9_]+\.py$cCstj|�dkS(Ni(tispythonprogtmatch(tname((s./usr/lib64/python2.7/Tools/scripts/classfix.pytispython9scCs1td|f�d}ytj|�}Wn+tjk
rW}td||f�dSX|j�g}x�|D]�}|tjtjfkr�qontjj	||�}tjj
|�r�qotjj|�r�|j|�qot
|�rot|�rd}qqoqoWx#|D]}t|�rd}qqW|S(Nsrecursedown(%r)
is%s: cannot list directory: %r
i(tdbgRtlistdirterrorRtsorttcurdirtpardirRtjoinR	RtappendRR
R(tdirnameRtnamestmsgtsubdirsRtfullname((s./usr/lib64/python2.7/Tools/scripts/classfix.pyR<s0



cCs�yt|d�}Wn(tk
r=}td||f�dSXtjj|�\}}tjj|d|�}d}d}xG|j�}|s�Pn|d}x>|ddkr�|j�}	|	s�Pn||	}|d}q�Wt	|�}
|
|kr�|dkrryt|d�}Wn2tk
rJ}|j
�td	||f�dSX|jd�d}t|d
�q~ntt
|�d�td|�td
|
�n|dk	r~|j|
�q~q~W|j
�|s�dSy+tj|�}tj||td@�Wn*tjk
r0}td||f�nXytj||d�Wn*tjk
ru}td||f�nXytj||�Wn+tjk
r�}td||f�dSXdS(Ntrs%s: cannot open: %r
it@ii����s\
tws%s: cannot create: %r
s:
s
s< s> i�s%s: warning: chmod failed (%r)
t~s %s: warning: backup failed (%r)
s%s: rename failed (%r)
(topentIOErrorRRRtsplitRtNonetreadlinetfixlinetclosetseektreptreprtwritetstattchmodtST_MODERtrename(tfilenametfRtheadttailttempnametgtlinenotlinetnextlinetnewlinetstatbuf((s./usr/lib64/python2.7/Tools/scripts/classfix.pyR
Rsp




s-^([ 	]*class +[a-zA-Z0-9_]+) *( *) *((=.*)?):s^ *(.*) *( *) *$cCstj|�dkr|Stjd \\}}\}}\}}|| }||}||krm|d|S||d|!}	|	jd�}
x^tt|
��D]J}tj|
|�dkr�tjd\}}
|
|||
!|
|<q�q�Wdj|
�}	|d|	d|S(	Niit:it,s, t(s):(t	classprogRtregsR%trangetlentbaseprogR(R9ta0tb0ta1tb1ta2tb2R4R5tbaseparttbasestitx1ty1((s./usr/lib64/python2.7/Tools/scripts/classfix.pyR(�s(

t__main__(RtreRR.tstderrR-RRtstdoutR+R
tcompileRRRR
t	classexprR@tbaseexprRDR(t__name__(((s./usr/lib64/python2.7/Tools/scripts/classfix.pyt<module> s$
				E	ndiff.pyo000064400000007423151732701210006370 0ustar00�
�fc@s�dZdZddlZddlZd�Zd�Zd�Zd	�Zd
�Ze	dkr�ej
dZdekr�ddlZddl
Z
ejd�d
Zejde�e
je�Zej�jd�j�q�ee�ndS(s�ndiff [-q] file1 file2
    or
ndiff (-r1 | -r2) < ndiff_output > file1_or_file2

Print a human-friendly file difference report to stdout.  Both inter-
and intra-line differences are noted.  In the second form, recreate file1
(-r1) or file2 (-r2) on stdout, from an ndiff report on stdin.

In the first form, if -q ("quiet") is not specified, the first two lines
of output are

-: file1
+: file2

Each remaining line begins with a two-letter code:

    "- "    line unique to file1
    "+ "    line unique to file2
    "  "    line common to both files
    "? "    line not present in either input file

Lines beginning with "? " attempt to guide the eye to intraline
differences, and were not present in either input file.  These lines can be
confusing if the source files contain tab characters.

The first file can be recovered by retaining only lines that begin with
"  " or "- ", and deleting those 2-character prefixes; use ndiff with -r1.

The second file can be recovered similarly, but by retaining only "  " and
"+ " lines; use ndiff with -r2; or, on Unix, the second file can be
recovered by piping the output through

    sed -n '/^[+ ] /s/^..//p'
iiii����NcCs(tjj}||d�|t�dS(Ns

i(tsyststderrtwritet__doc__(tmsgtout((s+/usr/lib64/python2.7/Tools/scripts/ndiff.pytfail5s
cCsDyt|d�SWn,tk
r?}td|dt|��SXdS(NtUscouldn't open s: (topentIOErrorRtstr(tfnametdetail((s+/usr/lib64/python2.7/Tools/scripts/ndiff.pytfopen=scCs{t|�}t|�}|s&|r*dS|j�}|j�|j�}|j�xtj||�D]
}|GqiWdS(Nii(R
t	readlinestclosetdifflibtndiff(tf1nametf2nametf1tf2tatbtline((s+/usr/lib64/python2.7/Tools/scripts/ndiff.pytfcompareDs

cCsKddl}y|j|d�\}}Wn#|jk
rM}tt|��SXd}d}}xJ|D]B\}}|dkr�d}d}qe|dkred}|}	qeqeW|r�|r�td�S|r�|r�td�S|	dkr�t|	�dStd�St|�dkrtd
�S|\}
}|r>dG|
GHdG|GHnt|
|�S(Ni����sqr:iis-qs-rscan't specify both -q and -rsno args allowed with -r optiont1t2s-r value must be 1 or 2isneed 2 filename argss-:s+:(RR(tgetoptterrorRR
trestoretlenR(targsRtoptsRtnoisytqseentrseentopttvalt	whichfileRR((s+/usr/lib64/python2.7/Tools/scripts/ndiff.pytmainTs<
	





	cCs/tjtjj�|�}tjj|�dS(N(RRRtstdinRtstdoutt
writelines(twhichtrestored((s+/usr/lib64/python2.7/Tools/scripts/ndiff.pyRwst__main__s-profiles	ndiff.pros
main(args)ttime(iii(Rt__version__RRRR
RR(Rt__name__targvR tprofiletpstatstremovetstatftruntStatststatst
strip_dirst
sort_statstprint_stats(((s+/usr/lib64/python2.7/Tools/scripts/ndiff.pyt<module>/s"				#	

crlf.pyo000064400000001527151732701210006227 0ustar00�
�fc@sAdZddlZddlZd�Zedkr=e�ndS(sFReplace CRLF with LF in argument files.  Print names of changed files.i����NcCs�x�tjdD]�}tjj|�r5|GdGHqnt|d�j�}d|kre|GdGHqn|jdd�}||kr|GHt|d�}|j|�|j	�qqWdS(	Nis
Directory!trbssBinary!s
s
twb(
tsystargvtostpathtisdirtopentreadtreplacetwritetclose(tfilenametdatatnewdatatf((s*/usr/lib64/python2.7/Tools/scripts/crlf.pytmains		
t__main__(t__doc__RRRt__name__(((s*/usr/lib64/python2.7/Tools/scripts/crlf.pyt<module>s	cvsfiles.pyo000064400000004163151732701210007116 0ustar00�
�fc@sqdZddlZddlZddlZddlZdad�Zd�Zd�Ze	dkrme�ndS(sDPrint a list of files that are mentioned in CVS directories.

Usage: cvsfiles.py [-n file] [directory] ...

If the '-n file' option is given, only files under CVS that are newer
than the given file are printed; by default, all files under CVS are
printed.  As a special case, if a file does not exist, it is always
printed.
i����NicCs�y#tjtjdd�\}}Wn tjk
rE}|GHtGdSXd}x/|D]'\}}|dkrSt|�aqSqSW|r�x%|D]}t|�q�Wn
td�dS(Nisn:s-nt.(	tgetopttsystargvterrort__doc__tNonetgetmtimet
cutofftimetprocess(toptstargstmsgt	newerfiletotatarg((s./usr/lib64/python2.7/Tools/scripts/cvsfiles.pytmains#
c
CsRd}g}tj|�}xo|D]g}tjj||�}|dkrR|}q"tjj|�r"tjj|�s�|j|�q�q"q"W|r3tjj|d�}x�t|�j�D]q}|j	d�}|ddkr�|dr�|d}tjj||�}t
r$t|�t
kr$q,|GHq�q�Wnx|D]}	t|	�q:WdS(NitCVStEntriest/ti(
tostlistdirtpathtjointisdirtislinktappendtopent	readlinestsplitRRR	(
tdirtcvsdirtsubdirstnamestnametfullnametentriestetwordstsub((s./usr/lib64/python2.7/Tools/scripts/cvsfiles.pyR	&s,
	

cCs6ytj|�}Wntjk
r*dSX|tjS(Ni(RtstatRtST_MTIME(tfilenametst((s./usr/lib64/python2.7/Tools/scripts/cvsfiles.pyR@s
t__main__(
RRRR*RRRR	Rt__name__(((s./usr/lib64/python2.7/Tools/scripts/cvsfiles.pyt<module>s			pysource.py000075500000007406151732701210007000 0ustar00#! /usr/bin/python2.7

"""\
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.
"""
__author__ = "Oleg Broytmann, Georg Brandl"

__all__ = ["has_python_ext", "looks_like_python", "can_be_compiled", "walk_python_files"]


import os, re

binary_re = re.compile('[\x00-\x08\x0E-\x1F\x7F]')

debug = False

def print_debug(msg):
    if debug: print msg


def _open(fullpath):
    try:
        size = os.stat(fullpath).st_size
    except OSError, err: # Permission denied - ignore the file
        print_debug("%s: permission denied: %s" % (fullpath, err))
        return None

    if size > 1024*1024: # too big
        print_debug("%s: the file is too big: %d bytes" % (fullpath, size))
        return None

    try:
        return open(fullpath, 'rU')
    except IOError, err: # Access denied, or a special file - ignore it
        print_debug("%s: access denied: %s" % (fullpath, err))
        return None

def has_python_ext(fullpath):
    return fullpath.endswith(".py") or fullpath.endswith(".pyw")

def looks_like_python(fullpath):
    infile = _open(fullpath)
    if infile is None:
        return False

    line = infile.readline()
    infile.close()

    if binary_re.search(line):
        # file appears to be binary
        print_debug("%s: appears to be binary" % fullpath)
        return False

    if fullpath.endswith(".py") or fullpath.endswith(".pyw"):
        return True
    elif "python" in line:
        # disguised Python script (e.g. CGI)
        return True

    return False

def can_be_compiled(fullpath):
    infile = _open(fullpath)
    if infile is None:
        return False

    code = infile.read()
    infile.close()

    try:
        compile(code, fullpath, "exec")
    except Exception, err:
        print_debug("%s: cannot compile: %s" % (fullpath, err))
        return False

    return True


def walk_python_files(paths, is_python=looks_like_python, exclude_dirs=None):
    """\
    Recursively yield all Python source files below the given paths.

    paths: a list of files and/or directories to be checked.
    is_python: a function that takes a file name and checks whether it is a
               Python source file
    exclude_dirs: a list of directory base names that should be excluded in
                  the search
    """
    if exclude_dirs is None:
        exclude_dirs=[]

    for path in paths:
        print_debug("testing: %s" % path)
        if os.path.isfile(path):
            if is_python(path):
                yield path
        elif os.path.isdir(path):
            print_debug("    it is a directory")
            for dirpath, dirnames, filenames in os.walk(path):
                for exclude in exclude_dirs:
                    if exclude in dirnames:
                        dirnames.remove(exclude)
                for filename in filenames:
                    fullpath = os.path.join(dirpath, filename)
                    print_debug("testing: %s" % fullpath)
                    if is_python(fullpath):
                        yield fullpath
        else:
            print_debug("    unknown type")


if __name__ == "__main__":
    # Two simple examples/tests
    for fullpath in walk_python_files(['.']):
        print fullpath
    print "----------"
    for fullpath in walk_python_files(['.'], is_python=can_be_compiled):
        print fullpath
combinerefs.py000075500000010434151732701210007416 0ustar00#! /usr/bin/python2.7

"""
combinerefs path

A helper for analyzing PYTHONDUMPREFS output.

When the PYTHONDUMPREFS envar is set in a debug build, at Python shutdown
time Py_Finalize() prints the list of all live objects twice:  first it
prints the repr() of each object while the interpreter is still fully intact.
After cleaning up everything it can, it prints all remaining live objects
again, but the second time just prints their addresses, refcounts, and type
names (because the interpreter has been torn down, calling repr methods at
this point can get into infinite loops or blow up).

Save all this output into a file, then run this script passing the path to
that file.  The script finds both output chunks, combines them, then prints
a line of output for each object still alive at the end:

    address refcnt typename repr

address is the address of the object, in whatever format the platform C
produces for a %p format code.

refcnt is of the form

    "[" ref "]"

when the object's refcount is the same in both PYTHONDUMPREFS output blocks,
or

    "[" ref_before "->" ref_after "]"

if the refcount changed.

typename is object->ob_type->tp_name, extracted from the second PYTHONDUMPREFS
output block.

repr is repr(object), extracted from the first PYTHONDUMPREFS output block.
CAUTION:  If object is a container type, it may not actually contain all the
objects shown in the repr:  the repr was captured from the first output block,
and some of the containees may have been released since then.  For example,
it's common for the line showing the dict of interned strings to display
strings that no longer exist at the end of Py_Finalize; this can be recognized
(albeit painfully) because such containees don't have a line of their own.

The objects are listed in allocation order, with most-recently allocated
printed first, and the first object allocated printed last.


Simple examples:

    00857060 [14] str '__len__'

The str object '__len__' is alive at shutdown time, and both PYTHONDUMPREFS
output blocks said there were 14 references to it.  This is probably due to
C modules that intern the string "__len__" and keep a reference to it in a
file static.

    00857038 [46->5] tuple ()

46-5 = 41 references to the empty tuple were removed by the cleanup actions
between the times PYTHONDUMPREFS produced output.

    00858028 [1025->1456] str '<dummy key>'

The string '<dummy key>', which is used in dictobject.c to overwrite a real
key that gets deleted, grew several hundred references during cleanup.  It
suggests that stuff did get removed from dicts by cleanup, but that the dicts
themselves are staying alive for some reason. """

import re
import sys

# Generate lines from fileiter.  If whilematch is true, continue reading
# while the regexp object pat matches line.  If whilematch is false, lines
# are read so long as pat doesn't match them.  In any case, the first line
# that doesn't match pat (when whilematch is true), or that does match pat
# (when whilematch is false), is lost, and fileiter will resume at the line
# following it.
def read(fileiter, pat, whilematch):
    for line in fileiter:
        if bool(pat.match(line)) == whilematch:
            yield line
        else:
            break

def combine(fname):
    f = file(fname)
    fi = iter(f)

    for line in read(fi, re.compile(r'^Remaining objects:$'), False):
        pass

    crack = re.compile(r'([a-zA-Z\d]+) \[(\d+)\] (.*)')
    addr2rc = {}
    addr2guts = {}
    before = 0
    for line in read(fi, re.compile(r'^Remaining object addresses:$'), False):
        m = crack.match(line)
        if m:
            addr, addr2rc[addr], addr2guts[addr] = m.groups()
            before += 1
        else:
            print '??? skipped:', line

    after = 0
    for line in read(fi, crack, True):
        after += 1
        m = crack.match(line)
        assert m
        addr, rc, guts = m.groups() # guts is type name here
        if addr not in addr2rc:
            print '??? new object created while tearing down:', line.rstrip()
            continue
        print addr,
        if rc == addr2rc[addr]:
            print '[%s]' % rc,
        else:
            print '[%s->%s]' % (addr2rc[addr], rc),
        print guts, addr2guts[addr]

    f.close()
    print "%d objects before, %d after" % (before, after)

if __name__ == '__main__':
    combine(sys.argv[1])
fixnotice.pyo000064400000006654151732701210007277 0ustar00�
�fc@szdZdaddlZddlZddlZdadadadd�Zd�Z	d�Z
ed	krve	�ndS(
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����NticCs+tt�GH|r|GHntj|�dS(N(t__doc__tglobalstsystexit(tcodetmsg((s//usr/lib64/python2.7/Tools/scripts/fixnotice.pytusage4scCs6y5tjtjdddddddg�\}}Wn#tjk
rZ}td|�nXx�|D]�\}}|dkr�td
�qb|dkr�daqb|d
kr�daqb|dkr�t|�}|j�a	|j
�qb|dkrbt|�}|j�a|j
�qbqbWx|D]}t|�qWdS(Nithvthelps
oldnotice=s
newnotice=sdry-runtverboses-hs--helpis-vs	--verboses	--dry-runs--oldnotices--newnotice(s-hs--help(s-vs	--verbose(
tgetoptRtargvterrorRtVERBOSEtDRYRUNtopentreadt
OLD_NOTICEtcloset
NEW_NOTICEtprocess(toptstargsRtopttargtfp((s//usr/lib64/python2.7/Tools/scripts/fixnotice.pytmain;s.	
		

cCs�t|�}|j�}|j�|jt�}|dkrStrOdG|GHndSts_trkdG|GHntrudS|| t||tt�}|d}|d}t|d�}|j	|�|j�t
j||�t
j||�dS(Nis
no change:s
   change:s.news.baktw(RRRtfindRRRRtlentwritetostrename(tfiletftdatatitnewtbackup((s//usr/lib64/python2.7/Tools/scripts/fixnotice.pyRXs(
 



t__main__(RRR RRRRRRRRt__name__(((s//usr/lib64/python2.7/Tools/scripts/fixnotice.pyt<module>s		win_add2path.pyo000064400000004025151732701210007641 0ustar00�
�fc@s}dZddlZddlZddlZddlZejZdZdZdZ	d�Z
d�Zedkrye�ndS(	sAdd Python to the search path on Windows

This is a simple script to add Python to the Windows search path. It
modifies the current user (HKCU) tree of the registry.

Copyright (c) 2008 by Christian Heimes <christian@cheimes.de>
Licensed to PSF under a Contributor Agreement.
i����NtEnvironmenttPATHu%PATH%c	
Csgtjjtjjtj��}tjj|d�}tjd}tt	d�rt	j
j|d�}tjj|d�}nd}t
jtt���}yt
j|t�d}Wntk
r�t}nX|g}xK|||fD]:}|r�||kr�tjj|�r�|j|�q�q�Wtjj|�}t
j|tdt
j|�||fSWdQXdS(NtScriptstAPPDATAt	USER_SITEs	%APPDATA%i(tostpathtdirnametnormpathtsyst
executabletjointenvironthasattrtsiteRtreplacetNonet_winregt	CreateKeytHKCUtENVtQueryValueExRtWindowsErrortDEFAULTtisdirtappendtpathsept
SetValueExt
REG_EXPAND_SZ(	t
pythonpathtscriptstappdatatuserpathtuserscriptstkeytenvpathtpathsR((s2/usr/lib64/python2.7/Tools/scripts/win_add2path.pytmodifys&!


	$cCs`t�\}}t|�dkr;dGHdj|d�GHndGHd|GHdGHtj|�GHdS(NisPath(s) added:s
sNo path was addeds
PATH is now:
%s
s	Expanded:(R%tlenRRtExpandEnvironmentStrings(R$R#((s2/usr/lib64/python2.7/Tools/scripts/win_add2path.pytmain-s	t__main__(
t__doc__R	RRRtHKEY_CURRENT_USERRRRRR%R(t__name__(((s2/usr/lib64/python2.7/Tools/scripts/win_add2path.pyt<module>s			checkpip.pyc000064400000002024151732701210007044 0ustar00�
�fc@sYdZddlZddlZddlZddlZd�ZedkrUe�ndS(sa
Checks that the version of the projects bundled in ensurepip are the latest
versions available.
i����NcCs�t}x~tjD]s\}}tjtjdj|��j�j	d��}|dd}||krt
}dj|||�GHqqW|r�tjd�ndS(Ns$https://pypi.python.org/pypi/{}/jsontutf8tinfotversions<The latest version of {} on PyPI is {}, but ensurepip has {}i(
tFalset	ensurepipt	_PROJECTStjsontloadsturllib2turlopentformattreadtdecodetTruetsystexit(t	outofdatetprojectRtdatatupstream_version((s./usr/lib64/python2.7/Tools/scripts/checkpip.pytmainst__main__(t__doc__RRRRRt__name__(((s./usr/lib64/python2.7/Tools/scripts/checkpip.pyt<module>s	copytime.pyo000064400000001651151732701210007130 0ustar00�
�fc@sQddlZddlZddlmZmZd�ZedkrMe�ndS(i����N(tST_ATIMEtST_MTIMEcCs�ttj�dkr5tjjd�tjd�ntjdtjd}}ytj|�}Wn5tjk
r�tjj|d�tjd�nXy"tj	||t
|tf�Wn5tjk
r�tjj|d�tjd�nXdS(Nis#usage: copytime source destination
iis: cannot stat
s: cannot change time
(tlentsystargvtstderrtwritetexittoststatterrortutimeRR(tfile1tfile2tstat1((s./usr/lib64/python2.7/Tools/scripts/copytime.pytmain	s"t__main__(RRR	RRRt__name__(((s./usr/lib64/python2.7/Tools/scripts/copytime.pyt<module>s
	pdeps.pyo000064400000006224151732701210006413 0ustar00�
�fc@s�ddlZddlZddlZd�Zejd�Zejd�Zd�Zd�Zd�Z	d�Z
d	�Zed
kr�yej
e��Wq�ek
r�ej
d�q�XndS(i����NcCs�tjd}|sdGHdSi}x|D]}t||�q)WdGHt|�dGHt|�}t|�dGHt|�}t|�dGHt|�}t|�dS(	Nis usage: pdeps file.py file.py ...is--- Uses ---s--- Used By ---s--- Closure of Uses ---s--- Closure of Used By ---i(tsystargvtprocesstprintresultstinversetclosure(targsttabletargtinvtreachtinvreach((s+/usr/lib64/python2.7/Tools/scripts/pdeps.pytmains&





s^[ 	]*from[ 	]+([^ 	]+)[ 	]+s^[ 	]*import[ 	]+([^#]+)c
Csht|d�}tjj|�}|ddkr>|d }ng||<}x|j�}|sePnx8|ddkr�|j�}|s�Pn|d |}qhWtj|�dkr�tjd \\}}\}	}
n:tj|�dkrOtjd \\}}\}	}
nqO||	|
!j	d�}x6|D].}|j
�}||kr.|j|�q.q.WqOWdS(	Ntri����s.pyi����s\iit,(topentostpathtbasenametreadlinetm_importtmatchtregstm_fromtsplittstriptappend(
tfilenameRtfptmodtlisttlinetnextlinetatbta1tb1twordstword((s+/usr/lib64/python2.7/Tools/scripts/pdeps.pyRBs0
""
cCs�|j�}i}x|D]}||||<qWd}x�|r�d}xq|D]i}x`||D]T}||kr_x?||D]0}|||kr|||j|�d}q|q|Wq_q_WqNWq;W|S(Nii(tkeysR(RtmodulesR
Rtchangetmotm((s+/usr/lib64/python2.7/Tools/scripts/pdeps.pyR^s
	
cCsbi}xU|j�D]G}|j|�s5g||<nx"||D]}t|||�q@WqW|S(N(R'thas_keytstore(RR	tkeytitem((s+/usr/lib64/python2.7/Tools/scripts/pdeps.pyR{s
cCs4|j|�r#||j|�n
|g||<dS(N(R,R(tdictR.R/((s+/usr/lib64/python2.7/Tools/scripts/pdeps.pyR-�scCs�|j�}d}x#|D]}t|t|��}qW|j�x\|D]T}||}|j�|j|�GdG||kr�dGnx|D]
}|Gq�WHqIWdS(Nit:s(*)(R'tmaxtlentsorttljust(RR(tmaxlenRRtref((s+/usr/lib64/python2.7/Tools/scripts/pdeps.pyR�s





t__main__i(RtreRRtcompileRRRRRR-Rt__name__texittKeyboardInterrupt(((s+/usr/lib64/python2.7/Tools/scripts/pdeps.pyt<module>s							
patchcheck.pyo000064400000021650151732701210007375 0ustar00�
�fc@sddlZddlZddlZddlZddlZddlZddlZddlZej	j
ddd�ej	j
ddd�ej	j
ddd�ej	j
dd�ej	j
dd�gZejd	�Z
d
�Zedd�Zd�Zd
�Zeddd��d��Zeddd��dd��Zd�Zedde�d��Zedde�d��Zejd�Zedde�d��Zedde�d��Zed de�d!��Zed"de�d#��Zd$�Z e!d%kre �ndS(&i����NtModulest_ctypestlibffit
libffi_osxtlibffi_msvctexpattzlibtsrcdircCs"dj||dkrdnd�S(s7Return 'N file(s)' with the proper plurality on 'file'.s	{} file{}itst(tformat(tcount((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytn_files_strscs���fd�}|S(s*Decorator to output status info to stdout.cs����fd�}|S(Ncsotjj�d�tjj��||�}�rF�rFdGHn%�rZ�|�GHn|rfdndGH|S(Ns ... tdonetyestNO(tsyststdouttwritetflush(targstkwargstresult(tfxntinfotmessagetmodal(s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytcall_fxns
((RR(RRR(Rs0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyt
decorated_fxns((RRRR((RRRs0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytstatuss
cCsBdj�}ytj|dtj�SWntjk
r=dSXdS(s0Get the symbolic name for the current git branchsgit rev-parse --abbrev-ref HEADtstderrN(tsplitt
subprocesstcheck_outputtPIPEtCalledProcessErrortNone(tcmd((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytget_git_branch.s
cCsBdj�}ytj|dtj�Wntjk
r=dSXdS(skGet the remote name to use for upstream branches

    Uses "upstream" if it exists, "origin" otherwise
    sgit remote get-url upstreamRtorigintupstream(RR R!R"R#(R%((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytget_git_upstream_remote7ssGetting base branch for PRRcCs|dk	r|SdS(Nsnot a PR branch(R$(tx((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyt<lambda>ER	cCs�tjjtjjtd��s%dStj}|jdkrFd}ndj	|�}t
�}|dksv||krzdSt�}|d|S(Ns.gittalphatmasters{0.major}.{0.minor}t/(tostpathtexiststjointSRCDIRR$Rtversion_infotreleaselevelR
R&R)(tversiontbase_branchtthis_branchtupstream_remote((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytget_base_branchDs!				s6Getting the list of files that have been added/changedcCstt|��S(N(Rtlen(R*((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyR+XR	csvtjjtjjtd��r
|r4d|}nd}g}tj|j�dtj�}z�x�|j	D]�}|j
�j�}|jd	d�\}�t
|�}|jd�s�qknd�kr��jdd�dj��n|j��qkWWd	|j	j�Xn
tjd
�g}xO|D]G�tjj���t�fd�tD��raq'n|j��q'W|S(s0Get the list of changed or added files from git.s.gitsgit diff --name-status sgit status --porcelainRitMAUs -> iNs)need a git checkout to get modified filesc3s|]}�j|�VqdS(N(t
startswith(t.0R0(tfilename(s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pys	<genexpr>zs(R/R0R1R2R3R tPopenRR"RtdecodetrstripR$tsettintersectiontstriptappendtcloseRtexittnormpathtanytEXCLUDE_DIRS(R7R%t	filenameststtlinetstatus_textRt
filenames2((R?s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyt
changed_filesWs2!


cCsrt|�}|dkr"t|�Sdjt|��g}x$|D]}|jdj|��qAWdj|�SdS(Nis{}:s  {}s
(R;RR
RFR2(t
file_pathsRtlinesR0((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytreport_modified_files�s

sFixing whitespacecCs\tt_g}xFd�|D�D]4}tjtjjt|��r |j|�q q W|S(sAMake sure that the whitespace for .py files have been normalized.css$|]}|jd�r|VqdS(s.pyN(tendswith(R>R*((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pys	<genexpr>�s(	tFalsetreindentt
makebackuptcheckR/R0R2R3RF(RRtfixedR0((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytnormalize_whitespace�s	sFixing C file whitespacecCs�g}xv|D]n}tjjt|�}t|d��}d|j�krRw
nWdQXtj|ddt�|j	|�q
W|S(sReport if any C files trs	Nitverbose(
R/R0R2R3topentreadtuntabifytprocessRVRF(RRRZR0tabspathtf((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytnormalize_c_whitespace�s
s\s+(\r?\n)$sFixing docs whitespacec	Cs�g}x�|D]�}tjjt|�}y�t|d��}|j�}WdQXg|D]}tjd|�^qV}||kr�tj	||d�t|d��}|j
|�WdQX|j|�nWq
tk
r�}d||fGHq
Xq
W|S(Ntrbs\1s.baktwbsCannot fix %s: %s(
R/R0R2R3R^t	readlinestws_retsubtshutiltcopyfilet
writelinesRFt	Exception(	RRRZR0RbRcRSRNt	new_linesterr((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytnormalize_docs_whitespace�s
%s
Docs modifiedRcCs
t|�S(s9Report if any file in the Doc directory has been changed.(tbool(RR((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyt
docs_modified�ssMisc/ACKS updatedcCstjjdd�|kS(s$Check if Misc/ACKS has been changed.tMisctACKS(R/R0R2(RR((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytcredit_given�ss Misc/NEWS.d updated with `blurb`cCstd�|D��S(s&Check if Misc/NEWS.d has been changed.css0|]&}|jtjjddd��VqdS(RssNEWS.dtnextN(R=R/R0R2(R>tp((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pys	<genexpr>�s(RJ(RR((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyt
reported_news�s	cCst�}t|�}g|D]}|jd�r|^q}g|D]}|jd�rD|^qD}g|D]*}|jd�rl|jd�rl|^ql}d�|D�}t|�t|�t|�t|�t|�t	|�|s�|r|rdnd	}Hd
|GHndS(
Ns.pys.cs.htDocs.rsts.inccSs%h|]}|jd�r|�qS(Rs(R=(R>Rw((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pys	<setcomp>�s	s and check for refleaks?t?sDid you run the test suite(s.cs.h(s.rsts.inc(
R:RQRUR=R[RdRpRrRuRx(R7RRtfntpython_filestc_filest	doc_filest
misc_filestend((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytmain�s"	((





t__main__("treRRjtos.pathR/R t	sysconfigRWR`R0R2RKtget_config_varR3RRVR$RR&R)R:RQRTR[RdtcompileRhRptTrueRrRuRxR�t__name__(((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyt<module>sB				
			)		methfix.pyc000064400000010035151732701210006723 0ustar00�
�fc@s�ddlZddlZddlZddlTejjZeZejjZ	d�Z
ejd�Zd�Z
d�Zd�ZdZeje�Zd	�Zed
kr�e
�ndS(i����N(t*cCs�d}tjds<tdtjdd�tjd�nx}tjdD]n}tjj|�rzt|�r�d}q�qJtjj|�r�t|d�d}qJt	|�rJd}qJqJWtj|�dS(Niisusage: s file-or-directory ...
is": will not process symbolic links
(
tsystargvterrtexittostpathtisdirtrecursedowntislinktfix(tbadtarg((s-/usr/lib64/python2.7/Tools/scripts/methfix.pytmain&s
	
s^[a-zA-Z0-9_]+\.py$cCstj|�dkS(Ni(tispythonprogtmatch(tname((s-/usr/lib64/python2.7/Tools/scripts/methfix.pytispython6scCs1td|f�d}ytj|�}Wn+tjk
rW}td||f�dSX|j�g}x�|D]�}|tjtjfkr�qontjj	||�}tjj
|�r�qotjj|�r�|j|�qot
|�rot|�rd}qqoqoWx#|D]}t|�rd}qqW|S(Nsrecursedown(%r)
is%s: cannot list directory: %r
i(tdbgRtlistdirterrorRtsorttcurdirtpardirRtjoinR	RtappendRR
R(tdirnameRtnamestmsgtsubdirsRtfullname((s-/usr/lib64/python2.7/Tools/scripts/methfix.pyR9s0



c
Cs�yt|d�}Wn(tk
r=}td||f�dSXtjj|�\}}tjj|d|�}d}d}x|j�}|s�Pn|d}|dkr�d|kr�t|d�|j	�dS|dkrc|dkrc|d d	krc|dj�}	|	rct
jd
|	d�dkrc|d|	d}|d}t|�|j	�dSnx>|d
dkr�|j�}
|
s�Pn||
}|d}qfWt|�}||krj|dkr7yt|d�}Wn2tk
r}|j	�td||f�dSX|j
d�d}t|d�q~ntt|�d�td|�td|�n|dk	r~|j|�q~q~W|j	�|s�dSy+tj|�}tj||td@�Wn*tjk
r�}td||f�nXytj||d�Wn*tjk
r:}td||f�nXytj||�Wn+tjk
r|}td||f�dSXdS(Ntrs%s: cannot open: %r
it@iss!: contains null bytes; not fixed
is#!s	[pP]ythons: s script; not fixed
i����s\
tws%s: cannot create: %r
s:
s
s< s> i�s%s: warning: chmod failed (%r)
t~s %s: warning: backup failed (%r)
s%s: rename failed (%r)
(topentIOErrorRRRtsplitRtNonetreadlinetclosetretsearchtfixlinetseektreptreprtwritetstattchmodtST_MODERtrename(
tfilenametfRtheadttailttempnametgtlinenotlinetwordstnextlinetnewlinetstatbuf((s-/usr/lib64/python2.7/Tools/scripts/methfix.pyR
Os�

("






s8^[ 	]+def +[a-zA-Z0-9_]+ *( *self *, *(( *(.*) *)) *) *:cCs[tj|�dkrWtjdd!\\}}\}}|| |||!||}n|S(Niii(tfixprogRtregs(R;tatbtctd((s-/usr/lib64/python2.7/Tools/scripts/methfix.pyR+�s" t__main__(RR)RR0tstderrR/RRtstdoutR-R
tcompileRRRR
tfixpatR@R+t__name__(((s-/usr/lib64/python2.7/Tools/scripts/methfix.pyt<module>s 
				R	dutree.py000075500000003117151732701220006413 0ustar00#! /usr/bin/python2.7
# Format du output in a tree shape

import os, sys, errno

def main():
    p = os.popen('du ' + ' '.join(sys.argv[1:]), 'r')
    total, d = None, {}
    for line in p.readlines():
        i = 0
        while line[i] in '0123456789': i = i+1
        size = eval(line[:i])
        while line[i] in ' \t': i = i+1
        filename = line[i:-1]
        comps = filename.split('/')
        if comps[0] == '': comps[0] = '/'
        if comps[len(comps)-1] == '': del comps[len(comps)-1]
        total, d = store(size, comps, total, d)
    try:
        display(total, d)
    except IOError, e:
        if e.errno != errno.EPIPE:
            raise

def store(size, comps, total, d):
    if comps == []:
        return size, d
    if not d.has_key(comps[0]):
        d[comps[0]] = None, {}
    t1, d1 = d[comps[0]]
    d[comps[0]] = store(size, comps[1:], t1, d1)
    return total, d

def display(total, d):
    show(total, d, '')

def show(total, d, prefix):
    if not d: return
    list = []
    sum = 0
    for key in d.keys():
        tsub, dsub = d[key]
        list.append((tsub, key))
        if tsub is not None: sum = sum + tsub
##  if sum < total:
##      list.append((total - sum, os.curdir))
    list.sort()
    list.reverse()
    width = len(repr(list[0][0]))
    for tsub, key in list:
        if tsub is None:
            psub = prefix
        else:
            print prefix + repr(tsub).rjust(width) + ' ' + key
            psub = prefix + ' '*(width-1) + '|' + ' '*(len(key)+1)
        if d.has_key(key):
            show(tsub, d[key][1], psub)

if __name__ == '__main__':
    main()
findlinksto.pyo000064400000002621151732701220007622 0ustar00�
�fc@s\ddlZddlZddlZddlZd�Zd�ZedkrXe�ndS(i����NcCs�yJtjtjdd�\}}t|�dkrItjdd��nWn9tjk
r�}tjt_|GHdGHtjd�nX|d|d}}t	j
|�}x$|D]}tjj
|t|�q�WdS(Nitisnot enough argumentss(usage: findlinksto pattern directory ...i(tgetopttsystargvtlentGetoptErrortNonetstderrtstdouttexittretcompiletostpathtwalktvisit(toptstargstmsgtpattdirstprogtdirname((s1/usr/lib64/python2.7/Tools/scripts/findlinksto.pytmains
cCs�tjj|�rg|(dStjj|�r;dG|GHnxr|D]j}tjj||�}y8tj|�}|j|�dk	r�|GdG|GHnWqBtjk
r�qBXqBWdS(Nsdescend intos->(	RR
tislinktismounttjointreadlinktsearchRterror(RRtnamestnametlinkto((s1/usr/lib64/python2.7/Tools/scripts/findlinksto.pyRs
t__main__(RRR
RRRt__name__(((s1/usr/lib64/python2.7/Tools/scripts/findlinksto.pyt<module>s		pathfix.py000075500000010351151732701220006564 0ustar00#! /usr/bin/python2.7

# Change the #! line occurring in Python scripts.  The new interpreter
# pathname must be given with a -i option.
#
# Command line arguments are files or directories to be processed.
# Directories are searched recursively for files whose name looks
# like a python module.
# Symbolic links are always ignored (except as explicit directory
# arguments).  Of course, the original file is kept as a back-up
# (with a "~" attached to its name).
#
# Undoubtedly you can do this using find and sed or perl, but this is
# a nice example of Python code that recurses down a directory tree
# and uses regular expressions.  Also note several subtleties like
# preserving the file's mode and avoiding to even write a temp file
# when no changes are needed for a file.
#
# NB: by changing only the function fixfile() you can turn this
# into a program for a different change to Python programs...

import sys
import re
import os
from stat import *
import getopt

err = sys.stderr.write
dbg = err
rep = sys.stdout.write

new_interpreter = None

def main():
    global new_interpreter
    usage = ('usage: %s -i /interpreter file-or-directory ...\n' %
             sys.argv[0])
    try:
        opts, args = getopt.getopt(sys.argv[1:], 'i:')
    except getopt.error, msg:
        err(msg + '\n')
        err(usage)
        sys.exit(2)
    for o, a in opts:
        if o == '-i':
            new_interpreter = a
    if not new_interpreter or new_interpreter[0] != '/' or not args:
        err('-i option or file-or-directory missing\n')
        err(usage)
        sys.exit(2)
    bad = 0
    for arg in args:
        if os.path.isdir(arg):
            if recursedown(arg): bad = 1
        elif os.path.islink(arg):
            err(arg + ': will not process symbolic links\n')
            bad = 1
        else:
            if fix(arg): bad = 1
    sys.exit(bad)

ispythonprog = re.compile('^[a-zA-Z0-9_]+\.py$')
def ispython(name):
    return ispythonprog.match(name) >= 0

def recursedown(dirname):
    dbg('recursedown(%r)\n' % (dirname,))
    bad = 0
    try:
        names = os.listdir(dirname)
    except os.error, msg:
        err('%s: cannot list directory: %r\n' % (dirname, msg))
        return 1
    names.sort()
    subdirs = []
    for name in names:
        if name in (os.curdir, os.pardir): continue
        fullname = os.path.join(dirname, name)
        if os.path.islink(fullname): pass
        elif os.path.isdir(fullname):
            subdirs.append(fullname)
        elif ispython(name):
            if fix(fullname): bad = 1
    for fullname in subdirs:
        if recursedown(fullname): bad = 1
    return bad

def fix(filename):
##  dbg('fix(%r)\n' % (filename,))
    try:
        f = open(filename, 'r')
    except IOError, msg:
        err('%s: cannot open: %r\n' % (filename, msg))
        return 1
    line = f.readline()
    fixed = fixline(line)
    if line == fixed:
        rep(filename+': no change\n')
        f.close()
        return
    head, tail = os.path.split(filename)
    tempname = os.path.join(head, '@' + tail)
    try:
        g = open(tempname, 'w')
    except IOError, msg:
        f.close()
        err('%s: cannot create: %r\n' % (tempname, msg))
        return 1
    rep(filename + ': updating\n')
    g.write(fixed)
    BUFSIZE = 8*1024
    while 1:
        buf = f.read(BUFSIZE)
        if not buf: break
        g.write(buf)
    g.close()
    f.close()

    # Finishing touch -- move files

    # First copy the file's mode to the temp file
    try:
        statbuf = os.stat(filename)
        os.chmod(tempname, statbuf[ST_MODE] & 07777)
    except os.error, msg:
        err('%s: warning: chmod failed (%r)\n' % (tempname, msg))
    # Then make a backup of the original file as filename~
    try:
        os.rename(filename, filename + '~')
    except os.error, msg:
        err('%s: warning: backup failed (%r)\n' % (filename, msg))
    # Now move the temp file to the original file
    try:
        os.rename(tempname, filename)
    except os.error, msg:
        err('%s: rename failed (%r)\n' % (filename, msg))
        return 1
    # Return success
    return 0

def fixline(line):
    if not line.startswith('#!'):
        return line
    if "python" not in line:
        return line
    return '#! %s\n' % new_interpreter

if __name__ == '__main__':
    main()
checkappend.py000075500000011061151732701220007365 0ustar00#! /usr/bin/python2.7

# Released to the public domain, by Tim Peters, 28 February 2000.

"""checkappend.py -- search for multi-argument .append() calls.

Usage:  specify one or more file or directory paths:
    checkappend [-v] file_or_dir [file_or_dir] ...

Each file_or_dir is checked for multi-argument .append() calls.  When
a directory, all .py files in the directory, and recursively in its
subdirectories, are checked.

Use -v for status msgs.  Use -vv for more status msgs.

In the absence of -v, the only output is pairs of the form

    filename(linenumber):
    line containing the suspicious append

Note that this finds multi-argument append calls regardless of whether
they're attached to list objects.  If a module defines a class with an
append method that takes more than one argument, calls to that method
will be listed.

Note that this will not find multi-argument list.append calls made via a
bound method object.  For example, this is not caught:

    somelist = []
    push = somelist.append
    push(1, 2, 3)
"""

__version__ = 1, 0, 0

import os
import sys
import getopt
import tokenize

verbose = 0

def errprint(*args):
    msg = ' '.join(args)
    sys.stderr.write(msg)
    sys.stderr.write("\n")

def main():
    args = sys.argv[1:]
    global verbose
    try:
        opts, args = getopt.getopt(sys.argv[1:], "v")
    except getopt.error, msg:
        errprint(str(msg) + "\n\n" + __doc__)
        return
    for opt, optarg in opts:
        if opt == '-v':
            verbose = verbose + 1
    if not args:
        errprint(__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 "%r: listing directory" % (file,)
        names = os.listdir(file)
        for name in names:
            fullname = os.path.join(file, name)
            if ((os.path.isdir(fullname) and
                 not os.path.islink(fullname))
                or os.path.normcase(name[-3:]) == ".py"):
                check(fullname)
        return

    try:
        f = open(file)
    except IOError, msg:
        errprint("%r: I/O Error: %s" % (file, msg))
        return

    if verbose > 1:
        print "checking %r ..." % (file,)

    ok = AppendChecker(file, f).run()
    if verbose and ok:
        print "%r: Clean bill of health." % (file,)

[FIND_DOT,
 FIND_APPEND,
 FIND_LPAREN,
 FIND_COMMA,
 FIND_STMT]   = range(5)

class AppendChecker:
    def __init__(self, fname, file):
        self.fname = fname
        self.file = file
        self.state = FIND_DOT
        self.nerrors = 0

    def run(self):
        try:
            tokenize.tokenize(self.file.readline, self.tokeneater)
        except tokenize.TokenError, msg:
            errprint("%r: Token Error: %s" % (self.fname, msg))
            self.nerrors = self.nerrors + 1
        return self.nerrors == 0

    def tokeneater(self, type, token, start, end, line,
                NEWLINE=tokenize.NEWLINE,
                JUNK=(tokenize.COMMENT, tokenize.NL),
                OP=tokenize.OP,
                NAME=tokenize.NAME):

        state = self.state

        if type in JUNK:
            pass

        elif state is FIND_DOT:
            if type is OP and token == ".":
                state = FIND_APPEND

        elif state is FIND_APPEND:
            if type is NAME and token == "append":
                self.line = line
                self.lineno = start[0]
                state = FIND_LPAREN
            else:
                state = FIND_DOT

        elif state is FIND_LPAREN:
            if type is OP and token == "(":
                self.level = 1
                state = FIND_COMMA
            else:
                state = FIND_DOT

        elif state is FIND_COMMA:
            if type is OP:
                if token in ("(", "{", "["):
                    self.level = self.level + 1
                elif token in (")", "}", "]"):
                    self.level = self.level - 1
                    if self.level == 0:
                        state = FIND_DOT
                elif token == "," and self.level == 1:
                    self.nerrors = self.nerrors + 1
                    print "%s(%d):\n%s" % (self.fname, self.lineno,
                                           self.line)
                    # don't gripe about this stmt again
                    state = FIND_STMT

        elif state is FIND_STMT:
            if type is NEWLINE:
                state = FIND_DOT

        else:
            raise SystemError("unknown internal state '%r'" % (state,))

        self.state = state

if __name__ == '__main__':
    main()
google.py000075500000001007151732701220006373 0ustar00#! /usr/bin/python2.7

import sys, webbrowser

def main():
    args = sys.argv[1:]
    if not args:
        print "Usage: %s querystring" % sys.argv[0]
        return
    list = []
    for arg in args:
        if '+' in arg:
            arg = arg.replace('+', '%2B')
        if ' ' in arg:
            arg = '"%s"' % arg
        arg = arg.replace(' ', '+')
        list.append(arg)
    s = '+'.join(list)
    url = "http://www.google.com/search?q=%s" % s
    webbrowser.open(url)

if __name__ == '__main__':
    main()
reindent-rst.py000075500000000426151732701220007541 0ustar00#! /usr/bin/python2.7

# Make a reST file compliant to our pre-commit hook.
# Currently just remove trailing whitespace.

import sys

import patchcheck

def main(argv=sys.argv):
    patchcheck.normalize_docs_whitespace(argv[1:])

if __name__ == '__main__':
    sys.exit(main())
linktree.pyc000064400000003751151732701220007104 0ustar00�
�fc@sYddlZddlZdZdZd�Zd�ZedkrUeje��ndS(i����Ns.LINKicCsudttj�ko dkns=dGtjdGdGHdStjdtjd}}ttj�dkr�tjd}d}nt}d}tjj|�s�|dGHdSytj|d	�Wn$tjk
r�}|d
G|GHdSXtjj	||�}y&tj
tjj	tj|�|�Wn:tjk
r`}|sP|dG|GHdS|dG|GHnXt|||�dS(
Niisusage:isoldtree newtree [linkto]iis: not a directoryi�s: cannot mkdir:s: cannot symlink:s: warning: cannot symlink:(
tlentsystargvtLINKtostpathtisdirtmkdirterrortjointsymlinktpardirt	linknames(toldtreetnewtreetlinkt
link_may_failtmsgtlinkname((s./usr/lib64/python2.7/Tools/scripts/linktree.pytmains6%
		
&
c
Cs�trdG|||fGHnytj|�}Wn$tjk
rT}|dG|GHdSXx$|D]}|tjtjfkr\tjj||�}tjj||�}tjj||�}tdkr�|G|G|GHntjj|�retjj	|�reytj
|d�d}	Wn|dG|GHd}	nX|	rutjjtj|�}t|||�quqxtj||�q\q\WdS(NRs: warning: cannot listdir:ii�s: warning: cannot mkdir:i(
tdebugRtlistdirRtcurdirRRR	RtislinkRRR
(
toldtnewRtnamesRtnametoldnameRtnewnametok((s./usr/lib64/python2.7/Tools/scripts/linktree.pyR2s8




	t__main__(RRRRRRt__name__texit(((s./usr/lib64/python2.7/Tools/scripts/linktree.pyt<module>
s		md5sum.pyc000064400000005545151732701220006504 0ustar00�
�fc@s�dZdadadadtZddlZddlZddlZddl	Z	d�Z
ejd�Zejd�Z
ejd	ejd
�Zedks�eejdkr�ejeejd	ej��ndS(
s9Python utility to print MD5 checksums of argument files.
i�trbs?
usage: sum5 [-b] [-t] [-l] [-s bufsize] [file ...]
-b        : read files in binary mode (default)
-t        : read files in text mode (you almost certainly don't want this!)
-l        : print last pathname component only
-s bufsize: read buffer size (default %d)
file ...  : files to sum; '-' or no files means stdin
i����NcGs�d}|r7t|dt�r7|d|d }}n	tj}t|�dkrst|dt�rs|d}nxt|D]l}t|t�r�|dkr�ttjd|�p�|}q�t||�p�|}qzt	||�p�|}qzW|S(Nii����it-s<stdin>(
t
isinstancetfiletsyststdouttlentstrt
printsumfptstdintprintsumtsum(tfilestststouttf((s,/usr/lib64/python2.7/Tools/scripts/md5sum.pyRs	&

cCsyyt|t�}Wn.tk
rC}tjjd||f�dSXtrYt|�}nt|||�}|j�|S(Ns%s: Can't open: %s
i(	topentrmodetIOErrorRtstderrtwritetfnfilterRtclose(tfilenameRtfptmsgR
((s,/usr/lib64/python2.7/Tools/scripts/md5sum.pyR
+s
cCs�tj�}y1x*|jt�}|s+Pn|j|�qWWn.tk
rm}tjjd||f�dSX|jd|j	�|f�dS(Ns%s: I/O error: %s
is%s %s
i(
tmd5tnewtreadtbufsizetupdateRRRRt	hexdigest(RRRtmtdataR((s,/usr/lib64/python2.7/Tools/scripts/md5sum.pyR7sicCs�ytj|d�\}}Wn;tjk
rY}tjjdtjd|tf�dSXxt|D]l\}}|dkr�tjj	a
qa|dkr�daqa|dkr�d	aqa|d
krat|�a
qaqaW|s�dg}nt||�S(Nsblts:s	%s: %s
%siis-ls-bRs-ttrs-sR(tgetoptterrorRRRtargvtusagetostpathtbasenameRRtintRR(targsRtoptsRtota((s,/usr/lib64/python2.7/Tools/scripts/md5sum.pytmainEs"$		t__main__i(t__doc__RtNoneRRR&RR'R#RRRR
RR%R/t__name__texit(((s,/usr/lib64/python2.7/Tools/scripts/md5sum.pyt<module>s	
	gprof2html.pyc000064400000004345151732701220007353 0ustar00�
�fc@szdZddlZddlZddlZddlZddlZdZdZd�Zd�Z	e
dkrve	�ndS(s+Transform gprof(1) output into useful HTML.i����NsF<html>
<head>
  <title>gprof output (%s)</title>
</head>
<body>
<pre>
s</pre>
</body>
</html>
ccs#x|D]}tj|�VqWdS(N(tcgitescape(tinputtline((s0/usr/lib64/python2.7/Tools/scripts/gprof2html.pytadd_escapess
cCs�d}tjdr#tjd}n|d}tt|��}t|d�}|jt|�x.|D]&}|j|�|jd�rfPqfqfWi}xv|D]n}tjd|�}|s�|j|�Pn|j	dd�\}}|||<|jd||||f�q�Wx.|D]&}|j|�|jd	�rPqqWx�|D]�}tjd
|�}|s�|j|�|jd�rGPqGqGn|j	ddd�\}	}}
||kr�|j|�qGn|jd
�r�|jd|	||||
f�qG|jd|	|||
f�qGWxW|D]O}xFtj
d|�D]2}||kr`d||f}n|j|�q;Wq"W|jt�|j�t
jdtjj|��dS(Ns	gprof.outis.htmltws times
(.*  )(\w+)\nis+%s<a name="flat:%s" href="#call:%s">%s</a>
sindex % times*(.*  )(\w+)(( &lt;cycle.*&gt;)? \[\d+\])\nsIndex by function nameit[s-%s<a name="call:%s" href="#flat:%s">%s</a>%s
s%s<a href="#call:%s">%s</a>%s
s(\w+(?:\.c)?|\W+)s<a href="#call:%s">%s</a>sfile:(tsystargvRtfiletwritetheadert
startswithtretmatchtgrouptfindallttrailertcloset
webbrowsertopentostpathtabspath(tfilenametoutputfilenameRtoutputRtlabelstmtstufftfnametprefixtsuffixtpart((s0/usr/lib64/python2.7/Tools/scripts/gprof2html.pytmainsb






	




		


t__main__(t__doc__R
RRRRRRRR"t__name__(((s0/usr/lib64/python2.7/Tools/scripts/gprof2html.pyt<module>s<			4texcheck.pyc000064400000020270151732701220007060 0ustar00�
�fc@s�dZddlZddlZddlZddlmZmZmZddlZdZ	d�Z
gd�Zdd�Z
edkr�eje
��ndS(	s� TeXcheck.py -- rough syntax checking on Python style LaTeX documents.

   Written by Raymond D. Hettinger <python at rcn.com>
   Copyright (c) 2003 Python Software Foundation.  All rights reserved.

Designed to catch common markup errors including:
* Unbalanced or mismatched parenthesis, brackets, and braces.
* Unbalanced or mismatched \begin and \end blocks.
* Misspelled or invalid LaTeX commands.
* Use of forward slashes instead of backslashes for commands.
* Table line size mismatches.

Sample command line usage:
    python texcheck.py -k chapterheading -m lib/librandomtex *.tex

Options:
    -m          Munge parenthesis and brackets. [0,n) would normally mismatch.
    -k keyword: Keyword is a valid LaTeX command. Do not include the backslash.
    -d:         Delimiter check only (useful for non-LaTeX files).
    -h:         Help
    -s lineno:  Start at lineno (useful for skipping complex sections).
    -v:         Verbose.  Trace the matching of //begin and //end blocks.
i����N(tiziptcounttislices�
    \section \module \declaremodule \modulesynopsis \moduleauthor
    \sectionauthor \versionadded \code \class \method \begin
    \optional \var \ref \end \subsection \lineiii \hline \label
    \indexii \textrm \ldots \keyword \stindex \index \item \note
    \withsubitem \ttindex \footnote \citetitle \samp \opindex
    \noindent \exception \strong \dfn \ctype \obindex \character
    \indexiii \function \bifuncindex \refmodule \refbimodindex
    \subsubsection \nodename \member \chapter \emph \ASCII \UNIX
    \regexp \program \production \token \productioncont \term
    \grammartoken \lineii \seemodule \file \EOF \documentclass
    \usepackage \title \input \maketitle \ifhtml \fi \url \Cpp
    \tableofcontents \kbd \programopt \envvar \refstmodindex
    \cfunction \constant \NULL \moreargs \cfuncline \cdata
    \textasciicircum \n \ABC \setindexsubitem \versionchanged
    \deprecated \seetext \newcommand \POSIX \pep \warning \rfc
    \verbatiminput \methodline \textgreater \seetitle \lineiv
    \funclineni \ulink \manpage \funcline \dataline \unspecified
    \textbackslash \mimetype \mailheader \seepep \textunderscore
    \longprogramopt \infinity \plusminus \shortversion \version
    \refmodindex \seerfc \makeindex \makemodindex \renewcommand
    \indexname \appendix \protect \indexiv \mbox \textasciitilde
    \platform \seeurl \leftmargin \labelwidth \localmoduletable
    \LaTeX \copyright \memberline \backslash \pi \centerline
    \caption \vspace \textwidth \menuselection \textless
    \makevar \csimplemacro \menuselection \bfcode \sub \release
    \email \kwindex \refexmodindex \filenq \e \menuselection
    \exindex \linev \newsgroup \verbatim \setshortversion
    \author \authoraddress \paragraph \subparagraph \cmemberline
    \textbar \C \seelink
cCsry|j�\}}Wn!tk
r9d||fGHdSX||j||g�krYdSd||||fGHdS(sCVerify that closing delimiter matches most recent opening delimitersU
Delimiter mismatch.  On line %d, encountered closing '%s' without corresponding openNsJ
Opener '%s' on line %d was not closed before encountering '%s' on line %d(tpopt
IndexErrortget(tc_linenotc_symboltopenerstpairmapto_linenoto_symbol((s./usr/lib64/python2.7/Tools/scripts/texcheck.pyt
matchclose?s
c#CsPtjd�}tjd�}ttj��}x|D]}|jd|�q7Wd|kruidd6dd6}nid	d6d
d6}td�}tjd�}	tjd�}
tjd
�}tjd�}g}
g}tjd�}tjd�}tjd�}d}d}t|jdd��}d}x�tt	|�t
||dd/��D]�\}}|j�}x�|	j
|�D]�\}}}d|kr�|GdG|G|G|Gn|dkr�d|kr�|
j||f�nr||kr|
j||f�nP|dkr2d|kr2t|||
|�n"||krTt|||
|�nd|kr�dG|
GHq�q�Wxv|
j
|�D]e\}}|dkr�|j|�n|dkr�y|j�Wq�tk
r�d|fGHq�Xq�q�Wd|kr�qZnxW|j
|�D]F}d |ksd!|kr/qnd||krd"||fGHqqWx)|j
|�D]}d#|||fGHqeW|jd$�}|d%kr�|jd|�}|jd|�}|j||d|!�nx5|j
|�D]$}||kr�d&||fGHq�q�W|j|�}|r@|jd�}|}n|j|�}|r�|jd�|kr�d'|jd�|||fGHn|j|�r�d}nd(|ks�d)|kr�d*|fGHnx&|j
|�D]} d+| |fGHq�WqZW|}!x#|
D]\}}"d,|"|fGHqWx|D]}d-|fGHq*Wd.|!fGHdS(0s�Check the LaTeX formatting in a sequence of lines.

    Opts is a mapping of options to option values if any:
        -m          munge parenthesis and brackets
        -d          delimiters only checking
        -v          verbose trace of delimiter matching
        -s lineno:  linenumber to start scan (default is 1).

    Morecmds is a sequence of LaTeX commands (without backslashes) that
    are to be considered valid in the scan.
    s\\[A-Za-z]+s
\/([A-Za-z]+)s\s-ms[(t]s([t)t[t(s&\\(begin|end){([_a-zA-Z]+)}|([()\[\]])s({)|(})s(\b[A-za-z]+\b) \b\1\bs<\\(ABC|ASCII|C|Cpp|EOF|infinity|NULL|plusminus|POSIX|UNIX)\ss\\begin{(?:long)?table([iv]+)}s\\line([iv]+){s\\end{(?:long)?table([iv]+)}tis-st1is-vt|tbegins-dtends   --> t{t}s Warning, unmatched } on line %s.t822s.htmls4Warning, forward slash used on line %d with cmd: /%ss2Warning, \%s should be written as \%s{} on line %ds\newcommandi����s(Warning, unknown tex cmd on line %d: \%ss>Warning, \line%s on line %d does not match \table%s on line %dse.g.si.e.s2Style warning, avoid use of i.e or e.g. on line %ds&Doubled word warning.  "%s" on line %ds(Unmatched open delimiter '%s' on line %dsUnmatched { on line %dsDone checking %d lines.N(tretcompiletsettcmdstrtsplittaddtintRRRRtNonetrstriptfindalltappendRRRtfindtsearchtgroup(#tsourcetoptstmorecmdsttexcmdtfalsetexcmdt	validcmdstcmdR	t	openpunctt
delimiterstbracestdoubledwordst
spacingmarkupRt
bracestackt
tablestartt	tablelinettableendt
tablelevelttablestartlinet	startlinetlinenotlinetbegendtnametpuncttopentclosetnctstartRtmtdwtlastlinetsymbol((s./usr/lib64/python2.7/Tools/scripts/texcheck.pytcheckitJs�

2
	!	
cCs�|dkrtjd}ntj|d�\}}t|�}d|ksX|gkratGHdSt|�dkr|dGHdSxOt|�D]A\}}d|ks�d|kr�tj|�|||d+q�q�Wg|D]\}}|dkr�|^q�}g}	x}|D]u}
d	d
GHdG|
GHyt	|
�}Wnt
k
rOd|dGHd
SXz|	jt|||��Wd|j
�XqWt|	�S(Nisk:mdhs:vs-his#Please specify a file to be checkedt*t?s-kt=itCheckingsCannot open file %s.i(R tsystargvtgetopttdictt__doc__tlent	enumeratetglobR?tIOErrorR#RGR@tmax(targstoptitemstarglistR(titfilespectktvR)terrtfilenametf((s./usr/lib64/python2.7/Tools/scripts/texcheck.pytmain�s6!+
		

t__main__(RPRRLRNt	itertoolsRRRRSRRRGR R`t__name__texit(((s./usr/lib64/python2.7/Tools/scripts/texcheck.pyt<module>s 	z$logmerge.pyc000064400000011733151732701220007067 0ustar00�
�fc@s�dZddlZddlZddlZddlZdddZdddZd�Zd	�Zdd
�Z
d�Zedkr�ye�Wq�e
k
r�Zejejkr��q�q�XndS(
s�Consolidate a bunch of CVS or RCS logs read from stdin.

Input should be the output of a CVS or RCS logging command, e.g.

    cvs log -rrelease14:

which dumps all log messages from release1.4 upwards (assuming that
release 1.4 was tagged with tag 'release14').  Note the trailing
colon!

This collects all the revision records and outputs them sorted by date
rather than by file, collapsing duplicate revision record, i.e.,
records with the same message for different files.

The -t option causes it to truncate (discard) the last revision log
entry; this is useful when using something like the above cvs log
command, which shows the revisions including the given tag, while you
probably want everything *since* that tag.

The -r option reverses the output (oldest first; the default is oldest
last).

The -b tag option restricts the output to *only* checkin messages
belonging to the given branch tag.  The form -b HEAD restricts the
output to checkin messages belonging to the CVS head (trunk).  (It
produces some output if tag is a non-branch tag, but this output is
not very useful.)

-h prints this message and exits.

XXX This code was created by reverse engineering CVS 1.9 and RCS 5.7
from their output.
i����Nt=iMs
t-ic
Cs(d}d}d	}tjtjdd�\}}xt|D]l\}}|dkrYd}q8|dkrnd}q8|dkr�|}q8|dkr8tGHtjd�q8q8Wg}xLttj�}|s�Pnt||�}	|r�|	d=n|	|t	|�)q�W|j
�|s|j�nt|�d	S(
sMain programiistrb:hs-ts-rs-bs-hi����N(
tNonetgetopttsystargvt__doc__texitt
read_chunktstdintdigest_chunktlentsorttreverset
format_output(
t
truncate_lastR
tbranchtoptstargstotatdatabasetchunktrecords((s./usr/lib64/python2.7/Tools/scripts/logmerge.pytmain*s6			


cCs�g}g}xx|j�}|s%Pn|tkrK|rG|j|�nPn|tkrv|r�|j|�g}q�q|j|�qW|S(skRead a chunk -- data for one file, ending with sep1.

    Split the chunk in parts separated by sep2.

    (treadlinetsep1tappendtsep2(tfpRtlinestline((s./usr/lib64/python2.7/Tools/scripts/logmerge.pyRHs 
cCs5|d}d}t|�}x8|D]*}|| |kr#||j�}Pq#q#Wd}|dkrfn"|dkr�tjd�}ni}d}d}x~|D]v}||kr�d}q�|r�|ddkr
|j�\}	}
|	dd	kr�|	d }	n|
||	<qd}q�q�W|j|�}
tjd
�}|
r�|
jd�dkr�|
jdd�}
tjd
tj	|
�d�}q�ng}x�|dD]�}|d}|d}
|d}|
j�}d}t|�dkr|ddkr|d}|d}|ddkr"|d }n|d|}t|�dkr�|ddkr�|d}|ddkr||d }q|q�nd}|j
d|�|j�}t|�dkr�|ddkr�|d}
nd}
|j
d|�|r|
dks�|j|
�rq�qn|j|||
||f�q�W|S(s9Digest a chunk -- extract working file name and revisionsis
Working file:tHEADs
^\d+\.\d+$ssymbolic names:
is	 i����t:s^<>$s.0.t.t^s\.\d+$iisdate:t;t isauthor:itrevisionN(
RtstripRtretcompiletsplittgettfindtreplacetescapetinserttmatchR(RRRtkeytkeylenRtworking_filet	revisionstfoundttagtrevRtrevlinetdatelinettexttwordstauthortdatewordttimewordtdate((s./usr/lib64/python2.7/Tools/scripts/logmerge.pyR
`sx


	


&


"


"
"
	 cCs�d}g}|jd�x�|D]�\}}}}}||kr�|r�tGx+|D]#\}}	}
}|G|G|	G|
GHqRWtjj|�ng}n|j||||f�|}q WdS(N(NNNNN(RRRRtstdoutt
writelines(RtprevtexttprevR?R3R7R<R:tp_datetp_working_filetp_revtp_author((s./usr/lib64/python2.7/Tools/scripts/logmerge.pyR�s
	t__main__(RRterrnoRR(RRRRRR
Rt__name__tIOErrortetEPIPE(((s./usr/lib64/python2.7/Tools/scripts/logmerge.pyt<module>#s0		E	svneol.py000075500000005562151732701220006437 0ustar00#! /usr/bin/python2.7

"""
SVN helper script.

Try to set the svn:eol-style property to "native" on every .py, .txt, .c and
.h file in the directory tree rooted at the current directory.

Files with the svn:eol-style property already set (to anything) are skipped.

svn will itself refuse to set this property on a file that's not under SVN
control, or that has a binary mime-type property set.  This script inherits
that behavior, and passes on whatever warning message the failing "svn
propset" command produces.

In the Python project, it's safe to invoke this script from the root of
a checkout.

No output is produced for files that are ignored.  For a file that gets
svn:eol-style set, output looks like:

    property 'svn:eol-style' set on 'Lib\ctypes\__init__.py'

For a file not under version control:

    svn: warning: 'patch-finalizer.txt' is not under version control

and for a file with a binary mime-type property:

    svn: File 'Lib\test\test_pep263.py' has binary mime type property
"""

import re
import os

def propfiles(root, fn):
    default = os.path.join(root, ".svn", "props", fn+".svn-work")
    try:
        format = int(open(os.path.join(root, ".svn", "format")).read().strip())
    except IOError:
        return []
    if format in (8, 9):
        # In version 8 and 9, committed props are stored in prop-base, local
        # modifications in props
        return [os.path.join(root, ".svn", "prop-base", fn+".svn-base"),
                os.path.join(root, ".svn", "props", fn+".svn-work")]
    raise ValueError, "Unknown repository format"

def proplist(root, fn):
    "Return a list of property names for file fn in directory root"
    result = []
    for path in propfiles(root, fn):
        try:
            f = open(path)
        except IOError:
            # no properties file: not under version control,
            # or no properties set
            continue
        while 1:
            # key-value pairs, of the form
            # K <length>
            # <keyname>NL
            # V length
            # <value>NL
            # END
            line = f.readline()
            if line.startswith("END"):
                break
            assert line.startswith("K ")
            L = int(line.split()[1])
            key = f.read(L)
            result.append(key)
            f.readline()
            line = f.readline()
            assert line.startswith("V ")
            L = int(line.split()[1])
            value = f.read(L)
            f.readline()
        f.close()
    return result

possible_text_file = re.compile(r"\.([hc]|py|txt|sln|vcproj)$").search

for root, dirs, files in os.walk('.'):
    if '.svn' in dirs:
        dirs.remove('.svn')
    for fn in files:
        if possible_text_file(fn):
            if 'svn:eol-style' not in proplist(root, fn):
                path = os.path.join(root, fn)
                os.system('svn propset svn:eol-style native "%s"' % path)
google.pyc000064400000001430151732701220006533 0ustar00�
�fc@s;ddlZddlZd�Zedkr7e�ndS(i����NcCs�tjd}|s'dtjdGHdSg}xg|D]_}d|kr[|jdd�}nd|krtd|}n|jdd�}|j|�q4Wdj|�}d|}tj|�dS(	NisUsage: %s querystringit+s%2Bt s"%s"s!http://www.google.com/search?q=%s(tsystargvtreplacetappendtjoint
webbrowsertopen(targstlisttargtsturl((s,/usr/lib64/python2.7/Tools/scripts/google.pytmains



t__main__(RRRt__name__(((s,/usr/lib64/python2.7/Tools/scripts/google.pyt<module>s	objgraph.pyo000064400000011505151732701220007073 0ustar00�
�fc@s�ddlZddlZddlZddlZdZdZdZejd�Zd�Z	d�Z
iZiZiZ
iZd�Zd	�Zd
�Zd�Zd�Zd
�Zedkr�yeje��Wq�ek
r�ejd�q�XndS(i����Nt	TRGDSBAECtUVtNntrgdsbavucs(.*):	?........ (.) (.*)$cCs4|j|�r#||j|�n
|g||<dS(N(thas_keytappend(tdicttkeytitem((s./usr/lib64/python2.7/Tools/scripts/objgraph.pytstore)scCs-d}x|D]}|d|}q
W|dS(Ntt i((tlisttsR((s./usr/lib64/python2.7/Tools/scripts/objgraph.pytflat2s
c
Csx|j�}|sPntj|�dkr8|qntjd \\}}\}}\}}\}}	|||!|||	!|||!}
}}|tkr�tt||
�tt|
|�q|tkr�tt	|
|�tt
||
�q|tkr|
d|d|GHqqWdS(Niit:s: unknown type (treadlinetmatchertsearchtregstdefinitionsRtdef2filetfile2deft	externalst
file2undeft
undef2filetignore(
tfpRtratrbtr1atr1btr2atr2btr3atr3btfntnamettype((s./usr/lib64/python2.7/Tools/scripts/objgraph.pyt	readinputBs"1)cCs�tj�}|j�x�|D]�}|dGHt|}|j�xm|D]e}t|�dkrhd}nd}tj|�s�d||dGHqGd||tt|�GHqGWqWdS(NRis	s		s *undefined(RtkeystsorttlenRRR
(tflisttfilenametelisttextttabs((s./usr/lib64/python2.7/Tools/scripts/objgraph.pytprintcalleeXs

	


	cCs�tj�}|j�x�|D]�}g}x2t|D]&}tj|�r4|t|}q4q4W|r�|j�|dGHd}x8|D]$}||kr�d|GHn|}q�Wq|dGHqWdS(NRR	s	s: unused(RR'R(RR(tfilesR+tcallerstlabeltlastfnR#((s./usr/lib64/python2.7/Tools/scripts/objgraph.pytprintcallerks 


	

cCs�i}xKtj�D]=}x4t|D](}tj|�s$t|||�q$q$WqW|j�}|j�xE|D]=}|dGH||}|j�x|D]}d|GHq�WqqWdS(NRs	(RR'RRRR((tundefsR+R-R,R*((s./usr/lib64/python2.7/Tools/scripts/objgraph.pyt
printundef�s

	


cCs}tj}tjt_tj�}|j�xB|D]:}tt|�dkr2dG|GdGtt|�GHq2q2W|t_dS(Niswarning:smultiply defined:(tsyststdouttstderrRR'R(R)R
(t
savestdouttnamesR$((s./usr/lib64/python2.7/Tools/scripts/objgraph.pytwarndups�s	

c	Cs�y#tjtjdd�\}}Wn_tjk
r�tjt_dGtjjtjd�GdGHdGHdGHdGHd	GHd
GHdGHdSXd}}}xS|D]K\}}|dkr�d}q�|d
kr�d}q�|dkr�d}q�q�W||ko|kodknr!d}}}n|s3dg}nx=|D]5}|dkr\t	tj
�q:t	t|d��q:Wt�|||dk}|r�|r�dGHnt
�n|r�|r�dGHnt�n|r�|r�dGHnt�ndS(NitcdusUsage:is[-cdu] [file] ...s -c: print callers per objectfiles -d: print callees per objectfiles$-u: print usage of undefined symbolss.If none of -cdu is specified, all are assumed.s6Use "nm -o" to generate the input (on IRIX: "nm -Bo"),s"e.g.: nm -o /lib/libc.a | objgraphs-us-cs-dt-trs,---------------All callees------------------s,---------------Undefined callees------------s,---------------All Callers------------------(tgetoptR7targvterrorR9R8tostpathtbasenameR&tstdintopenR<R/R6R4(	toptlisttargstoptutoptctoptdtopttvoidR+tmore((s./usr/lib64/python2.7/Tools/scripts/objgraph.pytmain�sX#		
'



t__main__i(R7RCR@treRRRtcompileRRR
RRRRR&R/R4R6R<RPt__name__texittKeyboardInterrupt(((s./usr/lib64/python2.7/Tools/scripts/objgraph.pyt<module>s0								
	5
fixheader.py000075500000002245151732701220007063 0ustar00#! /usr/bin/python2.7

# Add some standard cpp magic to a header file

import sys

def main():
    args = sys.argv[1:]
    for filename in args:
        process(filename)

def process(filename):
    try:
        f = open(filename, 'r')
    except IOError, msg:
        sys.stderr.write('%s: can\'t open: %s\n' % (filename, str(msg)))
        return
    data = f.read()
    f.close()
    if data[:2] <> '/*':
        sys.stderr.write('%s does not begin with C comment\n' % filename)
        return
    try:
        f = open(filename, 'w')
    except IOError, msg:
        sys.stderr.write('%s: can\'t write: %s\n' % (filename, str(msg)))
        return
    sys.stderr.write('Processing %s ...\n' % filename)
    magic = 'Py_'
    for c in filename:
        if ord(c)<=0x80 and c.isalnum():
            magic = magic + c.upper()
        else: magic = magic + '_'
    sys.stdout = f
    print '#ifndef', magic
    print '#define', magic
    print '#ifdef __cplusplus'
    print 'extern "C" {'
    print '#endif'
    print
    f.write(data)
    print
    print '#ifdef __cplusplus'
    print '}'
    print '#endif'
    print '#endif /*', '!'+magic, '*/'

if __name__ == '__main__':
    main()
gprof2html.py000075500000004167151732701220007215 0ustar00#! /usr/bin/python2.7

"""Transform gprof(1) output into useful HTML."""

import re, os, sys, cgi, webbrowser

header = """\
<html>
<head>
  <title>gprof output (%s)</title>
</head>
<body>
<pre>
"""

trailer = """\
</pre>
</body>
</html>
"""

def add_escapes(input):
    for line in input:
        yield cgi.escape(line)

def main():
    filename = "gprof.out"
    if sys.argv[1:]:
        filename = sys.argv[1]
    outputfilename = filename + ".html"
    input = add_escapes(file(filename))
    output = file(outputfilename, "w")
    output.write(header % filename)
    for line in input:
        output.write(line)
        if line.startswith(" time"):
            break
    labels = {}
    for line in input:
        m = re.match(r"(.*  )(\w+)\n", line)
        if not m:
            output.write(line)
            break
        stuff, fname = m.group(1, 2)
        labels[fname] = fname
        output.write('%s<a name="flat:%s" href="#call:%s">%s</a>\n' %
                     (stuff, fname, fname, fname))
    for line in input:
        output.write(line)
        if line.startswith("index % time"):
            break
    for line in input:
        m = re.match(r"(.*  )(\w+)(( &lt;cycle.*&gt;)? \[\d+\])\n", line)
        if not m:
            output.write(line)
            if line.startswith("Index by function name"):
                break
            continue
        prefix, fname, suffix = m.group(1, 2, 3)
        if fname not in labels:
            output.write(line)
            continue
        if line.startswith("["):
            output.write('%s<a name="call:%s" href="#flat:%s">%s</a>%s\n' %
                         (prefix, fname, fname, fname, suffix))
        else:
            output.write('%s<a href="#call:%s">%s</a>%s\n' %
                         (prefix, fname, fname, suffix))
    for line in input:
        for part in re.findall(r"(\w+(?:\.c)?|\W+)", line):
            if part in labels:
                part = '<a href="#call:%s">%s</a>' % (part, part)
            output.write(part)
    output.write(trailer)
    output.close()
    webbrowser.open("file:" + os.path.abspath(outputfilename))

if __name__ == '__main__':
    main()
reindent-rst.pyc000064400000000741151732701220007701 0ustar00�
�fc@sJddlZddlZejd�ZedkrFeje��ndS(i����NcCstj|d�dS(Ni(t
patchchecktnormalize_docs_whitespace(targv((s2/usr/lib64/python2.7/Tools/scripts/reindent-rst.pytmain
st__main__(tsysRRRt__name__texit(((s2/usr/lib64/python2.7/Tools/scripts/reindent-rst.pyt<module>swhich.py000075500000003136151732701220006226 0ustar00#! /usr/bin/python2.7

# Variant of "which".
# On stderr, near and total misses are reported.
# '-l<flags>' argument adds ls -l<flags> of each file found.

import sys
if sys.path[0] in (".", ""): del sys.path[0]

import sys, os
from stat import *

def msg(str):
    sys.stderr.write(str + '\n')

def main():
    pathlist = os.environ['PATH'].split(os.pathsep)

    sts = 0
    longlist = ''

    if sys.argv[1:] and sys.argv[1][:2] == '-l':
        longlist = sys.argv[1]
        del sys.argv[1]

    for prog in sys.argv[1:]:
        ident = ()
        for dir in pathlist:
            filename = os.path.join(dir, prog)
            try:
                st = os.stat(filename)
            except os.error:
                continue
            if not S_ISREG(st[ST_MODE]):
                msg(filename + ': not a disk file')
            else:
                mode = S_IMODE(st[ST_MODE])
                if mode & 0111:
                    if not ident:
                        print filename
                        ident = st[:3]
                    else:
                        if st[:3] == ident:
                            s = 'same as: '
                        else:
                            s = 'also: '
                        msg(s + filename)
                else:
                    msg(filename + ': not executable')
            if longlist:
                sts = os.system('ls ' + longlist + ' ' + filename)
                if sts: msg('"ls -l" exit status: ' + repr(sts))
        if not ident:
            msg(prog + ': not found')
            sts = 1

    sys.exit(sts)

if __name__ == '__main__':
    main()
finddiv.py000075500000004725151732701220006554 0ustar00#! /usr/bin/python2.7

"""finddiv - a grep-like tool that looks for division operators.

Usage: finddiv [-l] file_or_directory ...

For directory arguments, all files in the directory whose name ends in
.py are processed, and subdirectories are processed recursively.

This actually tokenizes the files to avoid false hits in comments or
strings literals.

By default, this prints all lines containing a / or /= operator, in
grep -n style.  With the -l option specified, it prints the filename
of files that contain at least one / or /= operator.
"""

import os
import sys
import getopt
import tokenize

def main():
    try:
        opts, args = getopt.getopt(sys.argv[1:], "lh")
    except getopt.error, msg:
        usage(msg)
        return 2
    if not args:
        usage("at least one file argument is required")
        return 2
    listnames = 0
    for o, a in opts:
        if o == "-h":
            print __doc__
            return
        if o == "-l":
            listnames = 1
    exit = None
    for filename in args:
        x = process(filename, listnames)
        exit = exit or x
    return exit

def usage(msg):
    sys.stderr.write("%s: %s\n" % (sys.argv[0], msg))
    sys.stderr.write("Usage: %s [-l] file ...\n" % sys.argv[0])
    sys.stderr.write("Try `%s -h' for more information.\n" % sys.argv[0])

def process(filename, listnames):
    if os.path.isdir(filename):
        return processdir(filename, listnames)
    try:
        fp = open(filename)
    except IOError, msg:
        sys.stderr.write("Can't open: %s\n" % msg)
        return 1
    g = tokenize.generate_tokens(fp.readline)
    lastrow = None
    for type, token, (row, col), end, line in g:
        if token in ("/", "/="):
            if listnames:
                print filename
                break
            if row != lastrow:
                lastrow = row
                print "%s:%d:%s" % (filename, row, line),
    fp.close()

def processdir(dir, listnames):
    try:
        names = os.listdir(dir)
    except os.error, msg:
        sys.stderr.write("Can't list directory: %s\n" % dir)
        return 1
    files = []
    for name in names:
        fn = os.path.join(dir, name)
        if os.path.normcase(fn).endswith(".py") or os.path.isdir(fn):
            files.append(fn)
    files.sort(lambda a, b: cmp(os.path.normcase(a), os.path.normcase(b)))
    exit = None
    for fn in files:
        x = process(fn, listnames)
        exit = exit or x
    return exit

if __name__ == "__main__":
    sys.exit(main())
db2pickle.pyc000064400000006651151732701220007130 0ustar00�
�fc@sBdZddlZyddlZWnek
r;dZnXyddlZWnek
redZnXyddlZWnek
r�dZnXyddlZWnek
r�dZnXddlZyddl	Z
Wnek
r�ddl
Z
nXejdZd�Z
d�Zedkr>ejeejd��ndS(s5
Synopsis: %(prog)s [-h|-g|-b|-r|-a] dbfile [ picklefile ]

Convert the database file given on the command line to a pickle
representation.  The optional flags indicate the type of the database:

    -a - open using anydbm
    -b - open as bsddb btree file
    -d - open as dbm file
    -g - open as gdbm file
    -h - open as bsddb hash file
    -r - open as bsddb recno file

The default is hash.  If a pickle file is named it is opened for write
access (deleting any existing data).  If no pickle file is named, the pickle
output is written to standard output.

i����NicCstjjtt��dS(N(tsyststderrtwritet__doc__tglobals(((s//usr/lib64/python2.7/Tools/scripts/db2pickle.pytusage/sc		Cs�y1tj|dddddddg�\}}Wntjk
rOt�dSXt|�d	kstt|�d
krt�dSt|�dkr�|d	}tj}nN|d	}yt|dd�}Wn*tk
r�tjj	d|d�dSXd}x�|D]�\}}|d"krOy
tj}Wq�t
k
rKtjj	d�dSXq|d#kr�y
tj}Wq�t
k
r�tjj	d�dSXq|d$kr�y
tj}Wq�t
k
r�tjj	d�dSXq|d%kry
tj}Wq�t
k
rtjj	d�dSXq|d&krSy
tj}Wq�t
k
rOtjj	d�dSXq|d'kry
tj}Wq�t
k
r�tjj	d�dSXqqW|dkr�tdkr�tjj	d�tjj	d�dStj}ny||d�}Wn9tjk
r.tjj	d |�tjj	d!�dSXx7|j�D])}tj|||f|ddk�q<W|j�|j�d	S((NthbrdagthashtbtreetrecnotdbmtgdbmtanydbmiiitwbsUnable to open %s
s-hs--hashsbsddb module unavailable.
s-bs--btrees-rs--recnos-as--anydbmsanydbm module unavailable.
s-gs--gdbmsgdbm module unavailable.
s-ds--dbmsdbm module unavailable.
sbsddb module unavailable - smust specify dbtype.
trsUnable to open %s.  s&Check for format or version mismatch.
(s-hs--hash(s-bs--btree(s-rs--recno(s-as--anydbm(s-gs--gdbm(s-ds--dbm(tgetoptterrorRtlenRtstdouttopentIOErrorRRtNonetbsddbthashopentAttributeErrortbtopentrnopenRRR
tkeystpickletdumptclose(	targstoptstdbfiletpfiletdbopentopttargtdbtk((s//usr/lib64/python2.7/Tools/scripts/db2pickle.pytmain2s�$














'

t__main__i(RRRtImportErrorRR
RRRtcPickleRtargvtprogRR(t__name__texit(((s//usr/lib64/python2.7/Tools/scripts/db2pickle.pyt<module>s6









		Tnm2def.py000075500000004613151732701220006300 0ustar00#! /usr/bin/python2.7
"""nm2def.py

Helpers to extract symbols from Unix libs and auto-generate
Windows definition files from them. Depends on nm(1). Tested
on Linux and Solaris only (-p option to nm is for Solaris only).

By Marc-Andre Lemburg, Aug 1998.

Additional notes: the output of nm is supposed to look like this:

acceler.o:
000001fd T PyGrammar_AddAccelerators
         U PyGrammar_FindDFA
00000237 T PyGrammar_RemoveAccelerators
         U _IO_stderr_
         U exit
         U fprintf
         U free
         U malloc
         U printf

grammar1.o:
00000000 T PyGrammar_FindDFA
00000034 T PyGrammar_LabelRepr
         U _PyParser_TokenNames
         U abort
         U printf
         U sprintf

...

Even if this isn't the default output of your nm, there is generally an
option to produce this format (since it is the original v7 Unix format).

"""
import os, sys

PYTHONLIB = 'libpython'+sys.version[:3]+'.a'
PC_PYTHONLIB = 'Python'+sys.version[0]+sys.version[2]+'.dll'
NM = 'nm -p -g %s'                      # For Linux, use "nm -g %s"

def symbols(lib=PYTHONLIB,types=('T','C','D')):

    lines = os.popen(NM % lib).readlines()
    lines = [s.strip() for s in lines]
    symbols = {}
    for line in lines:
        if len(line) == 0 or ':' in line:
            continue
        items = line.split()
        if len(items) != 3:
            continue
        address, type, name = items
        if type not in types:
            continue
        symbols[name] = address,type
    return symbols

def export_list(symbols):

    data = []
    code = []
    for name,(addr,type) in symbols.items():
        if type in ('C','D'):
            data.append('\t'+name)
        else:
            code.append('\t'+name)
    data.sort()
    data.append('')
    code.sort()
    return ' DATA\n'.join(data)+'\n'+'\n'.join(code)

# Definition file template
DEF_TEMPLATE = """\
EXPORTS
%s
"""

# Special symbols that have to be included even though they don't
# pass the filter
SPECIALS = (
    )

def filter_Python(symbols,specials=SPECIALS):

    for name in symbols.keys():
        if name[:2] == 'Py' or name[:3] == '_Py':
            pass
        elif name not in specials:
            del symbols[name]

def main():

    s = symbols(PYTHONLIB)
    filter_Python(s)
    exports = export_list(s)
    f = sys.stdout # open('PC/python_nt.def','w')
    f.write(DEF_TEMPLATE % (exports))
    f.close()

if __name__ == '__main__':
    main()
diff.pyo000064400000004522151732701220006210 0ustar00�
�fc@sedZddlZddlZddlZddlZddlZd�Zedkrae�ndS(sS Command line interface to difflib.py providing diffs in four formats:

* ndiff:    lists every line and highlights interline changes.
* context:  highlights clusters of changes in a before/after format.
* unified:  highlights clusters of changes in an inline format.
* html:     generates side by side comparison with change highlights.

i����Nc
Csed}tj|�}|jddddtdd�|jddddtdd	�|jd
dddtdd�|jddddtdd
�|jdddddddd�|j�\}}t|�dkr�|j�tjd�nt|�dkr|j	d�n|j
}|\}}tjt
j|�j�}tjt
j|�j�}t|d��}	|	j�}
WdQXt|d��}	|	j�}WdQX|jr�tj|
|||||d|�}n{|jr�tj|
|�}n]|jr-tj�j|
|||d|jd|�}n$tj|
|||||d|�}tjj|�dS(Ns&usage: %prog [options] fromfile tofiles-ctactiont
store_truetdefaultthelps'Produce a context format diff (default)s-usProduce a unified format diffs-msAProduce HTML side by side diff (can use -c and -l in conjunction)s-nsProduce a ndiff format diffs-ls--linesttypetintis'Set number of context lines (default 3)iiis*need to specify both a fromfile and tofiletUtntcontexttnumlines(toptparsetOptionParsert
add_optiontFalset
parse_argstlent
print_helptsystexitterrortlinesttimetctimetoststattst_mtimetopent	readlinestutdifflibtunified_diffRtndifftmtHtmlDifft	make_filetctcontext_difftstdoutt
writelines(
tusagetparsertoptionstargsRtfromfilettofiletfromdatettodatetft	fromlinesttolinestdiff((s*/usr/lib64/python2.7/Tools/scripts/diff.pytmain
s:"
		'		0$t__main__(t__doc__RRRRR
R3t__name__(((s*/usr/lib64/python2.7/Tools/scripts/diff.pyt<module>	s<	&findnocoding.pyc000064400000006201151732701220007721 0ustar00�
�fc@s�dZdZddlZddlZddlZddlZyddlZWn:ek
r�ddd��YZe�ZejdIJnXej	d�Z
ej	d�Zd	�Zd
�Z
d�Zdejd
Zy#ejejdd�\ZZWn=ejk
r5ZejeIJejeIJejd�nXejZeZxAeD]9\ZZedkrpejZqLedkrLeZqLqLWes�ejeIJejd�nxFejee�D]2Zer�deGHnee�Z e r�eGHq�q�WdS(s_List all those Python files that require a coding directive

Usage: nocoding.py dir1 [dir2...]
sOleg Broytmann, Georg Brandli����NtpysourcecBseZdZZZd�ZRS(c	os�x�|D]�}tjj|�r0|jd�Vqtjj|�rxZtj|�D]F\}}}x4|D],}|jd�rhtjj||�VqhqhWqRWqqWdS(Ns.py(tostpathtisfiletendswithtisdirtwalktjoin(	tselftpathstargstkwargsRtroottdirstfilestfilename((s2/usr/lib64/python2.7/Tools/scripts/findnocoding.pytwalk_python_filess

N(t__name__t
__module__tNonethas_python_exttlooks_like_pythontcan_be_compiledR(((s2/usr/lib64/python2.7/Tools/scripts/findnocoding.pyRss^The pysource module is not available; no sophisticated Python source file search will be done.s&^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)s^[ \t\f]*(?:[#\r\n]|$)cCs&tj|�}|r"|jd�SdS(Nit(tdecl_retmatchtgroup(tlineR((s2/usr/lib64/python2.7/Tools/scripts/findnocoding.pytget_declaration&s
cCs.yt||�Wntk
r%tSXtSdS(N(tunicodetUnicodeDecodeErrortFalsetTrue(ttexttcodec((s2/usr/lib64/python2.7/Tools/scripts/findnocoding.pythas_correct_encoding,s

cCs�yt|d�}Wntk
r'dSX|j�}|j�}t|�sgtj|�rut|�ru|j�tS|j	�}|j�t
|||d�r�tStS(NtrUtascii(topentIOErrorRtreadlineRtblank_reRtcloseRtreadR#R (tfullpathtinfiletline1tline2trest((s2/usr/lib64/python2.7/Tools/scripts/findnocoding.pytneeds_declaration4s


sjUsage: %s [-cd] paths...
    -c: recognize Python source files trying to compile them
    -d: debug outputiitcds-cs-dsTesting for coding: %s((!t__doc__t
__author__tsysRtretgetoptRtImportErrortstderrtcompileRR)RR#R1targvtusagetoptsR
terrortmsgtexitRt	is_pythonRtdebugtotaRR RR,tresult(((s2/usr/lib64/python2.7/Tools/scripts/findnocoding.pyt<module>sH0
				#

	

findlinksto.py000075500000002055151732701220007447 0ustar00#! /usr/bin/python2.7

# findlinksto
#
# find symbolic links to a path matching a regular expression

import os
import sys
import re
import getopt

def main():
    try:
        opts, args = getopt.getopt(sys.argv[1:], '')
        if len(args) < 2:
            raise getopt.GetoptError('not enough arguments', None)
    except getopt.GetoptError, msg:
        sys.stdout = sys.stderr
        print msg
        print 'usage: findlinksto pattern directory ...'
        sys.exit(2)
    pat, dirs = args[0], args[1:]
    prog = re.compile(pat)
    for dirname in dirs:
        os.path.walk(dirname, visit, prog)

def visit(prog, dirname, names):
    if os.path.islink(dirname):
        names[:] = []
        return
    if os.path.ismount(dirname):
        print 'descend into', dirname
    for name in names:
        name = os.path.join(dirname, name)
        try:
            linkto = os.readlink(name)
            if prog.search(linkto) is not None:
                print name, '->', linkto
        except os.error:
            pass

if __name__ == '__main__':
    main()
findnocoding.pyo000064400000006201151732701220007735 0ustar00�
�fc@s�dZdZddlZddlZddlZddlZyddlZWn:ek
r�ddd��YZe�ZejdIJnXej	d�Z
ej	d�Zd	�Zd
�Z
d�Zdejd
Zy#ejejdd�\ZZWn=ejk
r5ZejeIJejeIJejd�nXejZeZxAeD]9\ZZedkrpejZqLedkrLeZqLqLWes�ejeIJejd�nxFejee�D]2Zer�deGHnee�Z e r�eGHq�q�WdS(s_List all those Python files that require a coding directive

Usage: nocoding.py dir1 [dir2...]
sOleg Broytmann, Georg Brandli����NtpysourcecBseZdZZZd�ZRS(c	os�x�|D]�}tjj|�r0|jd�Vqtjj|�rxZtj|�D]F\}}}x4|D],}|jd�rhtjj||�VqhqhWqRWqqWdS(Ns.py(tostpathtisfiletendswithtisdirtwalktjoin(	tselftpathstargstkwargsRtroottdirstfilestfilename((s2/usr/lib64/python2.7/Tools/scripts/findnocoding.pytwalk_python_filess

N(t__name__t
__module__tNonethas_python_exttlooks_like_pythontcan_be_compiledR(((s2/usr/lib64/python2.7/Tools/scripts/findnocoding.pyRss^The pysource module is not available; no sophisticated Python source file search will be done.s&^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)s^[ \t\f]*(?:[#\r\n]|$)cCs&tj|�}|r"|jd�SdS(Nit(tdecl_retmatchtgroup(tlineR((s2/usr/lib64/python2.7/Tools/scripts/findnocoding.pytget_declaration&s
cCs.yt||�Wntk
r%tSXtSdS(N(tunicodetUnicodeDecodeErrortFalsetTrue(ttexttcodec((s2/usr/lib64/python2.7/Tools/scripts/findnocoding.pythas_correct_encoding,s

cCs�yt|d�}Wntk
r'dSX|j�}|j�}t|�sgtj|�rut|�ru|j�tS|j	�}|j�t
|||d�r�tStS(NtrUtascii(topentIOErrorRtreadlineRtblank_reRtcloseRtreadR#R (tfullpathtinfiletline1tline2trest((s2/usr/lib64/python2.7/Tools/scripts/findnocoding.pytneeds_declaration4s


sjUsage: %s [-cd] paths...
    -c: recognize Python source files trying to compile them
    -d: debug outputiitcds-cs-dsTesting for coding: %s((!t__doc__t
__author__tsysRtretgetoptRtImportErrortstderrtcompileRR)RR#R1targvtusagetoptsR
terrortmsgtexitRt	is_pythonRtdebugtotaRR RR,tresult(((s2/usr/lib64/python2.7/Tools/scripts/findnocoding.pyt<module>sH0
				#

	

finddiv.pyc000064400000006340151732701220006707 0ustar00�
�fc@s}dZddlZddlZddlZddlZd�Zd�Zd�Zd�Ze	dkryej
e��ndS(s	finddiv - a grep-like tool that looks for division operators.

Usage: finddiv [-l] file_or_directory ...

For directory arguments, all files in the directory whose name ends in
.py are processed, and subdirectories are processed recursively.

This actually tokenizes the files to avoid false hits in comments or
strings literals.

By default, this prints all lines containing a / or /= operator, in
grep -n style.  With the -l option specified, it prints the filename
of files that contain at least one / or /= operator.
i����Nc	Cs�y#tjtjdd�\}}Wn!tjk
rF}t|�dSX|s[td�dSd}x>|D]6\}}|dkr�tGHdS|dkrhd}qhqhWd}x)|D]!}t||�}|p�|}q�W|S(Nitlhis&at least one file argument is requiredis-hs-l(tgetopttsystargvterrortusaget__doc__tNonetprocess(	toptstargstmsgt	listnamestotatexittfilenametx((s-/usr/lib64/python2.7/Tools/scripts/finddiv.pytmains(#



cCs[tjjdtjd|f�tjjdtjd�tjjdtjd�dS(Ns%s: %s
isUsage: %s [-l] file ...
s"Try `%s -h' for more information.
(RtstderrtwriteR(R((s-/usr/lib64/python2.7/Tools/scripts/finddiv.pyR-s!cCs�tjj|�rt||�Syt|�}Wn(tk
rY}tjjd|�dSXt	j
|j�}d}xg|D]_\}}\}}	}
}|dkry|r�|GHPn||kr�|}d|||fGq�qyqyW|j
�dS(NsCan't open: %s
it/s/=s%s:%d:%s(Rs/=(tostpathtisdirt
processdirtopentIOErrorRRRttokenizetgenerate_tokenstreadlineRtclose(RRtfpRtgtlastrowttypettokentrowtcoltendtline((s-/usr/lib64/python2.7/Tools/scripts/finddiv.pyR2s$
"c	Cs�ytj|�}Wn+tjk
r@}tjjd|�dSXg}x`|D]X}tjj||�}tjj|�j	d�s�tjj
|�rN|j|�qNqNW|jd��d}x)|D]!}t||�}|p�|}q�W|S(NsCan't list directory: %s
is.pycSs%ttjj|�tjj|��S(N(tcmpRRtnormcase(Rtb((s-/usr/lib64/python2.7/Tools/scripts/finddiv.pyt<lambda>Qt(RtlistdirRRRRRtjoinR*tendswithRtappendtsortRR(	tdirRtnamesRtfilestnametfnRR((s-/usr/lib64/python2.7/Tools/scripts/finddiv.pyRFs 
-
t__main__(RRRRRRRRRt__name__R(((s-/usr/lib64/python2.7/Tools/scripts/finddiv.pyt<module>s				md5sum.pyo000064400000005545151732701220006520 0ustar00�
�fc@s�dZdadadadtZddlZddlZddlZddl	Z	d�Z
ejd�Zejd�Z
ejd	ejd
�Zedks�eejdkr�ejeejd	ej��ndS(
s9Python utility to print MD5 checksums of argument files.
i�trbs?
usage: sum5 [-b] [-t] [-l] [-s bufsize] [file ...]
-b        : read files in binary mode (default)
-t        : read files in text mode (you almost certainly don't want this!)
-l        : print last pathname component only
-s bufsize: read buffer size (default %d)
file ...  : files to sum; '-' or no files means stdin
i����NcGs�d}|r7t|dt�r7|d|d }}n	tj}t|�dkrst|dt�rs|d}nxt|D]l}t|t�r�|dkr�ttjd|�p�|}q�t||�p�|}qzt	||�p�|}qzW|S(Nii����it-s<stdin>(
t
isinstancetfiletsyststdouttlentstrt
printsumfptstdintprintsumtsum(tfilestststouttf((s,/usr/lib64/python2.7/Tools/scripts/md5sum.pyRs	&

cCsyyt|t�}Wn.tk
rC}tjjd||f�dSXtrYt|�}nt|||�}|j�|S(Ns%s: Can't open: %s
i(	topentrmodetIOErrorRtstderrtwritetfnfilterRtclose(tfilenameRtfptmsgR
((s,/usr/lib64/python2.7/Tools/scripts/md5sum.pyR
+s
cCs�tj�}y1x*|jt�}|s+Pn|j|�qWWn.tk
rm}tjjd||f�dSX|jd|j	�|f�dS(Ns%s: I/O error: %s
is%s %s
i(
tmd5tnewtreadtbufsizetupdateRRRRt	hexdigest(RRRtmtdataR((s,/usr/lib64/python2.7/Tools/scripts/md5sum.pyR7sicCs�ytj|d�\}}Wn;tjk
rY}tjjdtjd|tf�dSXxt|D]l\}}|dkr�tjj	a
qa|dkr�daqa|dkr�d	aqa|d
krat|�a
qaqaW|s�dg}nt||�S(Nsblts:s	%s: %s
%siis-ls-bRs-ttrs-sR(tgetoptterrorRRRtargvtusagetostpathtbasenameRRtintRR(targsRtoptsRtota((s,/usr/lib64/python2.7/Tools/scripts/md5sum.pytmainEs"$		t__main__i(t__doc__RtNoneRRR&RR'R#RRRR
RR%R/t__name__texit(((s,/usr/lib64/python2.7/Tools/scripts/md5sum.pyt<module>s	
	logmerge.py000075500000012707151732701220006731 0ustar00#! /usr/bin/python2.7

"""Consolidate a bunch of CVS or RCS logs read from stdin.

Input should be the output of a CVS or RCS logging command, e.g.

    cvs log -rrelease14:

which dumps all log messages from release1.4 upwards (assuming that
release 1.4 was tagged with tag 'release14').  Note the trailing
colon!

This collects all the revision records and outputs them sorted by date
rather than by file, collapsing duplicate revision record, i.e.,
records with the same message for different files.

The -t option causes it to truncate (discard) the last revision log
entry; this is useful when using something like the above cvs log
command, which shows the revisions including the given tag, while you
probably want everything *since* that tag.

The -r option reverses the output (oldest first; the default is oldest
last).

The -b tag option restricts the output to *only* checkin messages
belonging to the given branch tag.  The form -b HEAD restricts the
output to checkin messages belonging to the CVS head (trunk).  (It
produces some output if tag is a non-branch tag, but this output is
not very useful.)

-h prints this message and exits.

XXX This code was created by reverse engineering CVS 1.9 and RCS 5.7
from their output.
"""

import sys, errno, getopt, re

sep1 = '='*77 + '\n'                    # file separator
sep2 = '-'*28 + '\n'                    # revision separator

def main():
    """Main program"""
    truncate_last = 0
    reverse = 0
    branch = None
    opts, args = getopt.getopt(sys.argv[1:], "trb:h")
    for o, a in opts:
        if o == '-t':
            truncate_last = 1
        elif o == '-r':
            reverse = 1
        elif o == '-b':
            branch = a
        elif o == '-h':
            print __doc__
            sys.exit(0)
    database = []
    while 1:
        chunk = read_chunk(sys.stdin)
        if not chunk:
            break
        records = digest_chunk(chunk, branch)
        if truncate_last:
            del records[-1]
        database[len(database):] = records
    database.sort()
    if not reverse:
        database.reverse()
    format_output(database)

def read_chunk(fp):
    """Read a chunk -- data for one file, ending with sep1.

    Split the chunk in parts separated by sep2.

    """
    chunk = []
    lines = []
    while 1:
        line = fp.readline()
        if not line:
            break
        if line == sep1:
            if lines:
                chunk.append(lines)
            break
        if line == sep2:
            if lines:
                chunk.append(lines)
                lines = []
        else:
            lines.append(line)
    return chunk

def digest_chunk(chunk, branch=None):
    """Digest a chunk -- extract working file name and revisions"""
    lines = chunk[0]
    key = 'Working file:'
    keylen = len(key)
    for line in lines:
        if line[:keylen] == key:
            working_file = line[keylen:].strip()
            break
    else:
        working_file = None
    if branch is None:
        pass
    elif branch == "HEAD":
        branch = re.compile(r"^\d+\.\d+$")
    else:
        revisions = {}
        key = 'symbolic names:\n'
        found = 0
        for line in lines:
            if line == key:
                found = 1
            elif found:
                if line[0] in '\t ':
                    tag, rev = line.split()
                    if tag[-1] == ':':
                        tag = tag[:-1]
                    revisions[tag] = rev
                else:
                    found = 0
        rev = revisions.get(branch)
        branch = re.compile(r"^<>$") # <> to force a mismatch by default
        if rev:
            if rev.find('.0.') >= 0:
                rev = rev.replace('.0.', '.')
                branch = re.compile(r"^" + re.escape(rev) + r"\.\d+$")
    records = []
    for lines in chunk[1:]:
        revline = lines[0]
        dateline = lines[1]
        text = lines[2:]
        words = dateline.split()
        author = None
        if len(words) >= 3 and words[0] == 'date:':
            dateword = words[1]
            timeword = words[2]
            if timeword[-1:] == ';':
                timeword = timeword[:-1]
            date = dateword + ' ' + timeword
            if len(words) >= 5 and words[3] == 'author:':
                author = words[4]
                if author[-1:] == ';':
                    author = author[:-1]
        else:
            date = None
            text.insert(0, revline)
        words = revline.split()
        if len(words) >= 2 and words[0] == 'revision':
            rev = words[1]
        else:
            # No 'revision' line -- weird...
            rev = None
            text.insert(0, revline)
        if branch:
            if rev is None or not branch.match(rev):
                continue
        records.append((date, working_file, rev, author, text))
    return records

def format_output(database):
    prevtext = None
    prev = []
    database.append((None, None, None, None, None)) # Sentinel
    for (date, working_file, rev, author, text) in database:
        if text != prevtext:
            if prev:
                print sep2,
                for (p_date, p_working_file, p_rev, p_author) in prev:
                    print p_date, p_author, p_working_file, p_rev
                sys.stdout.writelines(prevtext)
            prev = []
        prev.append((date, working_file, rev, author))
        prevtext = text

if __name__ == '__main__':
    try:
        main()
    except IOError, e:
        if e.errno != errno.EPIPE:
            raise
reindent.pyo000064400000022566151732701230007121 0ustar00�
�fc@s�dZdZddlZddlZddlZddlZddlZdadada	e
add�Z
d�Zd�Zd�Zd	�Zd
d�Zddd
��YZd�Zedkr�e�ndS(sAreindent [-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.
t1i����NicCs-|dk	rtj|IJntjtIJdS(N(tNonetsyststderrt__doc__(tmsg((s./usr/lib64/python2.7/Tools/scripts/reindent.pytusage6scGsKd}x.|D]&}tjj|t|��d}q
Wtjjd�dS(Ntt s
(RRtwritetstr(targstseptarg((s./usr/lib64/python2.7/Tools/scripts/reindent.pyterrprint;s


cCsEddl}y5|jtjdddddddg�\}}Wn!|jk
rd}t|�dSXx�|D]�\}}|dkr�td7aql|dkr�td7aql|dkr�taql|dkr�t	d7a	ql|dkrlt�dSqlW|s&t
tj�}|j�|j
tj�dSx|D]}t|�q-WdS(Ni����itdrnvhtdryruntrecursetnobackuptverbosethelps-ds--dryruns-rs	--recurses-ns
--nobackups-vs	--verboses-hs--help(s-ds--dryrun(s-rs	--recurse(s-ns
--nobackup(s-vs	--verbose(s-hs--help(tgetoptRtargvterrorRRRtFalset
makebackupRt
ReindentertstdintrunR	tstdouttcheck(RtoptsRRtotatrR
((s./usr/lib64/python2.7/Tools/scripts/reindent.pytmainBs4"


	


c	Cs6tjj|�r�tjj|�r�tr7dG|GHntj|�}x�|D]�}tjj||�}tr�tjj|�r�tjj|�r�tjj|�dj	d�s�|j
�jd�rMt|�qMqMWdStr�dG|GdGnyt
|d�}Wn.tk
r5}td|t|�f�dSXt|�}|j�|j}t|t�rvtd	|�dS|j�r tr�d
GHtr�dGHq�nts|d}tr�tj||�tr�d
G|GdG|GHq�nt
|d�}|j|�|j�trdG|GHqntStr.dGHntSdS(Nslisting directoryit.s.pytcheckings...trbs%s: I/O Error: %ss0%s: mixed newlines detected; cannot process fileschanged.s+But this is a dry run, so leaving it alone.s.baks	backed upttotwbs	wrote news
unchanged.(tostpathtisdirtislinkRtlistdirtjoinRtsplitt
startswithtlowertendswithRtopentIOErrorRR
Rtclosetnewlinest
isinstancettupleRRRtshutiltcopyfileR	tTrueR(	tfiletnamestnametfullnametfRR"tnewlinetbak((s./usr/lib64/python2.7/Tools/scripts/reindent.pyR_sZ%
 
	


cCsWd�|D�}|jd�tt|��}|s9dSt|�dkrS|dS|S(NcSsXh|]N}|ddkr"dn/|ddkr8dn|ddkrNdnd�qS(i����s
i����s
s
R((t.0tline((s./usr/lib64/python2.7/Tools/scripts/reindent.pys	<setcomp>�s	Rs
ii(tdiscardR8tsortedtlen(tlinesR6((s./usr/lib64/python2.7/Tools/scripts/reindent.pyt_detect_newlines�s

s
 	cCsEt|�}x.|dkr<||d|kr<|d8}qW|| S(sReturn 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>.
    ii(RG(RDtJUNKti((s./usr/lib64/python2.7/Tools/scripts/reindent.pyt_rstrip�s#RcBsSeZd�Zd�Zd�Zd�Zejejej	ej
ejd�ZRS(cCs�d|_d|_|j�|_t|j�|_t|jt�rX|jd|_n|j|_g|jD]}t	|�j
�|j^qn|_|jjdd�d|_g|_dS(Nii(t	find_stmttlevelt	readlinestrawRIR6R7R8RARLt
expandtabsRHtinsertRtindextstats(tselfR@RD((s./usr/lib64/python2.7/Tools/scripts/reindent.pyt__init__�s		/	cCstj|j|j�|j}x'|rH|d|jkrH|j�q"W|j}|jt|�df�i}g}|_	|dd}|j
|d|!�xTtt|�d�D]<}||\}}||dd}t||�}	|d}
|
dkr.|	r%|j
|	d�}
|
dkr�xkt|dt|�d�D]I}||\}}
|
dkrG|	t||�kr�|
d}
nPqGqGWn|
dkr
xgt|ddd�D]L}||\}}
|
dkr�|	t||d�t||�}
Pq�q�Wn|
dkr+|	}
q+q.d}
n|
||	<|
|	}|dksZ|	dkrq|j
|||!�q�x|||!D]p}|dkr�||jkr�|j|�q�|jd||�qtt|�|�}|j||�qWq�W|j|j	kS(Ni����iiiR(ttokenizetgetlinet
tokeneaterRHRAtpopRTtappendRGtaftertextendtranget	getlspacetgettxrangetminRP(RURHRTt	have2wantR\RKtthisstmtt	thisleveltnextstmtthavetwanttjtjlinetjleveltdiffRDtremove((s./usr/lib64/python2.7/Tools/scripts/reindent.pyR�s^		

$
	

cCs|j|j�dS(N(t
writelinesR\(RUR@((s./usr/lib64/python2.7/Tools/scripts/reindent.pyR	scCsD|jt|j�kr!d}n|j|j}|jd7_|S(NRi(RSRGRH(RURD((s./usr/lib64/python2.7/Tools/scripts/reindent.pyRXs
	c
Cs�|\}}||kr$d|_n�||krKd|_|jd7_n�||krrd|_|jd8_nw||	kr�|jr�|jj|df�q�nF||
kr�n7|jr�d|_|r�|jj||jf�q�ndS(Nii����i(RMRNRTR[(
RUttypettokent.3tendRDtINDENTtDEDENTtNEWLINEtCOMMENTtNLtslinetscol((s./usr/lib64/python2.7/Tools/scripts/reindent.pyRYs$						(
t__name__t
__module__RVRR	RXRWRsRtRuRvRwRY(((s./usr/lib64/python2.7/Tools/scripts/reindent.pyR�s		E		
cCsDdt|�}}x*||kr?||dkr?|d7}qW|S(NiRi(RG(RDRKtn((s./usr/lib64/python2.7/Tools/scripts/reindent.pyR_Fst__main__((Rt__version__RWR)R9RtioRRRR;RRRRR#RRIRLRR_Rz(((s./usr/lib64/python2.7/Tools/scripts/reindent.pyt<module>(s&			4	
�	win_add2path.py000064400000003124151732701230007463 0ustar00"""Add Python to the search path on Windows

This is a simple script to add Python to the Windows search path. It
modifies the current user (HKCU) tree of the registry.

Copyright (c) 2008 by Christian Heimes <christian@cheimes.de>
Licensed to PSF under a Contributor Agreement.
"""

import sys
import site
import os
import _winreg

HKCU = _winreg.HKEY_CURRENT_USER
ENV = "Environment"
PATH = "PATH"
DEFAULT = u"%PATH%"

def modify():
    pythonpath = os.path.dirname(os.path.normpath(sys.executable))
    scripts = os.path.join(pythonpath, "Scripts")
    appdata = os.environ["APPDATA"]
    if hasattr(site, "USER_SITE"):
        userpath = site.USER_SITE.replace(appdata, "%APPDATA%")
        userscripts = os.path.join(userpath, "Scripts")
    else:
        userscripts = None

    with _winreg.CreateKey(HKCU, ENV) as key:
        try:
            envpath = _winreg.QueryValueEx(key, PATH)[0]
        except WindowsError:
            envpath = DEFAULT

        paths = [envpath]
        for path in (pythonpath, scripts, userscripts):
            if path and path not in envpath and os.path.isdir(path):
                paths.append(path)

        envpath = os.pathsep.join(paths)
        _winreg.SetValueEx(key, PATH, 0, _winreg.REG_EXPAND_SZ, envpath)
        return paths, envpath

def main():
    paths, envpath = modify()
    if len(paths) > 1:
        print "Path(s) added:"
        print '\n'.join(paths[1:])
    else:
        print "No path was added"
    print "\nPATH is now:\n%s\n" % envpath
    print "Expanded:"
    print _winreg.ExpandEnvironmentStrings(envpath)

if __name__ == '__main__':
    main()
checkappend.pyo000064400000011426151732701230007547 0ustar00�
�fc@s�dZdZddlZddlZddlZddlZdad�Zd�Zd�Z	e
d�\ZZZ
ZZd	d
d
��YZedkr�e�ndS(s�checkappend.py -- search for multi-argument .append() calls.

Usage:  specify one or more file or directory paths:
    checkappend [-v] file_or_dir [file_or_dir] ...

Each file_or_dir is checked for multi-argument .append() calls.  When
a directory, all .py files in the directory, and recursively in its
subdirectories, are checked.

Use -v for status msgs.  Use -vv for more status msgs.

In the absence of -v, the only output is pairs of the form

    filename(linenumber):
    line containing the suspicious append

Note that this finds multi-argument append calls regardless of whether
they're attached to list objects.  If a module defines a class with an
append method that takes more than one argument, calls to that method
will be listed.

Note that this will not find multi-argument list.append calls made via a
bound method object.  For example, this is not caught:

    somelist = []
    push = somelist.append
    push(1, 2, 3)
iii����NcGs3dj|�}tjj|�tjjd�dS(Nt s
(tjointsyststderrtwrite(targstmsg((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pyterrprint+scCs�tjd}y#tjtjdd�\}}Wn/tjk
ra}tt|�dt�dSXx-|D]%\}}|dkritdaqiqiW|s�tt�dSx|D]}t|�q�WdS(Nitvs

s-v(	RtargvtgetoptterrorRtstrt__doc__tverbosetcheck(RtoptsRtopttoptargtarg((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pytmain0s
#

cCsKtjj|�r�tjj|�r�tr:d|fGHntj|�}xq|D]i}tjj||�}tjj|�r�tjj|�s�tjj|d�dkrPt|�qPqPWdSyt	|�}Wn(t
k
r�}td||f�dSXtdkrd|fGHnt||�j
�}trG|rGd|fGHndS(Ns%r: listing directoryi����s.pys%r: I/O Error: %sischecking %r ...s%r: Clean bill of health.(tostpathtisdirtislinkRtlistdirRtnormcaseRtopentIOErrorRt
AppendCheckertrun(tfiletnamestnametfullnametfRtok((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pyRAs*%
iRcBsDeZd�Zd�Zejejejfejej	d�Z
RS(cCs(||_||_t|_d|_dS(Ni(tfnameRtFIND_DOTtstatetnerrors(tselfR%R((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pyt__init__bs			cCsjytj|jj|j�Wn=tjk
r\}td|j|f�|jd|_nX|jdkS(Ns%r: Token Error: %sii(ttokenizeRtreadlinet
tokeneatert
TokenErrorRR%R((R)R((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pyRhsc
Cs�|j}
||krn�|
tkrH||kr�|dkr�t}
q�n�|
tkr�||	kr�|dkr�||_|d|_t}
q�t}
n9|
tkr�||kr�|dkr�d|_t}
q�t}
n�|
tkr�||kr�|dkr
|jd|_q�|dkrA|jd|_|jdkr�t}
q�q�|dkr�|jdkr�|jd|_d|j	|j|jfGHt
}
q�q�n7|
t
kr�||kr�t}
q�ntd
|
f��|
|_dS(Nt.tappendit(it{t[t)t}t]t,s
%s(%d):
%ssunknown internal state '%r'(R1R2R3(R4R5R6(R'R&tFIND_APPENDtlinetlinenotFIND_LPARENtlevelt
FIND_COMMAR(R%t	FIND_STMTtSystemError(R)ttypettokentstarttendR9tNEWLINEtJUNKtOPtNAMER'((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pyR-psF		
					(t__name__t
__module__R*RR+RDtCOMMENTtNLRFRGR-(((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pyRas			t__main__(iii((R
t__version__RRR
R+RRRRtrangeR&R8R;R=R>RRH(((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pyt<module> s			Epathfix.pyo000064400000007376151732701230006756 0ustar00�
�fc@s�ddlZddlZddlZddlTddlZejjZeZej	jZ
dad�Z
ejd�Zd�Zd�Zd�Zd�Zed	kr�e
�ndS(
i����N(t*cCspdtjd}y#tjtjdd�\}}Wn;tjk
rq}t|d�t|�tjd�nXx)|D]!\}}|dkry|aqyqyWts�tddks�|r�td	�t|�tjd�nd}xv|D]n}tjj	|�rt
|�r[d}q[q�tjj|�rFt|d
�d}q�t|�r�d}q�q�Wtj|�dS(Ns0usage: %s -i /interpreter file-or-directory ...
iisi:s
is-it/s'-i option or file-or-directory missing
s": will not process symbolic links
(
tsystargvtgetoptterrorterrtexittnew_interpretertostpathtisdirtrecursedowntislinktfix(tusagetoptstargstmsgtotatbadtarg((s-/usr/lib64/python2.7/Tools/scripts/pathfix.pytmain"s4#




	
s^[a-zA-Z0-9_]+\.py$cCstj|�dkS(Ni(tispythonprogtmatch(tname((s-/usr/lib64/python2.7/Tools/scripts/pathfix.pytispython?scCs1td|f�d}ytj|�}Wn+tjk
rW}td||f�dSX|j�g}x�|D]�}|tjtjfkr�qontjj	||�}tjj
|�r�qotjj|�r�|j|�qot
|�rot|�rd}qqoqoWx#|D]}t|�rd}qqW|S(Nsrecursedown(%r)
is%s: cannot list directory: %r
i(tdbgR	tlistdirRRtsorttcurdirtpardirR
tjoinR
RtappendRRR(tdirnameRtnamesRtsubdirsRtfullname((s-/usr/lib64/python2.7/Tools/scripts/pathfix.pyRBs0



cCs<yt|d�}Wn(tk
r=}td||f�dSX|j�}t|�}||kr~t|d�|j�dStjj	|�\}}tjj
|d|�}yt|d�}Wn2tk
r�}|j�td||f�dSXt|d�|j|�d}	x*|j|	�}
|
s4Pn|j|
�qW|j�|j�y+tj
|�}tj||td@�Wn*tjk
r�}td||f�nXytj||d
�Wn*tjk
r�}td||f�nXytj||�Wn+tjk
r7}td||f�dSXdS(Ntrs%s: cannot open: %r
is: no change
t@tws%s: cannot create: %r
s: updating
iii�s%s: warning: chmod failed (%r)
t~s %s: warning: backup failed (%r)
s%s: rename failed (%r)
ii (topentIOErrorRtreadlinetfixlinetreptcloseR	R
tsplitR!twritetreadtstattchmodtST_MODERtrename(tfilenametfRtlinetfixedtheadttailttempnametgtBUFSIZEtbuftstatbuf((s-/usr/lib64/python2.7/Tools/scripts/pathfix.pyRXsX




cCs+|jd�s|Sd|kr#|SdtS(Ns#!tpythons#! %s
(t
startswithR(R:((s-/usr/lib64/python2.7/Tools/scripts/pathfix.pyR.�s
t__main__(RtreR	R4RtstderrR2RRtstdoutR/tNoneRRtcompileRRRRR.t__name__(((s-/usr/lib64/python2.7/Tools/scripts/pathfix.pyt<module>s 
				5	findnocoding.py000075500000005370151732701230007570 0ustar00#! /usr/bin/python2.7

"""List all those Python files that require a coding directive

Usage: nocoding.py dir1 [dir2...]
"""

__author__ = "Oleg Broytmann, Georg Brandl"

import sys, os, re, getopt

# our pysource module finds Python source files
try:
    import pysource
except ImportError:
    # emulate the module with a simple os.walk
    class pysource:
        has_python_ext = looks_like_python = can_be_compiled = None
        def walk_python_files(self, paths, *args, **kwargs):
            for path in paths:
                if os.path.isfile(path):
                    yield path.endswith(".py")
                elif os.path.isdir(path):
                    for root, dirs, files in os.walk(path):
                        for filename in files:
                            if filename.endswith(".py"):
                                yield os.path.join(root, filename)
    pysource = pysource()


    print >>sys.stderr, ("The pysource module is not available; "
                         "no sophisticated Python source file search will be done.")


decl_re = re.compile(r'^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)')
blank_re = re.compile(r'^[ \t\f]*(?:[#\r\n]|$)')

def get_declaration(line):
    match = decl_re.match(line)
    if match:
        return match.group(1)
    return b''

def has_correct_encoding(text, codec):
    try:
        unicode(text, codec)
    except UnicodeDecodeError:
        return False
    else:
        return True

def needs_declaration(fullpath):
    try:
        infile = open(fullpath, 'rU')
    except IOError: # Oops, the file was removed - ignore it
        return None

    line1 = infile.readline()
    line2 = infile.readline()

    if (get_declaration(line1) or
        blank_re.match(line1) and get_declaration(line2)):
        # the file does have an encoding declaration, so trust it
        infile.close()
        return False

    # check the whole file for non-ASCII characters
    rest = infile.read()
    infile.close()

    if has_correct_encoding(line1+line2+rest, "ascii"):
        return False

    return True


usage = """Usage: %s [-cd] paths...
    -c: recognize Python source files trying to compile them
    -d: debug output""" % sys.argv[0]

try:
    opts, args = getopt.getopt(sys.argv[1:], 'cd')
except getopt.error, msg:
    print >>sys.stderr, msg
    print >>sys.stderr, usage
    sys.exit(1)

is_python = pysource.looks_like_python
debug = False

for o, a in opts:
    if o == '-c':
        is_python = pysource.can_be_compiled
    elif o == '-d':
        debug = True

if not args:
    print >>sys.stderr, usage
    sys.exit(1)

for fullpath in pysource.walk_python_files(args, is_python):
    if debug:
        print "Testing for coding: %s" % fullpath
    result = needs_declaration(fullpath)
    if result:
        print fullpath
mailerdaemon.pyc000064400000016304151732701230007723 0ustar00�
�fc@s�dZddlZddlZddlZddlZddlZdZdejfd��YZdd#d	d$dd
ddddddddgZ	x�e
ee	��D]�Ze	eZ
ee
�ed�kr�eje
ej�Z
nBgZx*e
D]"Z
ejeje
ej��q�Wee�Z
[e
e	e<[
q�W[ddejdej�ejd�ejdej�gZejdejejB�Zd�ZegZd�Zd�Zd �Zed!ks�ejd"ekr�e�ndS(%s6mailerdaemon - classes to parse mailer-daemon messagesi����Nsmailerdaemon.UnparseabletErrorMessagecBs#eZd�Zd�Zd�ZRS(cCs tjj||�d|_dS(Nt(trfc822tMessaget__init__tsub(tselftfp((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyR
scCsU|jd�}|sdS|j�}|jd�r8dSd|krHdS||_dS(NtSubjectiswaiting mailitwarning(t	getheadertlowert
startswithR(RR((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyt
is_warnings	cCsPxCtD];}|j�y||j|j�SWqtk
rAqXqWt�dS(N(t	EMPARSERSt
rewindbodyRRtUnparseable(Rtp((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyt
get_errorss


(t__name__t
__module__RR
R(((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyRs		
s.error: (?P<reason>unresolvable): (?P<email>.+)s?----- The following addresses had permanent fatal errors -----
s(?P<email>[^ 
].*)
( .*
)?s(remote execution.*
.*rmail (?P<email>.+)s8The following recipients did not receive your message:

sK +(?P<email>.*)
(The following recipients did not receive your message:

)?s?------- Failure Reasons  --------

(?P<reason>.*)
(?P<email>.*)s ^<(?P<email>.*)>:
(?P<reason>.*)s=^(?P<reason>User mailbox exceeds allowed size): (?P<email>.+)s0^5\d{2} <(?P<email>[^
>]+)>\.\.\. (?P<reason>.+)s)^Original-Recipient: rfc822;(?P<email>.*)sR^did not reach the following recipient\(s\):

(?P<email>.*) on .*
 +(?P<reason>.*)s+^ <(?P<email>[^
>]+)> \.\.\. (?P<reason>.*)s@^Report on your message to: (?P<email>.*)
Reason: (?P<reason>.*)s^^Your message was not delivered to +(?P<email>.*)
 +for the following reason:
 +(?P<reason>.*)sO^ was not +(?P<email>[^ 
].*?) *
.*
.*
.*
 because:.*
 +(?P<reason>[^ 
].*?) *
Rs^5\d{2} <>\.\.\. (?P<reason>.*)s<>\.\.\. (?P<reason>.*)s^<<< 5\d{2} (?P<reason>.*)s,===== stderr was =====
rmail: (?P<reason>.*)s ^Diagnostic-Code: (?P<reason>.*)s^From:cCs|j�}tj|�}|dkr6t|�}n|jd�}g}g}d}x*tD]"}t|�td�kr|dj|d|�}|dk	r�y|jd�}Wnt	k
r�nXxL|dj
||jd�|�}|dkr�Pn|j|jd��q�WPq�q^|j|d|�}|dk	r^|j|jd��y|jd�}Wnt	k
r{nXPq^q^W|s�t
�n|s�|}|d dkr�|d}nxtD]}t|�td�kr�x�tt|�ddd�D]�}	||	}
tjtj|
�j|jd	��tj�}|j|�}|dk	r�|jd
j|
j�d|jd�j���||	=q�q�Wq�n|j|�}|dk	r�|jd�}Pq�q�Wnx8|D]0}
|jd
j|
j�d|j���q�W|S(
Nitreasonitemailisreturned mail: Ri����s<>t s: ((treadtemparse_list_fromtsearchtNonetlentstarttemparse_list_listttypetgroupt
IndexErrortmatchtendtappendRtemparse_list_reasontrangetretcompiletescapetjointsplitt	MULTILINEtstrip(RRtdatatrest
from_indexterrorstemailsRtregexptiRtexp((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pytemparse_list\sj

"
	

#
03
.cCs@t|�}t|�}||kr(dS||kr8dSdSdS(Ni����ii(tint(tatb((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pytsort_numeric�scCs�tj|�tjd�}i}i}i}d}}}t|d�tjd��}	|	jt�x�|	D]�}
t|
�}t	|�}|j
d�}
d|
|
dfG|j�r�|j�dGH|d}|rntj
|
d	|
�qnqnny|j�}Wn-tk
r4d
GH|d}|j�qnnXt|�GdGHx�|D]�}y7|jd�dd!\}}dtj||f}Wn
d}nX|j|�s�d||<d|
|f||<n||d||<d|
|f||<qKW|j�|d}|rntj
|
d	|
�qnqnWdGH|GdG|GdG|GdGHdGHg}x9|j�D]+}|j|||||||f�q]W|j�x/|D]'\}}}}d||||fGHq�WdS(Ns^[0-9]*$icSs|j|�dk	S(N(R"R(tfntpat((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyt<lambda>�Rt.tFroms	%s	%-40s	iswarning onlyt,s** Not parseableR1tdateis%s %02ds??????s%s (%s)s--------------s
files parsed,sfiles warning-only,sfiles unparseables
%d %s - %s	%si(tostchdirR'R(tfiltertlistdirtsortR:topenRtgetaddrR
tclosetrenameRRRtgetdatetcalendart
month_abbrthas_keytkeysR$(tdirtmodifyR<t	errordictt
errorfirstt	errorlasttnoktnwarntnbadtfilesR;RtmtsenderR1tetmmtddRAtlisttnumtfirsttlast((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pytparsedir�sj












	)
cCs�d}ttj�dkrAtjddkrAd}tjd=nttj�dkr~x2tjdD]}t||�qdWn
td|�dS(Niis-ds/ufs/jack/Mail/errorsinbox(RtsystargvRb(RQtfolder((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pytmain�s(
t__main__i(s?----- The following addresses had permanent fatal errors -----
s(?P<email>[^ 
].*)
( .*
)?(s8The following recipients did not receive your message:

sK +(?P<email>.*)
(The following recipients did not receive your message:

)?(t__doc__RRLR'RBRcRRRRR&RR4txRR(R,txlR$ttupleR%t
IGNORECASERR6RR:RbRfRRd(((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyt<module>s`$	

 
	9			D	redemo.pyo000064400000012201151732701230006545 0ustar00�
�fc@sRdZddlTddlZddd��YZd�ZedkrNe�ndS(	sDBasic regular expression demonstration facility (Perl style syntax).i����(t*NtReDemocBs;eZd�Zd�Zd�Zdd�Zdd�ZRS(c
Cs||_t|jdtdd�|_|jjdtdt�t|j�|_|jjdt�|jj	�|j
�t|jdddt�|_|jjdtdt�t|jdtdd�|_|jjdt�|jjdt�t
|�|_|jjdtdt�t|�|_|jjd�t|jdd	d
|jddd|j�|_|jjdt�t|jdd
d
|jddd|j�|_|jjdt�t|jdddd�|_|jjdtdd�|jjddd�t|jdddt�|_|jjdt�t|j�|_|jjdddt�|jjd|j�|jjd|j�d|_!|j�|jj"�}|jj"|d|d �|jj"�}|jj"|d|d �dS(Ntanchorttexts&Enter a Perl-style regular expression:tsidetfilltsEnter a string to search:tfirstsHighlight first matchtvariabletvaluetcommandsHighlight all matchestalltwidthi<theightitexpandithitt
backgroundtyellowsGroups:s<Key>(#tmastertLabeltWt
promptdisplaytpacktTOPtXtEntrytregexdisplayt	focus_sett
addoptionst
statusdisplaytlabeldisplaytFramet	showframet	StringVartshowvartsettRadiobuttont	recompiletshowfirstradiotLEFTtshowallradiotTextt
stringdisplaytBOTHt
tag_configuret
grouplabeltListboxt	grouplisttbindt
reevaluatetNonetcompiledtbindtags(tselfRtbtags((s,/usr/lib64/python2.7/Tools/scripts/redemo.pyt__init__	sZ	

			
c
Cs�g|_g|_g|_x�dD]�}t|j�ddkrst|j�}|jdt�|jj|�nt	t
|�}t�}t|d	|d
|ddd|d
|j
�}|jdt�|jj|�|jj|�q"WdS(Nt
IGNORECASEtLOCALEt	MULTILINEtDOTALLtVERBOSEiiRRRtoffvaluetonvalueR
R(R8R9R:R;R<(tframestboxestvarstlenRRRRtappendtgetattrtretIntVartCheckbuttonR%R'(R5tnametframetvaltvartbox((s,/usr/lib64/python2.7/Tools/scripts/redemo.pyRHs*			
		cCs4d}x!|jD]}||j�B}qW|}|S(Ni(RAtget(R5tflagsRK((s,/usr/lib64/python2.7/Tools/scripts/redemo.pytgetflags_s
cCs�yNtj|jj�|j��|_|jd}|jjddd|�WnBtj	k
r�}d|_|jjddt|�dd�nX|j�dS(NRRRsre.error: %stred(
REtcompileRRMROR3RRtconfigterrorR2tstrR1(R5teventtbgtmsg((s,/usr/lib64/python2.7/Tools/scripts/redemo.pyR%fs
	c
CsUy|jjddt�Wntk
r-nXy|jjddt�Wntk
r[nX|jjdt�|js|dS|jjddd�|jjddd�|jjdt�}d}d}xJ|t	|�kr|jj
||�}|dkrPn|j�\}}||kr4|d}d}nd}d	|}d	|}	|jj
|||	�|dkr�|jj|�t|j��}
|
jd|j��xDtt	|
��D]-}d
||
|f}|jjt|�q�Wn|d}|jj�dkr�Pq�q�W|dkr>|jjdd
dd�n|jjdd�dS(NRs1.0thit0iRRtorangeis1.0 + %d charss%2d: %rRRs
(no match)R(R*t
tag_removetENDtTclErrorR/tdeleteR3R,RMRBtsearchR2tspanttag_addtyview_pickplacetlisttgroupstinserttgrouptrangeR"RRR(
R5RURtlasttnmatchestmRttagtpfirsttplastRctitg((s,/usr/lib64/python2.7/Tools/scripts/redemo.pyR1ssT

	
	



N(t__name__t
__module__R7RROR2R%R1(((s,/usr/lib64/python2.7/Tools/scripts/redemo.pyRs
	?		
cCs6t�}t|�}|jd|j�|j�dS(NtWM_DELETE_WINDOW(tTkRtprotocoltquittmainloop(troottdemo((s,/usr/lib64/python2.7/Tools/scripts/redemo.pytmain�s	t__main__((t__doc__tTkinterRERRxRo(((s,/usr/lib64/python2.7/Tools/scripts/redemo.pyt<module>s
�	fixheader.pyo000064400000002677151732701230007251 0ustar00�
�fc@s8ddlZd�Zd�Zedkr4e�ndS(i����NcCs,tjd}x|D]}t|�qWdS(Ni(tsystargvtprocess(targstfilename((s//usr/lib64/python2.7/Tools/scripts/fixheader.pytmains

cCs�yt|d�}Wn4tk
rI}tjjd|t|�f�dSX|j�}|j�|d dkr�tjjd|�dSyt|d�}Wn4tk
r�}tjjd|t|�f�dSXtjjd|�d	}xI|D]A}t|�d
kr*|j	�r*||j
�}q�|d}q�W|t_dG|GHd
G|GHdGHdGHdGHH|j|�HdGHdGHdGHdGd|GdGHdS(Ntrs%s: can't open: %s
is/*s!%s does not begin with C comment
tws%s: can't write: %s
sProcessing %s ...
tPy_i�t_s#ifndefs#defines#ifdef __cplusplussextern "C" {s#endift}s	#endif /*t!s*/(topentIOErrorRtstderrtwritetstrtreadtclosetordtisalnumtuppertstdout(Rtftmsgtdatatmagictc((s//usr/lib64/python2.7/Tools/scripts/fixheader.pyRsD 
 
			
t__main__(RRRt__name__(((s//usr/lib64/python2.7/Tools/scripts/fixheader.pyt<module>s		$which.pyo000064400000003140151732701230006376 0ustar00�
�fc@szddlZejdd	kr,ejd=nddlZddlZddlTd�Zd�Zedkrve�ndS(
i����Nit.t(t*cCstjj|d�dS(Ns
(tsyststderrtwrite(tstr((s+/usr/lib64/python2.7/Tools/scripts/which.pytmsg
sc
Cs�tjdjtj�}d}d}tjdrctjdd dkrctjd}tjd=nx]tjdD]N}d}x"|D]}tjj||�}ytj|�}Wntj	k
r�q�nXt
|t�s�t|d�npt
|t�}|d@rO|s|GH|d	 }q]|d	 |kr8d
}	nd}	t|	|�nt|d�|r�tjd
|d|�}|r�tdt|��q�q�q�W|sqt|d�d}qqqqWtj|�dS(NtPATHiRiis-ls: not a disk fileiIis	same as: salso: s: not executablesls t s"ls -l" exit status: s: not found((tostenvirontsplittpathsepRtargvtpathtjointstatterrortS_ISREGtST_MODERtS_IMODEtsystemtreprtexit(
tpathlisttststlonglisttprogtidenttdirtfilenametsttmodets((s+/usr/lib64/python2.7/Tools/scripts/which.pytmainsD$




	
t__main__(RR(RRR
RRR#t__name__(((s+/usr/lib64/python2.7/Tools/scripts/which.pyt<module>s

		+setup.pyo000064400000001044151732701230006435 0ustar00�
�fc@sWddlmZedkrSeddddddd	d
ddd
dddg
�ndS(i����(tsetupt__main__tscriptssbyteyears.pyscheckpyc.pyscopytime.pyscrlf.pys	dutree.pysftpmirror.pysh2py.pyslfcr.pys../i18n/pygettext.pyslogmerge.pys../../Lib/tabnanny.pys../../Lib/timeit.pysuntabify.pyN(tdistutils.coreRt__name__(((s+/usr/lib64/python2.7/Tools/scripts/setup.pyt<module>stexcheck.pyo000064400000020270151732701240007076 0ustar00�
�fc@s�dZddlZddlZddlZddlmZmZmZddlZdZ	d�Z
gd�Zdd�Z
edkr�eje
��ndS(	s� TeXcheck.py -- rough syntax checking on Python style LaTeX documents.

   Written by Raymond D. Hettinger <python at rcn.com>
   Copyright (c) 2003 Python Software Foundation.  All rights reserved.

Designed to catch common markup errors including:
* Unbalanced or mismatched parenthesis, brackets, and braces.
* Unbalanced or mismatched \begin and \end blocks.
* Misspelled or invalid LaTeX commands.
* Use of forward slashes instead of backslashes for commands.
* Table line size mismatches.

Sample command line usage:
    python texcheck.py -k chapterheading -m lib/librandomtex *.tex

Options:
    -m          Munge parenthesis and brackets. [0,n) would normally mismatch.
    -k keyword: Keyword is a valid LaTeX command. Do not include the backslash.
    -d:         Delimiter check only (useful for non-LaTeX files).
    -h:         Help
    -s lineno:  Start at lineno (useful for skipping complex sections).
    -v:         Verbose.  Trace the matching of //begin and //end blocks.
i����N(tiziptcounttislices�
    \section \module \declaremodule \modulesynopsis \moduleauthor
    \sectionauthor \versionadded \code \class \method \begin
    \optional \var \ref \end \subsection \lineiii \hline \label
    \indexii \textrm \ldots \keyword \stindex \index \item \note
    \withsubitem \ttindex \footnote \citetitle \samp \opindex
    \noindent \exception \strong \dfn \ctype \obindex \character
    \indexiii \function \bifuncindex \refmodule \refbimodindex
    \subsubsection \nodename \member \chapter \emph \ASCII \UNIX
    \regexp \program \production \token \productioncont \term
    \grammartoken \lineii \seemodule \file \EOF \documentclass
    \usepackage \title \input \maketitle \ifhtml \fi \url \Cpp
    \tableofcontents \kbd \programopt \envvar \refstmodindex
    \cfunction \constant \NULL \moreargs \cfuncline \cdata
    \textasciicircum \n \ABC \setindexsubitem \versionchanged
    \deprecated \seetext \newcommand \POSIX \pep \warning \rfc
    \verbatiminput \methodline \textgreater \seetitle \lineiv
    \funclineni \ulink \manpage \funcline \dataline \unspecified
    \textbackslash \mimetype \mailheader \seepep \textunderscore
    \longprogramopt \infinity \plusminus \shortversion \version
    \refmodindex \seerfc \makeindex \makemodindex \renewcommand
    \indexname \appendix \protect \indexiv \mbox \textasciitilde
    \platform \seeurl \leftmargin \labelwidth \localmoduletable
    \LaTeX \copyright \memberline \backslash \pi \centerline
    \caption \vspace \textwidth \menuselection \textless
    \makevar \csimplemacro \menuselection \bfcode \sub \release
    \email \kwindex \refexmodindex \filenq \e \menuselection
    \exindex \linev \newsgroup \verbatim \setshortversion
    \author \authoraddress \paragraph \subparagraph \cmemberline
    \textbar \C \seelink
cCsry|j�\}}Wn!tk
r9d||fGHdSX||j||g�krYdSd||||fGHdS(sCVerify that closing delimiter matches most recent opening delimitersU
Delimiter mismatch.  On line %d, encountered closing '%s' without corresponding openNsJ
Opener '%s' on line %d was not closed before encountering '%s' on line %d(tpopt
IndexErrortget(tc_linenotc_symboltopenerstpairmapto_linenoto_symbol((s./usr/lib64/python2.7/Tools/scripts/texcheck.pyt
matchclose?s
c#CsPtjd�}tjd�}ttj��}x|D]}|jd|�q7Wd|kruidd6dd6}nid	d6d
d6}td�}tjd�}	tjd�}
tjd
�}tjd�}g}
g}tjd�}tjd�}tjd�}d}d}t|jdd��}d}x�tt	|�t
||dd/��D]�\}}|j�}x�|	j
|�D]�\}}}d|kr�|GdG|G|G|Gn|dkr�d|kr�|
j||f�nr||kr|
j||f�nP|dkr2d|kr2t|||
|�n"||krTt|||
|�nd|kr�dG|
GHq�q�Wxv|
j
|�D]e\}}|dkr�|j|�n|dkr�y|j�Wq�tk
r�d|fGHq�Xq�q�Wd|kr�qZnxW|j
|�D]F}d |ksd!|kr/qnd||krd"||fGHqqWx)|j
|�D]}d#|||fGHqeW|jd$�}|d%kr�|jd|�}|jd|�}|j||d|!�nx5|j
|�D]$}||kr�d&||fGHq�q�W|j|�}|r@|jd�}|}n|j|�}|r�|jd�|kr�d'|jd�|||fGHn|j|�r�d}nd(|ks�d)|kr�d*|fGHnx&|j
|�D]} d+| |fGHq�WqZW|}!x#|
D]\}}"d,|"|fGHqWx|D]}d-|fGHq*Wd.|!fGHdS(0s�Check the LaTeX formatting in a sequence of lines.

    Opts is a mapping of options to option values if any:
        -m          munge parenthesis and brackets
        -d          delimiters only checking
        -v          verbose trace of delimiter matching
        -s lineno:  linenumber to start scan (default is 1).

    Morecmds is a sequence of LaTeX commands (without backslashes) that
    are to be considered valid in the scan.
    s\\[A-Za-z]+s
\/([A-Za-z]+)s\s-ms[(t]s([t)t[t(s&\\(begin|end){([_a-zA-Z]+)}|([()\[\]])s({)|(})s(\b[A-za-z]+\b) \b\1\bs<\\(ABC|ASCII|C|Cpp|EOF|infinity|NULL|plusminus|POSIX|UNIX)\ss\\begin{(?:long)?table([iv]+)}s\\line([iv]+){s\\end{(?:long)?table([iv]+)}tis-st1is-vt|tbegins-dtends   --> t{t}s Warning, unmatched } on line %s.t822s.htmls4Warning, forward slash used on line %d with cmd: /%ss2Warning, \%s should be written as \%s{} on line %ds\newcommandi����s(Warning, unknown tex cmd on line %d: \%ss>Warning, \line%s on line %d does not match \table%s on line %dse.g.si.e.s2Style warning, avoid use of i.e or e.g. on line %ds&Doubled word warning.  "%s" on line %ds(Unmatched open delimiter '%s' on line %dsUnmatched { on line %dsDone checking %d lines.N(tretcompiletsettcmdstrtsplittaddtintRRRRtNonetrstriptfindalltappendRRRtfindtsearchtgroup(#tsourcetoptstmorecmdsttexcmdtfalsetexcmdt	validcmdstcmdR	t	openpunctt
delimiterstbracestdoubledwordst
spacingmarkupRt
bracestackt
tablestartt	tablelinettableendt
tablelevelttablestartlinet	startlinetlinenotlinetbegendtnametpuncttopentclosetnctstartRtmtdwtlastlinetsymbol((s./usr/lib64/python2.7/Tools/scripts/texcheck.pytcheckitJs�

2
	!	
cCs�|dkrtjd}ntj|d�\}}t|�}d|ksX|gkratGHdSt|�dkr|dGHdSxOt|�D]A\}}d|ks�d|kr�tj|�|||d+q�q�Wg|D]\}}|dkr�|^q�}g}	x}|D]u}
d	d
GHdG|
GHyt	|
�}Wnt
k
rOd|dGHd
SXz|	jt|||��Wd|j
�XqWt|	�S(Nisk:mdhs:vs-his#Please specify a file to be checkedt*t?s-kt=itCheckingsCannot open file %s.i(R tsystargvtgetopttdictt__doc__tlent	enumeratetglobR?tIOErrorR#RGR@tmax(targstoptitemstarglistR(titfilespectktvR)terrtfilenametf((s./usr/lib64/python2.7/Tools/scripts/texcheck.pytmain�s6!+
		

t__main__(RPRRLRNt	itertoolsRRRRSRRRGR R`t__name__texit(((s./usr/lib64/python2.7/Tools/scripts/texcheck.pyt<module>s 	z$redemo.py000075500000013240151732701240006376 0ustar00#! /usr/bin/python2.7
"""Basic regular expression demonstration facility (Perl style syntax)."""

from Tkinter import *
import re

class ReDemo:

    def __init__(self, master):
        self.master = master

        self.promptdisplay = Label(self.master, anchor=W,
                text="Enter a Perl-style regular expression:")
        self.promptdisplay.pack(side=TOP, fill=X)

        self.regexdisplay = Entry(self.master)
        self.regexdisplay.pack(fill=X)
        self.regexdisplay.focus_set()

        self.addoptions()

        self.statusdisplay = Label(self.master, text="", anchor=W)
        self.statusdisplay.pack(side=TOP, fill=X)

        self.labeldisplay = Label(self.master, anchor=W,
                text="Enter a string to search:")
        self.labeldisplay.pack(fill=X)
        self.labeldisplay.pack(fill=X)

        self.showframe = Frame(master)
        self.showframe.pack(fill=X, anchor=W)

        self.showvar = StringVar(master)
        self.showvar.set("first")

        self.showfirstradio = Radiobutton(self.showframe,
                                         text="Highlight first match",
                                          variable=self.showvar,
                                          value="first",
                                          command=self.recompile)
        self.showfirstradio.pack(side=LEFT)

        self.showallradio = Radiobutton(self.showframe,
                                        text="Highlight all matches",
                                        variable=self.showvar,
                                        value="all",
                                        command=self.recompile)
        self.showallradio.pack(side=LEFT)

        self.stringdisplay = Text(self.master, width=60, height=4)
        self.stringdisplay.pack(fill=BOTH, expand=1)
        self.stringdisplay.tag_configure("hit", background="yellow")

        self.grouplabel = Label(self.master, text="Groups:", anchor=W)
        self.grouplabel.pack(fill=X)

        self.grouplist = Listbox(self.master)
        self.grouplist.pack(expand=1, fill=BOTH)

        self.regexdisplay.bind('<Key>', self.recompile)
        self.stringdisplay.bind('<Key>', self.reevaluate)

        self.compiled = None
        self.recompile()

        btags = self.regexdisplay.bindtags()
        self.regexdisplay.bindtags(btags[1:] + btags[:1])

        btags = self.stringdisplay.bindtags()
        self.stringdisplay.bindtags(btags[1:] + btags[:1])

    def addoptions(self):
        self.frames = []
        self.boxes = []
        self.vars = []
        for name in ('IGNORECASE',
                     'LOCALE',
                     'MULTILINE',
                     'DOTALL',
                     'VERBOSE'):
            if len(self.boxes) % 3 == 0:
                frame = Frame(self.master)
                frame.pack(fill=X)
                self.frames.append(frame)
            val = getattr(re, name)
            var = IntVar()
            box = Checkbutton(frame,
                    variable=var, text=name,
                    offvalue=0, onvalue=val,
                    command=self.recompile)
            box.pack(side=LEFT)
            self.boxes.append(box)
            self.vars.append(var)

    def getflags(self):
        flags = 0
        for var in self.vars:
            flags = flags | var.get()
        flags = flags
        return flags

    def recompile(self, event=None):
        try:
            self.compiled = re.compile(self.regexdisplay.get(),
                                       self.getflags())
            bg = self.promptdisplay['background']
            self.statusdisplay.config(text="", background=bg)
        except re.error, msg:
            self.compiled = None
            self.statusdisplay.config(
                    text="re.error: %s" % str(msg),
                    background="red")
        self.reevaluate()

    def reevaluate(self, event=None):
        try:
            self.stringdisplay.tag_remove("hit", "1.0", END)
        except TclError:
            pass
        try:
            self.stringdisplay.tag_remove("hit0", "1.0", END)
        except TclError:
            pass
        self.grouplist.delete(0, END)
        if not self.compiled:
            return
        self.stringdisplay.tag_configure("hit", background="yellow")
        self.stringdisplay.tag_configure("hit0", background="orange")
        text = self.stringdisplay.get("1.0", END)
        last = 0
        nmatches = 0
        while last <= len(text):
            m = self.compiled.search(text, last)
            if m is None:
                break
            first, last = m.span()
            if last == first:
                last = first+1
                tag = "hit0"
            else:
                tag = "hit"
            pfirst = "1.0 + %d chars" % first
            plast = "1.0 + %d chars" % last
            self.stringdisplay.tag_add(tag, pfirst, plast)
            if nmatches == 0:
                self.stringdisplay.yview_pickplace(pfirst)
                groups = list(m.groups())
                groups.insert(0, m.group())
                for i in range(len(groups)):
                    g = "%2d: %r" % (i, groups[i])
                    self.grouplist.insert(END, g)
            nmatches = nmatches + 1
            if self.showvar.get() == "first":
                break

        if nmatches == 0:
            self.statusdisplay.config(text="(no match)",
                                      background="yellow")
        else:
            self.statusdisplay.config(text="")


# Main function, run when invoked as a stand-alone Python program.

def main():
    root = Tk()
    demo = ReDemo(root)
    root.protocol('WM_DELETE_WINDOW', root.quit)
    root.mainloop()

if __name__ == '__main__':
    main()
linktree.py000075500000004570151732701240006746 0ustar00#! /usr/bin/python2.7

# linktree
#
# Make a copy of a directory tree with symbolic links to all files in the
# original tree.
# All symbolic links go to a special symbolic link at the top, so you
# can easily fix things if the original source tree moves.
# See also "mkreal".
#
# usage: mklinks oldtree newtree

import sys, os

LINK = '.LINK' # Name of special symlink at the top.

debug = 0

def main():
    if not 3 <= len(sys.argv) <= 4:
        print 'usage:', sys.argv[0], 'oldtree newtree [linkto]'
        return 2
    oldtree, newtree = sys.argv[1], sys.argv[2]
    if len(sys.argv) > 3:
        link = sys.argv[3]
        link_may_fail = 1
    else:
        link = LINK
        link_may_fail = 0
    if not os.path.isdir(oldtree):
        print oldtree + ': not a directory'
        return 1
    try:
        os.mkdir(newtree, 0777)
    except os.error, msg:
        print newtree + ': cannot mkdir:', msg
        return 1
    linkname = os.path.join(newtree, link)
    try:
        os.symlink(os.path.join(os.pardir, oldtree), linkname)
    except os.error, msg:
        if not link_may_fail:
            print linkname + ': cannot symlink:', msg
            return 1
        else:
            print linkname + ': warning: cannot symlink:', msg
    linknames(oldtree, newtree, link)
    return 0

def linknames(old, new, link):
    if debug: print 'linknames', (old, new, link)
    try:
        names = os.listdir(old)
    except os.error, msg:
        print old + ': warning: cannot listdir:', msg
        return
    for name in names:
        if name not in (os.curdir, os.pardir):
            oldname = os.path.join(old, name)
            linkname = os.path.join(link, name)
            newname = os.path.join(new, name)
            if debug > 1: print oldname, newname, linkname
            if os.path.isdir(oldname) and \
               not os.path.islink(oldname):
                try:
                    os.mkdir(newname, 0777)
                    ok = 1
                except:
                    print newname + \
                          ': warning: cannot mkdir:', msg
                    ok = 0
                if ok:
                    linkname = os.path.join(os.pardir,
                                            linkname)
                    linknames(oldname, newname, linkname)
            else:
                os.symlink(linkname, newname)

if __name__ == '__main__':
    sys.exit(main())
byext.pyo000064400000010651151732701240006435 0ustar00�
�fc@sddZddlmZddlZddlZddd��YZd�Zedkr`e�ndS(	s"Show file statistics by extension.i����(tprint_functionNtStatscBs>eZd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs
i|_dS(N(tstats(tself((s+/usr/lib64/python2.7/Tools/scripts/byext.pyt__init__scCs�xy|D]q}tjj|�r/|j|�qtjj|�rQ|j|�qtjjd|�|j	ddd�qWdS(NsCan't find %s
s<???>tunknowni(
tostpathtisdirtstatdirtisfiletstatfiletsyststderrtwritetaddstats(Rtargstarg((s+/usr/lib64/python2.7/Tools/scripts/byext.pytstatargss
cCs|jddd�yttj|��}WnDtjk
rr}tjjd||f�|jddd�dSXx�|D]�}|jd�r�qzn|j	d�r�qzntj
j||�}tj
j|�r�|jdd	d�qztj
j
|�r	|j|�qz|j|�qzWdS(
Ns<dir>tdirsisCan't list %s: %s
t
unlistables.#t~s<lnk>tlinks(RtsortedRtlistdirterrorRR
Rt
startswithtendswithRtjointislinkRR	R(Rtdirtnamesterrtnametfull((s+/usr/lib64/python2.7/Tools/scripts/byext.pyR	s$
c
Cs�tjj|�\}}tjj|�\}}||krEd}ntjj|�}|sfd}n|j|dd�yt|d�}WnAtk
r�}tj	j
d||f�|j|dd�dSX|j�}|j�|j|dt
|��d	|kr"|j|d
d�dS|s>|j|dd�n|j�}|j|dt
|��~|j�}	|j|d
t
|	��dS(Nts<none>tfilesitrbsCan't open %s: %s
t
unopenabletbytesstbinarytemptytlinestwords(RRtsplitexttsplittnormcaseRtopentIOErrorRR
Rtreadtclosetlent
splitlines(
RtfilenametheadtexttbasetfR tdataR*R+((s+/usr/lib64/python2.7/Tools/scripts/byext.pyR.s6		
cCs3|jj|i�}|j|d�|||<dS(Ni(Rt
setdefaulttget(RR7tkeytntd((s+/usr/lib64/python2.7/Tools/scripts/byext.pyRLscst|jj��}i}x"|D]}|j|j|�q"Wt|j���i�tg|D]}t|�^qb��d<d}i|jd<x��D]�}d}t|t|��}xb|D]Z}|j|j|�}|dkr�d}	ntd|�}	||7}t||	�}q�Wt|tt|���}|�|<||jd|<q�W|j	d�x|D]}||j|d<qoW�j
dd���fd�}
|
�x]|D]U}xE�D]=}|j|j|d�}td�||fd	d
�q�Wt�q�W|
�dS(NR7itTOTALis%dcs:x,�D]$}td�||fdd�qWt�dS(Ns%*stendt (tprint(tcol(tcolstcolwidth(s+/usr/lib64/python2.7/Tools/scripts/byext.pytprintheaderms
"R#s%*sRARB(RRtkeystupdatetmaxR3R<tNonetstrtappendtinsertRC(RtextstcolumnsR7tminwidthRDttotaltcwtvaluetwRG((RERFs+/usr/lib64/python2.7/Tools/scripts/byext.pytreportPsD
)


	





"(t__name__t
__module__RRR	RRRV(((s+/usr/lib64/python2.7/Tools/scripts/byext.pyR
s		
			cCsFtjd}|s"tjg}nt�}|j|�|j�dS(Ni(RtargvRtcurdirRRRV(Rts((s+/usr/lib64/python2.7/Tools/scripts/byext.pytmainys
	
t__main__((t__doc__t
__future__RRRRR\RW(((s+/usr/lib64/python2.7/Tools/scripts/byext.pyt<module>so	cvsfiles.py000075500000003372151732701250006747 0ustar00#! /usr/bin/python2.7

"""Print a list of files that are mentioned in CVS directories.

Usage: cvsfiles.py [-n file] [directory] ...

If the '-n file' option is given, only files under CVS that are newer
than the given file are printed; by default, all files under CVS are
printed.  As a special case, if a file does not exist, it is always
printed.
"""

import os
import sys
import stat
import getopt

cutofftime = 0

def main():
    try:
        opts, args = getopt.getopt(sys.argv[1:], "n:")
    except getopt.error, msg:
        print msg
        print __doc__,
        return 1
    global cutofftime
    newerfile = None
    for o, a in opts:
        if o == '-n':
            cutofftime = getmtime(a)
    if args:
        for arg in args:
            process(arg)
    else:
        process(".")

def process(dir):
    cvsdir = 0
    subdirs = []
    names = os.listdir(dir)
    for name in names:
        fullname = os.path.join(dir, name)
        if name == "CVS":
            cvsdir = fullname
        else:
            if os.path.isdir(fullname):
                if not os.path.islink(fullname):
                    subdirs.append(fullname)
    if cvsdir:
        entries = os.path.join(cvsdir, "Entries")
        for e in open(entries).readlines():
            words = e.split('/')
            if words[0] == '' and words[1:]:
                name = words[1]
                fullname = os.path.join(dir, name)
                if cutofftime and getmtime(fullname) <= cutofftime:
                    pass
                else:
                    print fullname
    for sub in subdirs:
        process(sub)

def getmtime(filename):
    try:
        st = os.stat(filename)
    except os.error:
        return 0
    return st[stat.ST_MTIME]

if __name__ == '__main__':
    main()
serve.pyc000064400000003075151732701250006415 0ustar00�
�fc@s�dZddlZddlZddlZddlmZmZd�Zedkr�ej	dZ
eej	�dkr�eej	d�ndZ
ejd	e
e�Zd
e
e
fGHyej�Wq�ek
r�dGHq�XndS(s

Small wsgiref based web server. Takes a path to serve from and an
optional port number (defaults to 8000), then tries to serve files.
Mime types are guessed from the file names, 404 errors are raised
if the file is not found. Used for the make serve target in Doc.
i����N(t
simple_servertutilcCs�tjjt|dd�}d|jtjj�dkrTtjj|d�}ntj|�d}tjj|�r�|dd|fg�tj	t
|��S|d	dg�dgSdS(
Nt	PATH_INFOit.i����s
index.htmlis200 OKsContent-Types
404 Not Founds
text/plains	not found(sContent-Types
text/plain(tostpathtjointsplittsept	mimetypest
guess_typetexistsRtFileWrappertopen(tenvirontrespondtfnttype((s+/usr/lib64/python2.7/Tools/scripts/serve.pytapp
st__main__iii@ts(Serving %s on port %s, control-C to stopsShutting down.(t__doc__tsysRR	twsgirefRRRt__name__targvRtlentinttporttmake_serverthttpdt
serve_forevertKeyboardInterrupt(((s+/usr/lib64/python2.7/Tools/scripts/serve.pyt<module>s	
.
svneol.pyc000064400000005530151732701250006575 0ustar00�
�fc@s�dZddlZddlZd�Zd�Zejd�jZx�ejd�D]�\Z	Z
Zde
kr}e
jd�nx[eD]SZ
ee
�r�dee	e
�kr�ejje	e
�Zejd	e�q�q�q�WqRWdS(
s�
SVN helper script.

Try to set the svn:eol-style property to "native" on every .py, .txt, .c and
.h file in the directory tree rooted at the current directory.

Files with the svn:eol-style property already set (to anything) are skipped.

svn will itself refuse to set this property on a file that's not under SVN
control, or that has a binary mime-type property set.  This script inherits
that behavior, and passes on whatever warning message the failing "svn
propset" command produces.

In the Python project, it's safe to invoke this script from the root of
a checkout.

No output is produced for files that are ignored.  For a file that gets
svn:eol-style set, output looks like:

    property 'svn:eol-style' set on 'Lib\ctypes\__init__.py'

For a file not under version control:

    svn: warning: 'patch-finalizer.txt' is not under version control

and for a file with a binary mime-type property:

    svn: File 'Lib	est	est_pep263.py' has binary mime type property
i����NcCs�tjj|dd|d�}y4tttjj|dd��j�j��}Wntk
rggSX|d
kr�tjj|dd|d�tjj|dd|d�gStd	�dS(Ns.svntpropss	.svn-worktformatii	s	prop-bases	.svn-basesUnknown repository format(ii	(	tostpathtjointinttopentreadtstriptIOErrort
ValueError(troottfntdefaultR((s,/usr/lib64/python2.7/Tools/scripts/svneol.pyt	propfiles$s4
 c	Csg}xt||�D]�}yt|�}Wntk
rBqnXx�|j�}|jd�rePn|jd�szt�t|j�d�}|j|�}|j	|�|j�|j�}|jd�s�t�t|j�d�}|j|�}|j�qFW|j
�qW|S(s=Return a list of property names for file fn in directory roottENDsK isV (RRR	treadlinet
startswithtAssertionErrorRtsplitRtappendtclose(	RRtresultRtftlinetLtkeytvalue((s,/usr/lib64/python2.7/Tools/scripts/svneol.pytproplist1s,


s\.([hc]|py|txt|sln|vcproj)$t.s.svns
svn:eol-styles%svn propset svn:eol-style native "%s"(t__doc__treRRRtcompiletsearchtpossible_text_filetwalkRtdirstfilestremoveRRRtsystem(((s,/usr/lib64/python2.7/Tools/scripts/svneol.pyt<module>s	
	!
fixnotice.py000075500000005753151732701260007127 0ustar00#! /usr/bin/python2.7

"""(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.
"""

OLD_NOTICE = """/***********************************************************
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.
******************************************************************/
"""
import os
import sys
import getopt

NEW_NOTICE = ""
DRYRUN = 0
VERBOSE = 0


def usage(code, msg=''):
    print __doc__ % globals()
    if msg:
        print msg
    sys.exit(code)


def main():
    global DRYRUN, OLD_NOTICE, NEW_NOTICE, VERBOSE
    try:
        opts, args = getopt.getopt(sys.argv[1:], 'hv',
                                   ['help', 'oldnotice=', 'newnotice=',
                                    'dry-run', 'verbose'])
    except getopt.error, msg:
        usage(1, msg)

    for opt, arg in opts:
        if opt in ('-h', '--help'):
            usage(0)
        elif opt in ('-v', '--verbose'):
            VERBOSE = 1
        elif opt == '--dry-run':
            DRYRUN = 1
        elif opt == '--oldnotice':
            fp = open(arg)
            OLD_NOTICE = fp.read()
            fp.close()
        elif opt == '--newnotice':
            fp = open(arg)
            NEW_NOTICE = fp.read()
            fp.close()

    for arg in args:
        process(arg)


def process(file):
    f = open(file)
    data = f.read()
    f.close()
    i = data.find(OLD_NOTICE)
    if i < 0:
        if VERBOSE:
            print 'no change:', file
        return
    elif DRYRUN or VERBOSE:
        print '   change:', file
    if DRYRUN:
        # Don't actually change the file
        return
    data = data[:i] + NEW_NOTICE + data[i+len(OLD_NOTICE):]
    new = file + ".new"
    backup = file + ".bak"
    f = open(new, "w")
    f.write(data)
    f.close()
    os.rename(file, backup)
    os.rename(new, file)


if __name__ == '__main__':
    main()
lfcr.py000075500000001152151732701260006052 0ustar00#! /usr/bin/python2.7

"Replace LF with CRLF in argument files.  Print names of changed files."

import sys, re, os

def main():
    for filename in sys.argv[1:]:
        if os.path.isdir(filename):
            print filename, "Directory!"
            continue
        data = open(filename, "rb").read()
        if '\0' in data:
            print filename, "Binary!"
            continue
        newdata = re.sub("\r?\n", "\r\n", data)
        if newdata != data:
            print filename
            f = open(filename, "wb")
            f.write(newdata)
            f.close()

if __name__ == '__main__':
    main()
pindent.py000075500000041422151732701270006572 0ustar00#! /usr/bin/python2.7

# This file contains a class and a main program that perform three
# related (though complimentary) formatting operations on Python
# programs.  When called as "pindent -c", it takes a valid Python
# program as input and outputs a version augmented with block-closing
# comments.  When called as "pindent -d", it assumes its input is a
# Python program with block-closing comments and outputs a commentless
# version.   When called as "pindent -r" it assumes its input is a
# Python program with block-closing comments but with its indentation
# messed up, and outputs a properly indented version.

# A "block-closing comment" is a comment of the form '# end <keyword>'
# where <keyword> is the keyword that opened the block.  If the
# opening keyword is 'def' or 'class', the function or class name may
# be repeated in the block-closing comment as well.  Here is an
# example of a program fully augmented with block-closing comments:

# def foobar(a, b):
#    if a == b:
#        a = a+1
#    elif a < b:
#        b = b-1
#        if b > a: a = a-1
#        # end if
#    else:
#        print 'oops!'
#    # end if
# # end def foobar

# Note that only the last part of an if...elif...else... block needs a
# block-closing comment; the same is true for other compound
# statements (e.g. try...except).  Also note that "short-form" blocks
# like the second 'if' in the example must be closed as well;
# otherwise the 'else' in the example would be ambiguous (remember
# that indentation is not significant when interpreting block-closing
# comments).

# The operations are idempotent (i.e. applied to their own output
# they yield an identical result).  Running first "pindent -c" and
# then "pindent -r" on a valid Python program produces a program that
# is semantically identical to the input (though its indentation may
# be different). Running "pindent -e" on that output produces a
# program that only differs from the original in indentation.

# Other options:
# -s stepsize: set the indentation step size (default 8)
# -t tabsize : set the number of spaces a tab character is worth (default 8)
# -e         : expand TABs into spaces
# file ...   : input file(s) (default standard input)
# The results always go to standard output

# Caveats:
# - comments ending in a backslash will be mistaken for continued lines
# - continuations using backslash are always left unchanged
# - continuations inside parentheses are not extra indented by -r
#   but must be indented for -c to work correctly (this breaks
#   idempotency!)
# - continued lines inside triple-quoted strings are totally garbled

# Secret feature:
# - On input, a block may also be closed with an "end statement" --
#   this is a block-closing comment without the '#' sign.

# Possible improvements:
# - check syntax based on transitions in 'next' table
# - better error reporting
# - better error recovery
# - check identifier after class/def

# The following wishes need a more complete tokenization of the source:
# - Don't get fooled by comments ending in backslash
# - reindent continuation lines indicated by backslash
# - handle continuation lines inside parentheses/braces/brackets
# - handle triple quoted strings spanning lines
# - realign comments
# - optionally do much more thorough reformatting, a la C indent

from __future__ import print_function

# Defaults
STEPSIZE = 8
TABSIZE = 8
EXPANDTABS = False

import io
import re
import sys

next = {}
next['if'] = next['elif'] = 'elif', 'else', 'end'
next['while'] = next['for'] = 'else', 'end'
next['try'] = 'except', 'finally'
next['except'] = 'except', 'else', 'finally', 'end'
next['else'] = next['finally'] = next['with'] = \
    next['def'] = next['class'] = 'end'
next['end'] = ()
start = 'if', 'while', 'for', 'try', 'with', 'def', 'class'

class PythonIndenter:

    def __init__(self, fpi = sys.stdin, fpo = sys.stdout,
                 indentsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS):
        self.fpi = fpi
        self.fpo = fpo
        self.indentsize = indentsize
        self.tabsize = tabsize
        self.lineno = 0
        self.expandtabs = expandtabs
        self._write = fpo.write
        self.kwprog = re.compile(
                r'^(?:\s|\\\n)*(?P<kw>[a-z]+)'
                r'((?:\s|\\\n)+(?P<id>[a-zA-Z_]\w*))?'
                r'[^\w]')
        self.endprog = re.compile(
                r'^(?:\s|\\\n)*#?\s*end\s+(?P<kw>[a-z]+)'
                r'(\s+(?P<id>[a-zA-Z_]\w*))?'
                r'[^\w]')
        self.wsprog = re.compile(r'^[ \t]*')
    # end def __init__

    def write(self, line):
        if self.expandtabs:
            self._write(line.expandtabs(self.tabsize))
        else:
            self._write(line)
        # end if
    # end def write

    def readline(self):
        line = self.fpi.readline()
        if line: self.lineno += 1
        # end if
        return line
    # end def readline

    def error(self, fmt, *args):
        if args: fmt = fmt % args
        # end if
        sys.stderr.write('Error at line %d: %s\n' % (self.lineno, fmt))
        self.write('### %s ###\n' % fmt)
    # end def error

    def getline(self):
        line = self.readline()
        while line[-2:] == '\\\n':
            line2 = self.readline()
            if not line2: break
            # end if
            line += line2
        # end while
        return line
    # end def getline

    def putline(self, line, indent):
        tabs, spaces = divmod(indent*self.indentsize, self.tabsize)
        i = self.wsprog.match(line).end()
        line = line[i:]
        if line[:1] not in ('\n', '\r', ''):
            line = '\t'*tabs + ' '*spaces + line
        # end if
        self.write(line)
    # end def putline

    def reformat(self):
        stack = []
        while True:
            line = self.getline()
            if not line: break      # EOF
            # end if
            m = self.endprog.match(line)
            if m:
                kw = 'end'
                kw2 = m.group('kw')
                if not stack:
                    self.error('unexpected end')
                elif stack.pop()[0] != kw2:
                    self.error('unmatched end')
                # end if
                self.putline(line, len(stack))
                continue
            # end if
            m = self.kwprog.match(line)
            if m:
                kw = m.group('kw')
                if kw in start:
                    self.putline(line, len(stack))
                    stack.append((kw, kw))
                    continue
                # end if
                if next.has_key(kw) and stack:
                    self.putline(line, len(stack)-1)
                    kwa, kwb = stack[-1]
                    stack[-1] = kwa, kw
                    continue
                # end if
            # end if
            self.putline(line, len(stack))
        # end while
        if stack:
            self.error('unterminated keywords')
            for kwa, kwb in stack:
                self.write('\t%s\n' % kwa)
            # end for
        # end if
    # end def reformat

    def delete(self):
        begin_counter = 0
        end_counter = 0
        while True:
            line = self.getline()
            if not line: break      # EOF
            # end if
            m = self.endprog.match(line)
            if m:
                end_counter += 1
                continue
            # end if
            m = self.kwprog.match(line)
            if m:
                kw = m.group('kw')
                if kw in start:
                    begin_counter += 1
                # end if
            # end if
            self.write(line)
        # end while
        if begin_counter - end_counter < 0:
            sys.stderr.write('Warning: input contained more end tags than expected\n')
        elif begin_counter - end_counter > 0:
            sys.stderr.write('Warning: input contained less end tags than expected\n')
        # end if
    # end def delete

    def complete(self):
        stack = []
        todo = []
        currentws = thisid = firstkw = lastkw = topid = ''
        while True:
            line = self.getline()
            i = self.wsprog.match(line).end()
            m = self.endprog.match(line)
            if m:
                thiskw = 'end'
                endkw = m.group('kw')
                thisid = m.group('id')
            else:
                m = self.kwprog.match(line)
                if m:
                    thiskw = m.group('kw')
                    if not next.has_key(thiskw):
                        thiskw = ''
                    # end if
                    if thiskw in ('def', 'class'):
                        thisid = m.group('id')
                    else:
                        thisid = ''
                    # end if
                elif line[i:i+1] in ('\n', '#'):
                    todo.append(line)
                    continue
                else:
                    thiskw = ''
                # end if
            # end if
            indentws = line[:i]
            indent = len(indentws.expandtabs(self.tabsize))
            current = len(currentws.expandtabs(self.tabsize))
            while indent < current:
                if firstkw:
                    if topid:
                        s = '# end %s %s\n' % (
                                firstkw, topid)
                    else:
                        s = '# end %s\n' % firstkw
                    # end if
                    self.write(currentws + s)
                    firstkw = lastkw = ''
                # end if
                currentws, firstkw, lastkw, topid = stack.pop()
                current = len(currentws.expandtabs(self.tabsize))
            # end while
            if indent == current and firstkw:
                if thiskw == 'end':
                    if endkw != firstkw:
                        self.error('mismatched end')
                    # end if
                    firstkw = lastkw = ''
                elif not thiskw or thiskw in start:
                    if topid:
                        s = '# end %s %s\n' % (
                                firstkw, topid)
                    else:
                        s = '# end %s\n' % firstkw
                    # end if
                    self.write(currentws + s)
                    firstkw = lastkw = topid = ''
                # end if
            # end if
            if indent > current:
                stack.append((currentws, firstkw, lastkw, topid))
                if thiskw and thiskw not in start:
                    # error
                    thiskw = ''
                # end if
                currentws, firstkw, lastkw, topid = \
                          indentws, thiskw, thiskw, thisid
            # end if
            if thiskw:
                if thiskw in start:
                    firstkw = lastkw = thiskw
                    topid = thisid
                else:
                    lastkw = thiskw
                # end if
            # end if
            for l in todo: self.write(l)
            # end for
            todo = []
            if not line: break
            # end if
            self.write(line)
        # end while
    # end def complete
# end class PythonIndenter

# Simplified user interface
# - xxx_filter(input, output): read and write file objects
# - xxx_string(s): take and return string object
# - xxx_file(filename): process file in place, return true iff changed

def complete_filter(input = sys.stdin, output = sys.stdout,
                    stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS):
    pi = PythonIndenter(input, output, stepsize, tabsize, expandtabs)
    pi.complete()
# end def complete_filter

def delete_filter(input= sys.stdin, output = sys.stdout,
                        stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS):
    pi = PythonIndenter(input, output, stepsize, tabsize, expandtabs)
    pi.delete()
# end def delete_filter

def reformat_filter(input = sys.stdin, output = sys.stdout,
                    stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS):
    pi = PythonIndenter(input, output, stepsize, tabsize, expandtabs)
    pi.reformat()
# end def reformat_filter

def complete_string(source, stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS):
    input = io.BytesIO(source)
    output = io.BytesIO()
    pi = PythonIndenter(input, output, stepsize, tabsize, expandtabs)
    pi.complete()
    return output.getvalue()
# end def complete_string

def delete_string(source, stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS):
    input = io.BytesIO(source)
    output = io.BytesIO()
    pi = PythonIndenter(input, output, stepsize, tabsize, expandtabs)
    pi.delete()
    return output.getvalue()
# end def delete_string

def reformat_string(source, stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS):
    input = io.BytesIO(source)
    output = io.BytesIO()
    pi = PythonIndenter(input, output, stepsize, tabsize, expandtabs)
    pi.reformat()
    return output.getvalue()
# end def reformat_string

def make_backup(filename):
    import os, os.path
    backup = filename + '~'
    if os.path.lexists(backup):
        try:
            os.remove(backup)
        except os.error:
            print("Can't remove backup %r" % (backup,), file=sys.stderr)
        # end try
    # end if
    try:
        os.rename(filename, backup)
    except os.error:
        print("Can't rename %r to %r" % (filename, backup), file=sys.stderr)
    # end try
# end def make_backup

def complete_file(filename, stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS):
    with open(filename, 'r') as f:
        source = f.read()
    # end with
    result = complete_string(source, stepsize, tabsize, expandtabs)
    if source == result: return 0
    # end if
    make_backup(filename)
    with open(filename, 'w') as f:
        f.write(result)
    # end with
    return 1
# end def complete_file

def delete_file(filename, stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS):
    with open(filename, 'r') as f:
        source = f.read()
    # end with
    result = delete_string(source, stepsize, tabsize, expandtabs)
    if source == result: return 0
    # end if
    make_backup(filename)
    with open(filename, 'w') as f:
        f.write(result)
    # end with
    return 1
# end def delete_file

def reformat_file(filename, stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS):
    with open(filename, 'r') as f:
        source = f.read()
    # end with
    result = reformat_string(source, stepsize, tabsize, expandtabs)
    if source == result: return 0
    # end if
    make_backup(filename)
    with open(filename, 'w') as f:
        f.write(result)
    # end with
    return 1
# end def reformat_file

# Test program when called as a script

usage = """
usage: pindent (-c|-d|-r) [-s stepsize] [-t tabsize] [-e] [file] ...
-c         : complete a correctly indented program (add #end directives)
-d         : delete #end directives
-r         : reformat a completed program (use #end directives)
-s stepsize: indentation step (default %(STEPSIZE)d)
-t tabsize : the worth in spaces of a tab (default %(TABSIZE)d)
-e         : expand TABs into spaces (default OFF)
[file] ... : files are changed in place, with backups in file~
If no files are specified or a single - is given,
the program acts as a filter (reads stdin, writes stdout).
""" % vars()

def error_both(op1, op2):
    sys.stderr.write('Error: You can not specify both '+op1+' and -'+op2[0]+' at the same time\n')
    sys.stderr.write(usage)
    sys.exit(2)
# end def error_both

def test():
    import getopt
    try:
        opts, args = getopt.getopt(sys.argv[1:], 'cdrs:t:e')
    except getopt.error, msg:
        sys.stderr.write('Error: %s\n' % msg)
        sys.stderr.write(usage)
        sys.exit(2)
    # end try
    action = None
    stepsize = STEPSIZE
    tabsize = TABSIZE
    expandtabs = EXPANDTABS
    for o, a in opts:
        if o == '-c':
            if action: error_both(o, action)
            # end if
            action = 'complete'
        elif o == '-d':
            if action: error_both(o, action)
            # end if
            action = 'delete'
        elif o == '-r':
            if action: error_both(o, action)
            # end if
            action = 'reformat'
        elif o == '-s':
            stepsize = int(a)
        elif o == '-t':
            tabsize = int(a)
        elif o == '-e':
            expandtabs = True
        # end if
    # end for
    if not action:
        sys.stderr.write(
                'You must specify -c(omplete), -d(elete) or -r(eformat)\n')
        sys.stderr.write(usage)
        sys.exit(2)
    # end if
    if not args or args == ['-']:
        action = eval(action + '_filter')
        action(sys.stdin, sys.stdout, stepsize, tabsize, expandtabs)
    else:
        action = eval(action + '_file')
        for filename in args:
            action(filename, stepsize, tabsize, expandtabs)
        # end for
    # end if
# end def test

if __name__ == '__main__':
    test()
# end if
dutree.pyo000064400000004266151732701270006602 0ustar00�
�fc@sbddlZddlZddlZd�Zd�Zd�Zd�Zedkr^e�ndS(i����Nc	Csgtjddjtjd�d�}di}}x�|j�D]�}d}x||dkrl|d}qOWt|| �}x||dkr�|d}q�W||d!}|jd	�}|dd
kr�d	|d<n|t	|�dd
kr|t	|�d=nt
||||�\}}q@Wyt||�Wn+tk
rb}|j
t
jkrc�qcnXdS(Nsdu t itrit
0123456789s 	i����t/t(tostpopentjointsystargvtNonet	readlinestevaltsplittlentstoretdisplaytIOErrorterrnotEPIPE(	tpttotaltdtlinetitsizetfilenametcompste((s,/usr/lib64/python2.7/Tools/scripts/dutree.pytmains*&


cCs|gkr||fS|j|d�s@dif||d<n||d\}}t||d||�||d<||fS(Nii(thas_keyR
R(RRRRtt1td1((s,/usr/lib64/python2.7/Tools/scripts/dutree.pyRs
!cCst||d�dS(NR(tshow(RR((s,/usr/lib64/python2.7/Tools/scripts/dutree.pyR"sc
Cs9|s
dSg}d}xP|j�D]B}||\}}|j||f�|dk	r#||}q#q#W|j�|j�tt|dd��}x�|D]�\}}|dkr�|}	nH|t|�j|�d|GH|d|dddt|�d}	|j|�r�t	|||d|	�q�q�WdS(NiRit|(
tkeystappendR
tsorttreverseRtreprtrjustRR!(
RRtprefixtlisttsumtkeyttsubtdsubtwidthtpsub((s,/usr/lib64/python2.7/Tools/scripts/dutree.pyR!%s&

	 (t__main__(RRRRRRR!t__name__(((s,/usr/lib64/python2.7/Tools/scripts/dutree.pyt<module>s$					find_recursionlimit.pyc000064400000013051151732701270011336 0ustar00�
�fc@sGdZddlZddlZddd��YZd�Zdd d��YZd�Zd	d!d
��YZd�Zdd"d
��YZ	d�Z
dd#d��YZd�Zd�Z
id�Zd�ZdZxreed�eed�eed�eed�eed�eed�eed�deGHedZq�WdS($sAFind the maximum recursion limit that prevents interpreter termination.

This script finds the maximum safe recursion limit on a particular
platform.  If you need to change the recursion limit on your system,
this script will tell you a safe upper bound.  To use the new limit,
call sys.setrecursionlimit().

This module implements several ways to create infinite recursion in
Python.  Different implementations end up pushing different numbers of
C stack frames, depending on how many calls through Python's abstract
C API occur.

After each round of tests, it prints a message:
"Limit of NNNN is fine".

The highest printed value of "NNNN" is therefore the highest potentially
safe limit for your system (which depends on the OS, architecture, but also
the compilation flags). Please note that it is practically impossible to
test all possible recursion paths in the interpreter, so the results of
this test should not be trusted blindly -- although they give a good hint
of which values are reasonable.

NOTE: When the C stack space allocated by your system is exceeded due
to excessive recursion, exact behaviour depends on the platform, although
the interpreter will always fail in a likely brutal way: either a
segmentation fault, a MemoryError, or just a silent abort.

NB: A program that does not use __methods__ can set a higher limit.
i����NtRecursiveBlowup1cBseZd�ZRS(cCs|j�dS(N(t__init__(tself((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyR$s(t__name__t
__module__R(((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyR#scCst�S(N(R(((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyt	test_init'stRecursiveBlowup2cBseZd�ZRS(cCs
t|�S(N(trepr(R((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyt__repr__+s(RRR(((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyR*scCs
tt��S(N(RR(((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyt	test_repr.stRecursiveBlowup4cBseZd�ZRS(cCs||S(N((Rtx((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyt__add__2s(RRR(((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyR
1scCst�t�S(N(R
(((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyttest_add5stRecursiveBlowup5cBseZd�ZRS(cCs
t||�S(N(tgetattr(Rtattr((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyt__getattr__9s(RRR(((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyR8scCs
t�jS(N(RR(((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyttest_getattr<stRecursiveBlowup6cBseZd�ZRS(cCs||d||dS(Nii((Rtitem((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyt__getitem__@s(RRR(((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyR?scCst�dS(Ni(R(((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyttest_getitemCscCst�S(N(ttest_recurse(((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyRFscCs�yddl}Wntk
r)dGHdSXd}xvtj�D]h}y||}w=Wn1tk
r�x!td�D]}|g}qqWnX|j|dd�|||<q=WdS(Ni����scannot import cPickle, skipped!idtprotocol(tcPickletImportErrortNonet	itertoolstcounttKeyErrortrangetdumps(t_cacheRtltnti((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyttest_cpickleIs


cCshtj|�|jd�r(|dGHn|GHt�|}y|�Wnttfk
r^nXdGHdS(Nttest_isYikes!(tsystsetrecursionlimitt
startswithtglobalstRuntimeErrortAttributeError(R#ttest_func_namet	test_func((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pytcheck_limitZs

i�RR
R	RRRR%sLimit of %d is fineid((((((t__doc__R'RRRRR	R
R
RRRRRR%R/tlimit(((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyt<module>s4							






	rgrep.pyo000064400000003531151732701270006423 0ustar00�
�fc@sYdZddlZddlZddlZd�Zdd�ZedkrUe�ndS(s.Reverse grep.

Usage: rgrep [-i] pattern file
i����NcCsAd}d}tjtjdd�\}}x0|D](\}}|dkr2|tjB}q2q2Wt|�dkr}td�nt|�dkr�td	�n|\}}ytj||�}Wn*tjk
r�}	td
t	|	��nXyt
|�}
Wn6tk
r3}	tdt|�t	|	�fd�nX|
j
dd�|
j�}d}x�|dkr<t||�}
||
}|
j
|�|
j|
�}|jd�}~|dkr�|d
s�|d
=q�n|d
||d
<|dkr|d}|d=nd}|j�x%|D]}|j|�r|GHqqWqYWdS(Ni@iiitis-iisnot enough argumentss"exactly one file argument requiredserror in regular expression: %sscan't open %s: %ss
i����i(tgetopttsystargvtret
IGNORECASEtlentusagetcompileterrortstrtopentIOErrortreprtseekttelltNonetmintreadtsplittreversetsearch(tbufsizetreflagstoptstargstotatpatterntfilenametprogtmsgtftpostleftovertsizetbuffertlinestline((s+/usr/lib64/python2.7/Tools/scripts/rgrep.pytmainsR

'







icCs'tjt_|GHtGHtj|�dS(N(Rtstderrtstdoutt__doc__texit(Rtcode((s+/usr/lib64/python2.7/Tools/scripts/rgrep.pyR9st__main__(R*RRRR'Rt__name__(((s+/usr/lib64/python2.7/Tools/scripts/rgrep.pyt<module>s	-patchcheck.py000075500000016777151732701300007237 0ustar00#! /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()
parseentities.pyo000064400000004035151732701300010155 0ustar00�
�fc@s�dZddlZddlZddlZejd�Zddd�Zd�Ze	dkr�e
ej�dkr�eejd�Z
n	ejZ
e
ej�d	kr�eejd	d
�Zn	ejZe
j�Zee�Zeee�ndS(s� Utility for parsing HTML entity definitions available from:

      http://www.w3.org/ as e.g.
      http://www.w3.org/TR/REC-html40/HTMLlat1.ent

    Input is read from stdin, output is written to stdout in form of a
    Python snippet defining a dictionary "entitydefs" mapping literal
    entity name to character or numeric entity.

    Marc-Andre Lemburg, mal@lemburg.com, 1999.
    Use as you like. NO WARRANTIES.

i����Ns7<!ENTITY +(\w+) +CDATA +"([^"]+)" +-- +((?:.|
)+?) *-->icCs�d}|dkr!t|�}ni}xTtj|||�}|sIPn|j�\}}}||f||<|j�}q*W|S(Ni(tNonetlententityREtsearchtgroupstend(ttexttpostendpostdtmtnametcharcodetcomment((s3/usr/lib64/python2.7/Tools/scripts/parseentities.pytparsescCs�|jd�|j�}|j�x�|D]�\}\}}|d dkr�t|dd!�}|dkrxd|}q�t|�}nt|�}tj|�}|jd|||f�q*W|jd�dS(	Nsentitydefs = {
is&#i����is'\%o's    '%s':	%s,  	# %s
s
}
(twritetitemstsorttinttreprt	TextToolstcollapse(tftdefsRRRR
tcode((s3/usr/lib64/python2.7/Tools/scripts/parseentities.pyt	writefile#s


t__main__iitw(t__doc__tretsysRtcompileRRRRt__name__RtargvtopentinfiletstdintoutfiletstdouttreadRR(((s3/usr/lib64/python2.7/Tools/scripts/parseentities.pyt<module>s			pickle2db.py000075500000007546151732701300006773 0ustar00#! /usr/bin/python2.7

"""
Synopsis: %(prog)s [-h|-b|-g|-r|-a|-d] [ picklefile ] dbfile

Read the given picklefile as a series of key/value pairs and write to a new
database.  If the database already exists, any contents are deleted.  The
optional flags indicate the type of the output database:

    -a - open using anydbm
    -b - open as bsddb btree file
    -d - open as dbm file
    -g - open as gdbm file
    -h - open as bsddb hash file
    -r - open as bsddb recno file

The default is hash.  If a pickle file is named it is opened for read
access.  If no pickle file is named, the pickle input is read from standard
input.

Note that recno databases can only contain integer keys, so you can't dump a
hash or btree database using db2pickle.py and reconstitute it to a recno
database with %(prog)s unless your keys are integers.

"""

import getopt
try:
    import bsddb
except ImportError:
    bsddb = None
try:
    import dbm
except ImportError:
    dbm = None
try:
    import gdbm
except ImportError:
    gdbm = None
try:
    import anydbm
except ImportError:
    anydbm = None
import sys
try:
    import cPickle as pickle
except ImportError:
    import pickle

prog = sys.argv[0]

def usage():
    sys.stderr.write(__doc__ % globals())

def main(args):
    try:
        opts, args = getopt.getopt(args, "hbrdag",
                                   ["hash", "btree", "recno", "dbm", "anydbm",
                                    "gdbm"])
    except getopt.error:
        usage()
        return 1

    if len(args) == 0 or len(args) > 2:
        usage()
        return 1
    elif len(args) == 1:
        pfile = sys.stdin
        dbfile = args[0]
    else:
        try:
            pfile = open(args[0], 'rb')
        except IOError:
            sys.stderr.write("Unable to open %s\n" % args[0])
            return 1
        dbfile = args[1]

    dbopen = None
    for opt, arg in opts:
        if opt in ("-h", "--hash"):
            try:
                dbopen = bsddb.hashopen
            except AttributeError:
                sys.stderr.write("bsddb module unavailable.\n")
                return 1
        elif opt in ("-b", "--btree"):
            try:
                dbopen = bsddb.btopen
            except AttributeError:
                sys.stderr.write("bsddb module unavailable.\n")
                return 1
        elif opt in ("-r", "--recno"):
            try:
                dbopen = bsddb.rnopen
            except AttributeError:
                sys.stderr.write("bsddb module unavailable.\n")
                return 1
        elif opt in ("-a", "--anydbm"):
            try:
                dbopen = anydbm.open
            except AttributeError:
                sys.stderr.write("anydbm module unavailable.\n")
                return 1
        elif opt in ("-g", "--gdbm"):
            try:
                dbopen = gdbm.open
            except AttributeError:
                sys.stderr.write("gdbm module unavailable.\n")
                return 1
        elif opt in ("-d", "--dbm"):
            try:
                dbopen = dbm.open
            except AttributeError:
                sys.stderr.write("dbm module unavailable.\n")
                return 1
    if dbopen is None:
        if bsddb is None:
            sys.stderr.write("bsddb module unavailable - ")
            sys.stderr.write("must specify dbtype.\n")
            return 1
        else:
            dbopen = bsddb.hashopen

    try:
        db = dbopen(dbfile, 'c')
    except bsddb.error:
        sys.stderr.write("Unable to open %s.  " % dbfile)
        sys.stderr.write("Check for format or version mismatch.\n")
        return 1
    else:
        for k in db.keys():
            del db[k]

    while 1:
        try:
            (key, val) = pickle.load(pfile)
        except EOFError:
            break
        db[key] = val

    db.close()
    pfile.close()

    return 0

if __name__ == "__main__":
    sys.exit(main(sys.argv[1:]))
nm2def.pyc000064400000005620151732701310006437 0ustar00�
�fc@s�dZddlZddlZdejd dZdejdejdd	Zd
Zedd�Zd�ZdZ	dZ
e
d�Zd�Ze
dkr�e�ndS(sEnm2def.py

Helpers to extract symbols from Unix libs and auto-generate
Windows definition files from them. Depends on nm(1). Tested
on Linux and Solaris only (-p option to nm is for Solaris only).

By Marc-Andre Lemburg, Aug 1998.

Additional notes: the output of nm is supposed to look like this:

acceler.o:
000001fd T PyGrammar_AddAccelerators
         U PyGrammar_FindDFA
00000237 T PyGrammar_RemoveAccelerators
         U _IO_stderr_
         U exit
         U fprintf
         U free
         U malloc
         U printf

grammar1.o:
00000000 T PyGrammar_FindDFA
00000034 T PyGrammar_LabelRepr
         U _PyParser_TokenNames
         U abort
         U printf
         U sprintf

...

Even if this isn't the default output of your nm, there is generally an
option to produce this format (since it is the original v7 Unix format).

i����Nt	libpythonis.atPythoniis.dllsnm -p -g %stTtCtDc
Cs�tjt|�j�}g|D]}|j�^q }i}x�|D]}t|�dksEd|kroqEn|j�}t|�dkr�qEn|\}}}	||kr�qEn||f||	<qEW|S(Nit:i(tostpopentNMt	readlineststriptlentsplit(
tlibttypestlineststsymbolstlinetitemstaddressttypetname((s,/usr/lib64/python2.7/Tools/scripts/nm2def.pyR+s
cCs�g}g}xQ|j�D]C\}\}}|dkrK|jd|�q|jd|�qW|j�|jd�|j�dj|�ddj|�S(NRRs	ts DATA
s
(RR(Rtappendtsorttjoin(RtdatatcodeRtaddrR((s,/usr/lib64/python2.7/Tools/scripts/nm2def.pytexport_list<s


sEXPORTS
%s
cCsTxM|j�D]?}|d dksL|d dkr6q
||kr
||=q
q
WdS(NitPyit_Py(tkeys(RtspecialsR((s,/usr/lib64/python2.7/Tools/scripts/nm2def.pyt
filter_PythonUs
 cCsJtt�}t|�t|�}tj}|jt|�|j�dS(N(	Rt	PYTHONLIBR#RtsyststdouttwritetDEF_TEMPLATEtclose(Rtexportstf((s,/usr/lib64/python2.7/Tools/scripts/nm2def.pytmain]s
	t__main__(RRR((t__doc__RR%tversionR$tPC_PYTHONLIBRRRR(tSPECIALSR#R,t__name__(((s,/usr/lib64/python2.7/Tools/scripts/nm2def.pyt<module>$s 			fixnotice.pyc000064400000006654151732701310007264 0ustar00�
�fc@szdZdaddlZddlZddlZdadadadd�Zd�Z	d�Z
ed	krve	�ndS(
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����NticCs+tt�GH|r|GHntj|�dS(N(t__doc__tglobalstsystexit(tcodetmsg((s//usr/lib64/python2.7/Tools/scripts/fixnotice.pytusage4scCs6y5tjtjdddddddg�\}}Wn#tjk
rZ}td|�nXx�|D]�\}}|dkr�td
�qb|dkr�daqb|d
kr�daqb|dkr�t|�}|j�a	|j
�qb|dkrbt|�}|j�a|j
�qbqbWx|D]}t|�qWdS(Nithvthelps
oldnotice=s
newnotice=sdry-runtverboses-hs--helpis-vs	--verboses	--dry-runs--oldnotices--newnotice(s-hs--help(s-vs	--verbose(
tgetoptRtargvterrorRtVERBOSEtDRYRUNtopentreadt
OLD_NOTICEtcloset
NEW_NOTICEtprocess(toptstargsRtopttargtfp((s//usr/lib64/python2.7/Tools/scripts/fixnotice.pytmain;s.	
		

cCs�t|�}|j�}|j�|jt�}|dkrStrOdG|GHndSts_trkdG|GHntrudS|| t||tt�}|d}|d}t|d�}|j	|�|j�t
j||�t
j||�dS(Nis
no change:s
   change:s.news.baktw(RRRtfindRRRRtlentwritetostrename(tfiletftdatatitnewtbackup((s//usr/lib64/python2.7/Tools/scripts/fixnotice.pyRXs(
 



t__main__(RRR RRRRRRRRt__name__(((s//usr/lib64/python2.7/Tools/scripts/fixnotice.pyt<module>s		ifdef.pyc000064400000004331151732701320006340 0ustar00�
�fc@sPddlZddlZgZgZd�Zd�ZedkrLe�ndS(i����NcCs�tjtjdd�\}}xL|D]D\}}|dkrNtj|�n|dkr&tj|�q&q&W|s�dg}nxY|D]Q}|dkr�ttjtj�q�t	|d�}t|tj�|j
�q�WdS(NisD:U:s-Ds-Ut-tr(tgetopttsystargvtdefstappendtundefstprocesststdintstdouttopentclose(toptstargstotatfilenametf((s+/usr/lib64/python2.7/Tools/scripts/ifdef.pytmain#s
cCs
d}d}g}x�|j�}|s+Pnx4|ddkra|j�}|sTPn||}q.W|j�}|d d	kr�|r|j|�qqn|dj�}|j�}|d
}	|	|kr�|r|j|�qqn|	dkr�t|�dkr�|	dkrd}
nd
}
|d}|tkr_|j||
|f�|
s�d
}q�q�|tkr�|j||
|f�|
r�d
}q�q�|j|d|f�|r�|j|�q�q|	dkr�|j|dd
f�|r�|j|�q�q|	dkrz|rz|d\}}
}|
d
krH|rw|j|�qwq�|
}
|}|
sdd
}n||
|f|d<q|	dkr�|r�|d\}}
}|
d
kr�|r�|j|�q�n|d=|}qtj	jd|	�qW|r	tj	jd|�ndS(Ntiftifdeftifndeftelsetendifii����s\
t#iii����tsUnknown keyword %s
s
stack: %s
(RRRRR(RR(
treadlinetstriptwritetsplittlenRRRRtstderr(tfpitfpotkeywordstoktstacktlinetnextlinettmptwordstkeywordtkotwordts_okts_kots_word((s+/usr/lib64/python2.7/Tools/scripts/ifdef.pyR4s�
	
		t__main__(RRRRRRt__name__(((s+/usr/lib64/python2.7/Tools/scripts/ifdef.pyt<module>s		;copytime.pyc000064400000001651151732701320007116 0ustar00�
�fc@sQddlZddlZddlmZmZd�ZedkrMe�ndS(i����N(tST_ATIMEtST_MTIMEcCs�ttj�dkr5tjjd�tjd�ntjdtjd}}ytj|�}Wn5tjk
r�tjj|d�tjd�nXy"tj	||t
|tf�Wn5tjk
r�tjj|d�tjd�nXdS(Nis#usage: copytime source destination
iis: cannot stat
s: cannot change time
(tlentsystargvtstderrtwritetexittoststatterrortutimeRR(tfile1tfile2tstat1((s./usr/lib64/python2.7/Tools/scripts/copytime.pytmain	s"t__main__(RRR	RRRt__name__(((s./usr/lib64/python2.7/Tools/scripts/copytime.pyt<module>s
	pysource.pyc000064400000007651151732701330007145 0ustar00�
�fc@s�dZdZddddgZddlZddlZejd�ZeZd	�Z	d
�Z
d�Zd�Zd
�Z
edd�Zedkr�xedg�D]ZeGHq�WdGHx%edgde
�D]ZeGHq�WndS(sCList 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.
sOleg Broytmann, Georg Brandlthas_python_exttlooks_like_pythontcan_be_compiledtwalk_python_filesi����Ns	[--]cCstr|GHndS(N(tdebug(tmsg((s./usr/lib64/python2.7/Tools/scripts/pysource.pytprint_debugscCs�ytj|�j}Wn(tk
r@}td||f�dSX|dkretd||f�dSyt|d�SWn(tk
r�}td||f�dSXdS(Ns%s: permission denied: %sis!%s: the file is too big: %d bytestrUs%s: access denied: %si(toststattst_sizetOSErrorRtNonetopentIOError(tfullpathtsizeterr((s./usr/lib64/python2.7/Tools/scripts/pysource.pyt_open!scCs|jd�p|jd�S(Ns.pys.pyw(tendswith(R((s./usr/lib64/python2.7/Tools/scripts/pysource.pyR2scCs�t|�}|dkrtS|j�}|j�tj|�rStd|�tS|jd�sq|jd�rut	Sd|kr�t	StS(Ns%s: appears to be binarys.pys.pywtpython(
RRtFalsetreadlinetcloset	binary_retsearchRRtTrue(Rtinfiletline((s./usr/lib64/python2.7/Tools/scripts/pysource.pyR5s
cCsut|�}|dkrtS|j�}|j�yt||d�Wn(tk
rp}td||f�tSXtS(Ntexecs%s: cannot compile: %s(	RRRtreadRtcompilet	ExceptionRR(RRtcodeR((s./usr/lib64/python2.7/Tools/scripts/pysource.pyRJs
c
cs"|dkrg}nx|D]�}td|�tjj|�rY||�r|Vqqtjj|�rtd�x�tj|�D]�\}}}x*|D]"}||kr�|j|�q�q�WxE|D]=}tjj||�}	td|	�||	�r�|	Vq�q�Wq�Wqtd�qWdS(s^    Recursively yield all Python source files below the given paths.

    paths: a list of files and/or directories to be checked.
    is_python: a function that takes a file name and checks whether it is a
               Python source file
    exclude_dirs: a list of directory base names that should be excluded in
                  the search
    stesting: %ss    it is a directorys    unknown typeN(	RRRtpathtisfiletisdirtwalktremovetjoin(
tpathst	is_pythontexclude_dirsR"tdirpathtdirnamest	filenamestexcludetfilenameR((s./usr/lib64/python2.7/Tools/scripts/pysource.pyR[s&
	



t__main__t.s
----------R)(t__doc__t
__author__t__all__RtreRRRRRRRRRRRt__name__R(((s./usr/lib64/python2.7/Tools/scripts/pysource.pyt<module>s"					!	untabify.pyc000064400000003057151732701330007111 0ustar00�
�fc@sYdZddlZddlZddlZd�Zed�ZedkrUe�ndS(sJReplace tabs with spaces in argument files.  Print names of changed files.i����NcCs�d}y8tjtjdd�\}}|s=tjd�nWn0tjk
rp}|GHdGtjdGdGHdSXx/|D]'\}}|dkrxt|�}qxqxWx|D]}t||�q�WdS(	Niist:s#At least one file argument requiredsusage:is[-t tabwidth] file ...s-t(tgetopttsystargvterrortinttprocess(ttabsizetoptstargstmsgtoptnametoptvaluetfilename((s./usr/lib64/python2.7/Tools/scripts/untabify.pytmain	s
cCs�y&t|�}|j�}|j�Wn#tk
rK}d||fGHdSX|j|�}||krkdS|d}ytj|�Wntjk
r�nXytj||�Wntjk
r�nXt|d��}|j	|�WdQX|r�|GHndS(Ns%r: I/O error: %st~tw(
topentreadtclosetIOErrort
expandtabstostunlinkRtrenametwrite(RRtverbosetfttextR	tnewtexttbackup((s./usr/lib64/python2.7/Tools/scripts/untabify.pyRs.
t__main__(t__doc__RRRR
tTrueRt__name__(((s./usr/lib64/python2.7/Tools/scripts/untabify.pyt<module>s	mkreal.pyc000064400000003674151732701330006550 0ustar00�
�fc@soddlZddlZddlTejjZdZd
Zd�Zd�Zd�Z	e
d	krke	�ndS(i����N(t*smkreal errori icCs�tj|�}t|t�}tj|�}t|d�}tj|�t|d�}x*|jt�}|suPn|j	|�q\W~tj
||�dS(Ntrtw(toststattS_IMODEtST_MODEtreadlinktopentunlinktreadtBUFSIZEtwritetchmod(tnametsttmodetlinktotf_intf_outtbuf((s,/usr/lib64/python2.7/Tools/scripts/mkreal.pyt
mkrealfiles
cCs�tj|�}t|t�}tj|�}tj|�}tj|�tj||�tj||�t	tj
|�}xK|D]C}|tjtj
fkr�tjt	||�t	||��q�q�WdS(N(
RRRRRtlistdirR	tmkdirR
tjointpardirtcurdirtsymlink(RRRRtfilestfilename((s,/usr/lib64/python2.7/Tools/scripts/mkreal.pyt	mkrealdirs

cCs�tjt_tjjtjd�}|dkr:d}ntjd}|sjdG|GdGHtjd�nd}xg|D]_}tjj|�s�|dG|dGd	GHd}qwtjj	|�r�t
|�qwt|�qwWtj|�dS(
Nis-ctmkrealisusage:spath ...it:s
not a symlink(tsyststderrtstdoutRtpathtbasenametargvtexittislinktisdirRR(tprognametargststatusR((s,/usr/lib64/python2.7/Tools/scripts/mkreal.pytmain-s"	


	
t__main__i�(R!RRR$RterrorRRRR-t__name__(((s,/usr/lib64/python2.7/Tools/scripts/mkreal.pyt<module>s
			analyze_dxp.pyo000064400000011214151732701330007614 0ustar00�
�fc@s�dZddlZddlZddlZddlZddlZeed�s`ed��nej�Z	ej
�ad�Zd�Z
d�Zd�Zd	�Zd
�Zdd�ZdS(s
Some helper functions to analyze the output of sys.getdxp() (which is
only available if Python was built with -DDYNAMIC_EXECUTION_PROFILE).
These will tell you which opcodes have been executed most frequently
in the current process, and, if Python was also built with -DDXPAIRS,
will tell you which instruction _pairs_ were executed most frequently,
which may help in choosing new instructions.

If Python was built without -DDYNAMIC_EXECUTION_PROFILE, importing
this module will raise a RuntimeError.

If you're running a script you want to profile, a simple way to get
the common pairs is:

$ PYTHONPATH=$PYTHONPATH:<python_srcdir>/Tools/scripts ./python -i -O the_script.py --args
...
> from analyze_dxp import *
> s = render_common_pairs()
> open('/tmp/some_file', 'w').write(s)
i����NtgetdxpsKCan't import analyze_dxp: Python built without -DDYNAMIC_EXECUTION_PROFILE.cCs#t|�dko"t|dt�S(s[Returns True if the Python that produced the argument profile
    was built with -DDXPAIRS.i(tlent
isinstancetlist(tprofile((s1/usr/lib64/python2.7/Tools/scripts/analyze_dxp.pyt	has_pairs(scCs't�tj�tj�aWdQXdS(s<Forgets any execution profile that has been gathered so far.N(t
_profile_locktsysRt_cumulative_profile(((s1/usr/lib64/python2.7/Tools/scripts/analyze_dxp.pyt
reset_profile/s
cCs�t��tj�}t|�r|x�ttt��D]C}x:ttt|��D]"}t||c|||7<qOWq2Wn1x.ttt��D]}t|c||7<q�WWdQXdS(s�Reads sys.getdxp() and merges it into this module's cached copy.

    We need this because sys.getdxp() 0s itself every time it's called.N(RRRRtrangeRR(tnew_profilet
first_insttsecond_insttinst((s1/usr/lib64/python2.7/Tools/scripts/analyze_dxp.pyt
merge_profile7scCs%t�t�tjt�SWdQXdS(s9Returns the cumulative execution profile until this call.N(RRtcopytdeepcopyR(((s1/usr/lib64/python2.7/Tools/scripts/analyze_dxp.pytsnapshot_profileHscCs�t|�r|r|d}n|}gt|�D].\}}|dkr2|tj||f^q2}|jdtjd�dt�|S(s�Returns the most common opcodes in order of descending frequency.

    The result is a list of tuples of the form
      (opcode, opname, # of occurrences)

    i����itkeyitreverse(Rt	enumeratetopcodetopnametsorttoperatort
itemgettertTrue(Rt	inst_listtoptcounttresult((s1/usr/lib64/python2.7/Tools/scripts/analyze_dxp.pytcommon_instructionsOs
(cCs�t|�sgSgt|d �D]Z\}}t|�D]A\}}|dkr7||ftj|tj|f|f^q7q!}|jdtjd�dt�|S(s�Returns the most common opcode pairs in order of descending frequency.

    The result is a list of tuples of the form
      ((1st opcode, 2nd opcode),
       (1st opname, 2nd opname),
       # of occurrences of the pair)

    i����iRiR(RRRRRRRR(Rtop1t
op1profiletop2RR((s1/usr/lib64/python2.7/Tools/scripts/analyze_dxp.pytcommon_pairsas	>cs7�dkrt��n�fd�}dj|��S(s�Renders the most common opcode pairs to a string in order of
    descending frequency.

    The result is a series of lines of the form:
      # of occurrences: ('1st opname', '2nd opname')

    c3s3x,t��D]\}}}d||fVq
WdS(Ns%s: %s
(R$(t_topsR(R(s1/usr/lib64/python2.7/Tools/scripts/analyze_dxp.pytseqstN(tNoneRtjoin(RR'((Rs1/usr/lib64/python2.7/Tools/scripts/analyze_dxp.pytrender_common_pairsus(t__doc__RRRRt	threadingthasattrtRuntimeErrortRLockRRRRR	RRR R$R)R+(((s1/usr/lib64/python2.7/Tools/scripts/analyze_dxp.pyt<module>s 						treesync.pyo000064400000013546151732701330007144 0ustar00�
�fc@s�dZddlZddlZddlZddlZdZdZdadada	d�Z
d�Zd�ZdZ
d�Zd�Zd
�Zdddd�Zdd�Zedkr�e
�ndS(s�Script to synchronize two source trees.

Invoke with two arguments:

python treesync.py slave master

The assumption is that "master" contains CVS administration while
slave doesn't.  All files in the slave tree that have a CVS/Entries
entry in the master tree are synchronized.  This means:

    If the files differ:
        if the slave file is newer:
            normalize the slave file
            if the files still differ:
                copy the slave to the master
        else (the master is newer):
            copy the master to the slave

    normalizing the slave means replacing CRLF with LF when the master
    doesn't use CRLF

i����NtasktyestnocCs)tjtjdd�\}}x�|D]�\}}|dkrGd}n|dkr\d}n|dkrq|an|dkr�|an|d	kr�|an|d
kr�|}n|dkr&|}aaaq&q&Wy|\}}Wn0tk
rdGtjd
p	dGdGdGHdSXt||�dS(Nisnym:s:d:f:a:s-yRs-nRs-ss-ms-ds-fs-as
usage: pythonistreesync.pys5[-n] [-y] [-m y|n|a] [-s y|n|a] [-d y|n|a] [-f n|y|a]sslavedir masterdir(tgetopttsystargvtwrite_slavetwrite_mastertcreate_directoriest
ValueErrortprocess(toptstargstotatdefault_answertcreate_filestslavetmaster((s./usr/lib64/python2.7/Tools/scripts/treesync.pytmain#s0						
cCsYtjj|d�}tjj|�s9dG|GHdGHdSddGHdG|GHdG|GHtjj|�s�td|d	t�s�dG|GHd
G|GHdSdG|GHytj|�Wn(tjk
r�}dG|Gd
G|GHdSXdG|GHnd}g}tj	|�}x�|D]�}tjj||�}tjj||�}|dkrJ|}qtjj|�rtjj
|�r|j||f�qqW|r1tjj|d�}	x�t|	�j
�D]s}
|
jd�}|ddkr�|dr�|d}tjj||�}tjj||�}
t||
�q�q�Wnx!|D]\}}
t||
�q8WdS(NtCVSsskipping master subdirectorys-- not under CVSt-i(sslave Rscreate slave directory %s?tanswers-- no corresponding slavescreating slave directoryscan't make slave directoryt:smade slave directorytEntriest/iti(tostpathtjointisdirtokayRtmkdirterrortNonetlistdirtislinktappendtopent	readlinestsplittcompareR
(RRtcvsdirtmsgtsubdirstnamestnamet
masternamet	slavenametentriestetwordststm((s./usr/lib64/python2.7/Tools/scripts/treesync.pyR
?sT				
				
	%
cCs�yt|d�}Wntk
r,d}nXyt|d�}Wntk
rYd}nX|s�|ssdG|GHdSdG|GHt||dt�dS|s�dG|GHdS|r�|r�t||�r�dSnt|�}t|�}||kr)|j�|j�dG|GHdG|GHt||dt�dSd	G||Gd
GH|j	d�t
|�}|j�|j�|r�dGHt||ddt�nd
GHt||ddt�dS(NtrtrbsNeither master nor slave existssCreating missing slaveRsNot updating missing mastersMaster             sis newer than slavesSlave issseconds newer than masteris#***UPDATING MASTER (BINARY COPY)***s***UPDATING MASTER***(R&tIOErrorR"tcopyRt	identicaltmtimetcloseRtseekt
funnycharsR(RRtsftmftsfttmfttfun((s./usr/lib64/python2.7/Tools/scripts/treesync.pyR)msP



			

		


iicCsCx<|jt�}|jt�}||kr1dS|sPqqWdS(Nii(treadtBUFSIZE(R?R@tsdtmd((s./usr/lib64/python2.7/Tools/scripts/treesync.pyR:�scCs tj|j��}|tjS(N(RtfstattfilenotstattST_MTIME(tftst((s./usr/lib64/python2.7/Tools/scripts/treesync.pyR;�scCs@x9|jt�}|sPnd|ks4d|krdSqWdS(Ns
sii(RDRE(RLtbuf((s./usr/lib64/python2.7/Tools/scripts/treesync.pyR>�sR7twbcCs�dG|GHdG|GHtd|�s%dSt||�}t||�}x*|jt�}|s_Pn|j|�qFW|j�|j�dS(Ntcopyings     tosokay to copy? (RR&RDREtwriteR<(tsrctdsttrmodetwmodeRRLtgRN((s./usr/lib64/python2.7/Tools/scripts/treesync.pyR9�s		
cCs�|j�j�}|s)|ddkrYt|�}|j�j�}|sYt}qYn|d dkrmdS|d dkr�dSdGHt|�S(NitnyitytnsYes or No please -- try again:(tstriptlowert	raw_inputRR(tpromptR((s./usr/lib64/python2.7/Tools/scripts/treesync.pyR�st__main__i@(t__doc__RRRJRRRRRRRR
R)RER:R;R>R9Rt__name__(((s./usr/lib64/python2.7/Tools/scripts/treesync.pyt<module>s"0		.	.			objgraph.py000075500000013601151732701330006720 0ustar00#! /usr/bin/python2.7

# objgraph
#
# Read "nm -o" input (on IRIX: "nm -Bo") of a set of libraries or modules
# and print various interesting listings, such as:
#
# - which names are used but not defined in the set (and used where),
# - which names are defined in the set (and where),
# - which modules use which other modules,
# - which modules are used by which other modules.
#
# Usage: objgraph [-cdu] [file] ...
# -c: print callers per objectfile
# -d: print callees per objectfile
# -u: print usage of undefined symbols
# If none of -cdu is specified, all are assumed.
# Use "nm -o" to generate the input (on IRIX: "nm -Bo"),
# e.g.: nm -o /lib/libc.a | objgraph


import sys
import os
import getopt
import re

# Types of symbols.
#
definitions = 'TRGDSBAEC'
externals = 'UV'
ignore = 'Nntrgdsbavuc'

# Regular expression to parse "nm -o" output.
#
matcher = re.compile('(.*):\t?........ (.) (.*)$')

# Store "item" in "dict" under "key".
# The dictionary maps keys to lists of items.
# If there is no list for the key yet, it is created.
#
def store(dict, key, item):
    if dict.has_key(key):
        dict[key].append(item)
    else:
        dict[key] = [item]

# Return a flattened version of a list of strings: the concatenation
# of its elements with intervening spaces.
#
def flat(list):
    s = ''
    for item in list:
        s = s + ' ' + item
    return s[1:]

# Global variables mapping defined/undefined names to files and back.
#
file2undef = {}
def2file = {}
file2def = {}
undef2file = {}

# Read one input file and merge the data into the tables.
# Argument is an open file.
#
def readinput(fp):
    while 1:
        s = fp.readline()
        if not s:
            break
        # If you get any output from this line,
        # it is probably caused by an unexpected input line:
        if matcher.search(s) < 0: s; continue # Shouldn't happen
        (ra, rb), (r1a, r1b), (r2a, r2b), (r3a, r3b) = matcher.regs[:4]
        fn, name, type = s[r1a:r1b], s[r3a:r3b], s[r2a:r2b]
        if type in definitions:
            store(def2file, name, fn)
            store(file2def, fn, name)
        elif type in externals:
            store(file2undef, fn, name)
            store(undef2file, name, fn)
        elif not type in ignore:
            print fn + ':' + name + ': unknown type ' + type

# Print all names that were undefined in some module and where they are
# defined.
#
def printcallee():
    flist = file2undef.keys()
    flist.sort()
    for filename in flist:
        print filename + ':'
        elist = file2undef[filename]
        elist.sort()
        for ext in elist:
            if len(ext) >= 8:
                tabs = '\t'
            else:
                tabs = '\t\t'
            if not def2file.has_key(ext):
                print '\t' + ext + tabs + ' *undefined'
            else:
                print '\t' + ext + tabs + flat(def2file[ext])

# Print for each module the names of the other modules that use it.
#
def printcaller():
    files = file2def.keys()
    files.sort()
    for filename in files:
        callers = []
        for label in file2def[filename]:
            if undef2file.has_key(label):
                callers = callers + undef2file[label]
        if callers:
            callers.sort()
            print filename + ':'
            lastfn = ''
            for fn in callers:
                if fn <> lastfn:
                    print '\t' + fn
                lastfn = fn
        else:
            print filename + ': unused'

# Print undefined names and where they are used.
#
def printundef():
    undefs = {}
    for filename in file2undef.keys():
        for ext in file2undef[filename]:
            if not def2file.has_key(ext):
                store(undefs, ext, filename)
    elist = undefs.keys()
    elist.sort()
    for ext in elist:
        print ext + ':'
        flist = undefs[ext]
        flist.sort()
        for filename in flist:
            print '\t' + filename

# Print warning messages about names defined in more than one file.
#
def warndups():
    savestdout = sys.stdout
    sys.stdout = sys.stderr
    names = def2file.keys()
    names.sort()
    for name in names:
        if len(def2file[name]) > 1:
            print 'warning:', name, 'multiply defined:',
            print flat(def2file[name])
    sys.stdout = savestdout

# Main program
#
def main():
    try:
        optlist, args = getopt.getopt(sys.argv[1:], 'cdu')
    except getopt.error:
        sys.stdout = sys.stderr
        print 'Usage:', os.path.basename(sys.argv[0]),
        print           '[-cdu] [file] ...'
        print '-c: print callers per objectfile'
        print '-d: print callees per objectfile'
        print '-u: print usage of undefined symbols'
        print 'If none of -cdu is specified, all are assumed.'
        print 'Use "nm -o" to generate the input (on IRIX: "nm -Bo"),'
        print 'e.g.: nm -o /lib/libc.a | objgraph'
        return 1
    optu = optc = optd = 0
    for opt, void in optlist:
        if opt == '-u':
            optu = 1
        elif opt == '-c':
            optc = 1
        elif opt == '-d':
            optd = 1
    if optu == optc == optd == 0:
        optu = optc = optd = 1
    if not args:
        args = ['-']
    for filename in args:
        if filename == '-':
            readinput(sys.stdin)
        else:
            readinput(open(filename, 'r'))
    #
    warndups()
    #
    more = (optu + optc + optd > 1)
    if optd:
        if more:
            print '---------------All callees------------------'
        printcallee()
    if optu:
        if more:
            print '---------------Undefined callees------------'
        printundef()
    if optc:
        if more:
            print '---------------All Callers------------------'
        printcaller()
    return 0

# Call the main program.
# Use its return value as exit status.
# Catch interrupts to avoid stack trace.
#
if __name__ == '__main__':
    try:
        sys.exit(main())
    except KeyboardInterrupt:
        sys.exit(1)
lll.pyc000064400000001656151732701330006056 0ustar00�
�fc@sNddlZddlZd�Zd�ZedkrJeejd�ndS(i����NcCsyxrtj|�D]a}|tjtjfkrtjj||�}tjj|�rq|GdGtj|�GHqqqqWdS(Ns->(tostlistdirtcurdirtpardirtpathtjointislinktreadlink(tdirnametnametfull((s)/usr/lib64/python2.7/Tools/scripts/lll.pytlll
s
cCsh|stjg}nd}xF|D]>}t|�dkrV|sDHnd}|dGHnt|�q"WdS(Niit:(RRtlenR(targstfirsttarg((s)/usr/lib64/python2.7/Tools/scripts/lll.pytmains
t__main__i(tsysRRRt__name__targv(((s)/usr/lib64/python2.7/Tools/scripts/lll.pyt<module>s		
untabify.pyo000064400000003057151732701340007126 0ustar00�
�fc@sYdZddlZddlZddlZd�Zed�ZedkrUe�ndS(sJReplace tabs with spaces in argument files.  Print names of changed files.i����NcCs�d}y8tjtjdd�\}}|s=tjd�nWn0tjk
rp}|GHdGtjdGdGHdSXx/|D]'\}}|dkrxt|�}qxqxWx|D]}t||�q�WdS(	Niist:s#At least one file argument requiredsusage:is[-t tabwidth] file ...s-t(tgetopttsystargvterrortinttprocess(ttabsizetoptstargstmsgtoptnametoptvaluetfilename((s./usr/lib64/python2.7/Tools/scripts/untabify.pytmain	s
cCs�y&t|�}|j�}|j�Wn#tk
rK}d||fGHdSX|j|�}||krkdS|d}ytj|�Wntjk
r�nXytj||�Wntjk
r�nXt|d��}|j	|�WdQX|r�|GHndS(Ns%r: I/O error: %st~tw(
topentreadtclosetIOErrort
expandtabstostunlinkRtrenametwrite(RRtverbosetfttextR	tnewtexttbackup((s./usr/lib64/python2.7/Tools/scripts/untabify.pyRs.
t__main__(t__doc__RRRR
tTrueRt__name__(((s./usr/lib64/python2.7/Tools/scripts/untabify.pyt<module>s	eptags.pyc000064400000003524151732701340006553 0ustar00�
�fc@s_dZddlZddlZdZeje�Zd�Zd�Zedkr[e�ndS(s�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.
i����Ns;^[ \t]*(def|class)[ \t]+([a-zA-Z_][a-zA-Z0-9_]*)[ \t]*[:\(]c
Csyt|d�}Wntjjd|�dSXd}d}g}d}x�|j�}|scPn|d}tj|�}|r�|jd�d||f}	|j|	�|t	|	�}n|t	|�}qMW|jd||f�x|D]}	|j|	�q�WdS(sCAppend tags found in file named 'filename' to the open file 'outfp'trsCannot open %s
Niis%d,%d
s
%s,%d
(
topentsyststderrtwritetreadlinetmatchertsearchtgrouptappendtlen(
tfilenametoutfptfptcharnotlinenottagstsizetlinetmttag((s,/usr/lib64/python2.7/Tools/scripts/eptags.pyt
treat_files.


cCs8tdd�}x"tjdD]}t||�qWdS(NtTAGStwi(RRtargvR(RR((s,/usr/lib64/python2.7/Tools/scripts/eptags.pytmain2st__main__(	t__doc__RtretexprtcompileRRRt__name__(((s,/usr/lib64/python2.7/Tools/scripts/eptags.pyt<module>s		fixcid.pyc000064400000017253151732701340006542 0ustar00�
�fc@s�ddlZddlZddlZddlTddlZejjZeZej	jZ
d�Zd�ZdZ
d�Zd�Zd�Zd	Zd
ZdZdZd
ZdZdZdZededeZdZdedZdeZedeZedeZeeeeefZddj e�dZ!ej"e!�Z#eeefZ$ddj e$�dZ%ej"e%�Z&d�Z'd�Z(da)d�Z*da+d�Z,iZ-iZ.d�Z/e0dkr�e�ndS(i����N(t*cCs�tjd}td|d�td�td�td�td�td�td�td	�td
�td�td�dS(
NisUsage: s/ [-c] [-r] [-s file] ... file-or-directory ...
s
s*-c           : substitute inside comments
s:-r           : reverse direction for following -s options
s+-s substfile : add a file of substitutions
s<Each non-empty non-comment line in a substitution file must
s>contain exactly two words: an identifier and its replacement.
s:Comments start with a # character and end at end of line.
s=If an identifier is preceded with a *, it is not substituted
s,inside a comment even when -c is specified.
(tsystargvterr(tprogname((s,/usr/lib64/python2.7/Tools/scripts/fixcid.pytusage/s










cCsqy#tjtjdd�\}}WnBtjk
rg}tdt|�d�t�tjd�nXd}|s�t�tjd�nxY|D]Q\}}|dkr�t�n|dkr�t	�n|d	kr�t
|�q�q�Wxv|D]n}tjj
|�rt|�r\d}q\q�tjj|�rGt|d
�d}q�t|�r�d}q�q�Wtj|�dS(Niscrs:sOptions error: s
iis-cs-rs-ss": will not process symbolic links
(tgetoptRRterrorRtstrRtexitt
setdocommentst
setreversetaddsubsttostpathtisdirtrecursedowntislinktfix(toptstargstmsgtbadtopttarg((s,/usr/lib64/python2.7/Tools/scripts/fixcid.pytmain>s6#


	
s^[a-zA-Z0-9_]+\.[ch]$cCstjt|�S(N(tretmatchtWanted(tname((s,/usr/lib64/python2.7/Tools/scripts/fixcid.pytwanted\scCs9td|f�d}ytj|�}Wn3tjk
r_}t|dt|�d�dSX|j�g}x�|D]�}|tjtjfkr�qwntj	j
||�}tj	j|�r�qwtj	j|�r�|j
|�qwt|�rwt|�rd}qqwqwWx#|D]}t|�rd}qqW|S(Nsrecursedown(%r)
is: cannot list directory: s
i(tdbgR
tlistdirRRRtsorttcurdirtpardirRtjoinRRtappendRRR(tdirnameRtnamesRtsubdirsRtfullname((s,/usr/lib64/python2.7/Tools/scripts/fixcid.pyR_s0



cCs-|dkr!tj}tj}n}yt|d�}Wn0tk
rf}t|dt|�d�dSXtjj	|�\}}tjj
|d|�}d}d}t�xV|j
�}|s�Pn|d}x>|dd	kr|j
�}	|	s�Pn||	}|d}q�Wt|�}
|
|kr�|dkr�yt|d
�}Wn:tk
r�}|j�t|dt|�d�dSX|jd�d}t�t|d�q�ntt|�d�td
|�td|
�n|dk	r�|j|
�q�q�W|dkrdS|j�|s(dS|j�y+tj|�}tj||td@�Wn2tjk
r�}t|dt|�d�nXytj||d�Wn2tjk
r�}t|dt|�d�nXytj||�Wn3tjk
r(}t|dt|�d�dSXdS(Nt-trs: cannot open: s
it@ii����s\
tws: cannot create: s:
s< s> i�s: warning: chmod failed (s)
t~s: warning: backup failed (s: rename failed ((RtstdintstdouttopentIOErrorRRR
RtsplitR$tNonetinitfixlinetreadlinetfixlinetclosetseektreptreprtwritetstattchmodtST_MODERtrename(tfilenametftgRtheadttailttempnametlinenotlinetnextlinetnewlinetstatbuf((s,/usr/lib64/python2.7/Tools/scripts/fixcid.pyRus�	





  s (struct )?[a-zA-Z_][a-zA-Z0-9_]+s"([^\n\\"]|\\.)*"s'([^\n\\']|\\.)*'s/\*s\*/s0[xX][0-9a-fA-F]*[uUlL]*s0[0-7]*[uUlL]*s[1-9][0-9]*[uUlL]*t|s[eE][-+]?[0-9]+s([0-9]+\.[0-9]*|\.[0-9]+)(s)?s[0-9]+t(t)cCs
tadS(N(tOutsideCommentProgramtProgram(((s,/usr/lib64/python2.7/Tools/scripts/fixcid.pyR5�scCs7d}x*|t|�kr2tj||�}|dkr=Pn|j�}|jd�}t|�dkr�|dkrtaq�|dkr�taq�nt|�}|tkr%t|}ttkr�t	s�dG|GH||}q	n|t
kr�|}q�n|| ||||}t|�}n||}q	W|S(Niis/*s*/sFound in comment:(tlenRPtsearchR4tstarttgrouptInsideCommentProgramROtDictt
DocommentstNotInComment(RHtiRtfoundtntsubst((s,/usr/lib64/python2.7/Tools/scripts/fixcid.pyR7�s4	
	
icCs
dadS(Ni(RW(((s,/usr/lib64/python2.7/Tools/scripts/fixcid.pyR
scCstadS(N(tReverse(((s,/usr/lib64/python2.7/Tools/scripts/fixcid.pyRsc	Cs�yt|d�}Wn<tk
rQ}t|dt|�d�tjd�nXd}x�|j�}|sqPn|d}y|jd�}Wntk
r�d}nX|| j	�}|s�q[nt
|�dkr|dd	kr|dd
|dg|d*n3t
|�dkr9t|d|||f�q[ntrN|\}}n|\}}|dd
krw|d}n|dd
kr�|d}|t|<n|t
kr�td||||f�td||t
|f�n|t
|<q[W|j�dS(NR+s: cannot read substfile: s
iit#i����itstructt is%s:%r: warning: bad line: %rRs"%s:%r: warning: overriding: %r %r
s%s:%r: warning: previous: %r
(R1R2RRRR	R6tindext
ValueErrorR3RQR]RXRVR8(	t	substfiletfpRRGRHRYtwordstvaluetkey((s,/usr/lib64/python2.7/Tools/scripts/fixcid.pyRsH


" 


t__main__(1RRR
R=RtstderrR<RRR0R:RRRRRRt
IdentifiertStringtChartCommentStartt
CommentEndt	Hexnumbert	Octnumbert	Decnumbert	IntnumbertExponentt
PointfloattExpfloattFloatnumbertNumbertOutsideCommentR$tOutsideCommentPatterntcompileROt
InsideCommenttInsideCommentPatternRUR5R7RWR
R]RRVRXRt__name__(((s,/usr/lib64/python2.7/Tools/scripts/fixcid.pyt<module>%sX
					P
		'			%xxci.pyc000064400000007661151732701340006251 0ustar00�
�fc@s8ddlZddlZddlTddlZdZd*Zd�Zd�Zdd	d
ddgZd
ddddgZ	ddddddddddddddgZ
gZd �Zd!�Z
d"�Zd#�Zd$�Zd%�Zd&�Zd'�Zed(kr4ye�ee��Wq4ek
r0d)GHq4XndS(+i����N(t*s`i�icCs�tjd}|r|SdGHg}xBtjtj�D].}t|�s5|jt|�|f�q5q5W|j�|s�dGHtj	d�n|j�|j
�x!|D]\}}|j|�q�W|S(Nis1No arguments, checking almost *, in "ls -t" ordersNothing to do -- exit 1(tsystargvtostlistdirtcurdirtskipfiletappendtgetmtimetsorttexittreverse(targstlisttfiletmtime((s*/usr/lib64/python2.7/Tools/scripts/xxci.pytgetargss"
 


cCs7ytj|�}|tSWntjk
r2dSXdS(Ni����(RtstattST_MTIMEterror(Rtst((s*/usr/lib64/python2.7/Tools/scripts/xxci.pyR"s
ttagstTAGStxyzzys	nohup.outtcoret.t,t@t#so.t~s.as.os.olds.baks.origs.news.prevs.nots.pycs.fdcs.rgbs.elcs,vcCs�tt(xtD]}tj|d�qWxtD]}tjd|�q0Wytdd�}Wntk
rrdSXt|j�j�t(dS(NRs.xxcigntr(	tbadnamestignoretbadprefixesRtbadsuffixestopentIOErrortreadtsplit(tptf((s*/usr/lib64/python2.7/Tools/scripts/xxci.pytsetup0s


cCs�x$tD]}tj||�rdSqWytj|�}Wntjk
rQdSXt|t�sfdS|ttkrzdSy2t	|d�j
tt��}|tkr�dSWnnXdS(NiRi(
R tfnmatchRtlstatRtS_ISREGtST_MODEtST_SIZEtMAXSIZER#R%tlent	EXECMAGIC(RR'Rtdata((s*/usr/lib64/python2.7/Tools/scripts/xxci.pyR<s$
cCs/x(tD] }|t|� |krdSqWdS(Nii(R!R0(Rtbad((s*/usr/lib64/python2.7/Tools/scripts/xxci.pyt	badprefixOs
cCs0x)tD]!}|t|�|krdSqWdS(Nii(R"R0(RR3((s*/usr/lib64/python2.7/Tools/scripts/xxci.pyt	badsuffixTs
cCstxm|D]e}|dGHt|�rt|�td|d�rltjd|�}tjd|�}qlqqWdS(Nt:s	Check in s ? srcs -l sci -l (t	differingt	showdiffstaskyesnoRtsystem(RRtsts((s*/usr/lib64/python2.7/Tools/scripts/xxci.pytgoYs
	
cCs+d|d|}tj|�}|dkS(Nsco -p s 2>/dev/null | cmp -s - i(RR:(RtcmdR;((s*/usr/lib64/python2.7/Tools/scripts/xxci.pyR7bscCs!d|d}tj|�}dS(Nsrcsdiff s 2>&1 | ${PAGER-more}(RR:(RR=R;((s*/usr/lib64/python2.7/Tools/scripts/xxci.pyR8gscCst|�}|dkS(Ntytyes(R>R?(t	raw_input(tpromptts((s*/usr/lib64/python2.7/Tools/scripts/xxci.pyR9kst__main__s[Intr]i (RRRR*R1R/RRRR!R"R R)RR4R5R<R7R8R9t__name__tKeyboardInterrupt(((s*/usr/lib64/python2.7/Tools/scripts/xxci.pyt<module>s4
											
reindent-rst.pyo000064400000000741151732701350007721 0ustar00�
�fc@sJddlZddlZejd�ZedkrFeje��ndS(i����NcCstj|d�dS(Ni(t
patchchecktnormalize_docs_whitespace(targv((s2/usr/lib64/python2.7/Tools/scripts/reindent-rst.pytmain
st__main__(tsysRRRt__name__texit(((s2/usr/lib64/python2.7/Tools/scripts/reindent-rst.pyt<module>srgrep.pyc000064400000003531151732701350006406 0ustar00�
�fc@sYdZddlZddlZddlZd�Zdd�ZedkrUe�ndS(s.Reverse grep.

Usage: rgrep [-i] pattern file
i����NcCsAd}d}tjtjdd�\}}x0|D](\}}|dkr2|tjB}q2q2Wt|�dkr}td�nt|�dkr�td	�n|\}}ytj||�}Wn*tjk
r�}	td
t	|	��nXyt
|�}
Wn6tk
r3}	tdt|�t	|	�fd�nX|
j
dd�|
j�}d}x�|dkr<t||�}
||
}|
j
|�|
j|
�}|jd�}~|dkr�|d
s�|d
=q�n|d
||d
<|dkr|d}|d=nd}|j�x%|D]}|j|�r|GHqqWqYWdS(Ni@iiitis-iisnot enough argumentss"exactly one file argument requiredserror in regular expression: %sscan't open %s: %ss
i����i(tgetopttsystargvtret
IGNORECASEtlentusagetcompileterrortstrtopentIOErrortreprtseekttelltNonetmintreadtsplittreversetsearch(tbufsizetreflagstoptstargstotatpatterntfilenametprogtmsgtftpostleftovertsizetbuffertlinestline((s+/usr/lib64/python2.7/Tools/scripts/rgrep.pytmainsR

'







icCs'tjt_|GHtGHtj|�dS(N(Rtstderrtstdoutt__doc__texit(Rtcode((s+/usr/lib64/python2.7/Tools/scripts/rgrep.pyR9st__main__(R*RRRR'Rt__name__(((s+/usr/lib64/python2.7/Tools/scripts/rgrep.pyt<module>s	-linktree.pyo000064400000003751151732701350007124 0ustar00�
�fc@sYddlZddlZdZdZd�Zd�ZedkrUeje��ndS(i����Ns.LINKicCsudttj�ko dkns=dGtjdGdGHdStjdtjd}}ttj�dkr�tjd}d}nt}d}tjj|�s�|dGHdSytj|d	�Wn$tjk
r�}|d
G|GHdSXtjj	||�}y&tj
tjj	tj|�|�Wn:tjk
r`}|sP|dG|GHdS|dG|GHnXt|||�dS(
Niisusage:isoldtree newtree [linkto]iis: not a directoryi�s: cannot mkdir:s: cannot symlink:s: warning: cannot symlink:(
tlentsystargvtLINKtostpathtisdirtmkdirterrortjointsymlinktpardirt	linknames(toldtreetnewtreetlinkt
link_may_failtmsgtlinkname((s./usr/lib64/python2.7/Tools/scripts/linktree.pytmains6%
		
&
c
Cs�trdG|||fGHnytj|�}Wn$tjk
rT}|dG|GHdSXx$|D]}|tjtjfkr\tjj||�}tjj||�}tjj||�}tdkr�|G|G|GHntjj|�retjj	|�reytj
|d�d}	Wn|dG|GHd}	nX|	rutjjtj|�}t|||�quqxtj||�q\q\WdS(NRs: warning: cannot listdir:ii�s: warning: cannot mkdir:i(
tdebugRtlistdirRtcurdirRRR	RtislinkRRR
(
toldtnewRtnamesRtnametoldnameRtnewnametok((s./usr/lib64/python2.7/Tools/scripts/linktree.pyR2s8




	t__main__(RRRRRRt__name__texit(((s./usr/lib64/python2.7/Tools/scripts/linktree.pyt<module>
s		checkpip.py000075500000001365151732701350006720 0ustar00#! /usr/bin/python2.7
"""
Checks that the version of the projects bundled in ensurepip are the latest
versions available.
"""
import ensurepip
import json
import urllib2
import sys


def main():
    outofdate = False

    for project, version in ensurepip._PROJECTS:
        data = json.loads(urllib2.urlopen(
            "https://pypi.python.org/pypi/{}/json".format(project),
        ).read().decode("utf8"))
        upstream_version = data["info"]["version"]

        if version != upstream_version:
            outofdate = True
            print("The latest version of {} on PyPI is {}, but ensurepip "
                  "has {}".format(project, upstream_version, version))

    if outofdate:
        sys.exit(1)


if __name__ == "__main__":
    main()
analyze_dxp.pyc000064400000011214151732701350007602 0ustar00�
�fc@s�dZddlZddlZddlZddlZddlZeed�s`ed��nej�Z	ej
�ad�Zd�Z
d�Zd�Zd	�Zd
�Zdd�ZdS(s
Some helper functions to analyze the output of sys.getdxp() (which is
only available if Python was built with -DDYNAMIC_EXECUTION_PROFILE).
These will tell you which opcodes have been executed most frequently
in the current process, and, if Python was also built with -DDXPAIRS,
will tell you which instruction _pairs_ were executed most frequently,
which may help in choosing new instructions.

If Python was built without -DDYNAMIC_EXECUTION_PROFILE, importing
this module will raise a RuntimeError.

If you're running a script you want to profile, a simple way to get
the common pairs is:

$ PYTHONPATH=$PYTHONPATH:<python_srcdir>/Tools/scripts ./python -i -O the_script.py --args
...
> from analyze_dxp import *
> s = render_common_pairs()
> open('/tmp/some_file', 'w').write(s)
i����NtgetdxpsKCan't import analyze_dxp: Python built without -DDYNAMIC_EXECUTION_PROFILE.cCs#t|�dko"t|dt�S(s[Returns True if the Python that produced the argument profile
    was built with -DDXPAIRS.i(tlent
isinstancetlist(tprofile((s1/usr/lib64/python2.7/Tools/scripts/analyze_dxp.pyt	has_pairs(scCs't�tj�tj�aWdQXdS(s<Forgets any execution profile that has been gathered so far.N(t
_profile_locktsysRt_cumulative_profile(((s1/usr/lib64/python2.7/Tools/scripts/analyze_dxp.pyt
reset_profile/s
cCs�t��tj�}t|�r|x�ttt��D]C}x:ttt|��D]"}t||c|||7<qOWq2Wn1x.ttt��D]}t|c||7<q�WWdQXdS(s�Reads sys.getdxp() and merges it into this module's cached copy.

    We need this because sys.getdxp() 0s itself every time it's called.N(RRRRtrangeRR(tnew_profilet
first_insttsecond_insttinst((s1/usr/lib64/python2.7/Tools/scripts/analyze_dxp.pyt
merge_profile7scCs%t�t�tjt�SWdQXdS(s9Returns the cumulative execution profile until this call.N(RRtcopytdeepcopyR(((s1/usr/lib64/python2.7/Tools/scripts/analyze_dxp.pytsnapshot_profileHscCs�t|�r|r|d}n|}gt|�D].\}}|dkr2|tj||f^q2}|jdtjd�dt�|S(s�Returns the most common opcodes in order of descending frequency.

    The result is a list of tuples of the form
      (opcode, opname, # of occurrences)

    i����itkeyitreverse(Rt	enumeratetopcodetopnametsorttoperatort
itemgettertTrue(Rt	inst_listtoptcounttresult((s1/usr/lib64/python2.7/Tools/scripts/analyze_dxp.pytcommon_instructionsOs
(cCs�t|�sgSgt|d �D]Z\}}t|�D]A\}}|dkr7||ftj|tj|f|f^q7q!}|jdtjd�dt�|S(s�Returns the most common opcode pairs in order of descending frequency.

    The result is a list of tuples of the form
      ((1st opcode, 2nd opcode),
       (1st opname, 2nd opname),
       # of occurrences of the pair)

    i����iRiR(RRRRRRRR(Rtop1t
op1profiletop2RR((s1/usr/lib64/python2.7/Tools/scripts/analyze_dxp.pytcommon_pairsas	>cs7�dkrt��n�fd�}dj|��S(s�Renders the most common opcode pairs to a string in order of
    descending frequency.

    The result is a series of lines of the form:
      # of occurrences: ('1st opname', '2nd opname')

    c3s3x,t��D]\}}}d||fVq
WdS(Ns%s: %s
(R$(t_topsR(R(s1/usr/lib64/python2.7/Tools/scripts/analyze_dxp.pytseqstN(tNoneRtjoin(RR'((Rs1/usr/lib64/python2.7/Tools/scripts/analyze_dxp.pytrender_common_pairsus(t__doc__RRRRt	threadingthasattrtRuntimeErrortRLockRRRRR	RRR R$R)R+(((s1/usr/lib64/python2.7/Tools/scripts/analyze_dxp.pyt<module>s 						db2pickle.pyo000064400000006651151732701350007150 0ustar00�
�fc@sBdZddlZyddlZWnek
r;dZnXyddlZWnek
redZnXyddlZWnek
r�dZnXyddlZWnek
r�dZnXddlZyddl	Z
Wnek
r�ddl
Z
nXejdZd�Z
d�Zedkr>ejeejd��ndS(s5
Synopsis: %(prog)s [-h|-g|-b|-r|-a] dbfile [ picklefile ]

Convert the database file given on the command line to a pickle
representation.  The optional flags indicate the type of the database:

    -a - open using anydbm
    -b - open as bsddb btree file
    -d - open as dbm file
    -g - open as gdbm file
    -h - open as bsddb hash file
    -r - open as bsddb recno file

The default is hash.  If a pickle file is named it is opened for write
access (deleting any existing data).  If no pickle file is named, the pickle
output is written to standard output.

i����NicCstjjtt��dS(N(tsyststderrtwritet__doc__tglobals(((s//usr/lib64/python2.7/Tools/scripts/db2pickle.pytusage/sc		Cs�y1tj|dddddddg�\}}Wntjk
rOt�dSXt|�d	kstt|�d
krt�dSt|�dkr�|d	}tj}nN|d	}yt|dd�}Wn*tk
r�tjj	d|d�dSXd}x�|D]�\}}|d"krOy
tj}Wq�t
k
rKtjj	d�dSXq|d#kr�y
tj}Wq�t
k
r�tjj	d�dSXq|d$kr�y
tj}Wq�t
k
r�tjj	d�dSXq|d%kry
tj}Wq�t
k
rtjj	d�dSXq|d&krSy
tj}Wq�t
k
rOtjj	d�dSXq|d'kry
tj}Wq�t
k
r�tjj	d�dSXqqW|dkr�tdkr�tjj	d�tjj	d�dStj}ny||d�}Wn9tjk
r.tjj	d |�tjj	d!�dSXx7|j�D])}tj|||f|ddk�q<W|j�|j�d	S((NthbrdagthashtbtreetrecnotdbmtgdbmtanydbmiiitwbsUnable to open %s
s-hs--hashsbsddb module unavailable.
s-bs--btrees-rs--recnos-as--anydbmsanydbm module unavailable.
s-gs--gdbmsgdbm module unavailable.
s-ds--dbmsdbm module unavailable.
sbsddb module unavailable - smust specify dbtype.
trsUnable to open %s.  s&Check for format or version mismatch.
(s-hs--hash(s-bs--btree(s-rs--recno(s-as--anydbm(s-gs--gdbm(s-ds--dbm(tgetoptterrorRtlenRtstdouttopentIOErrorRRtNonetbsddbthashopentAttributeErrortbtopentrnopenRRR
tkeystpickletdumptclose(	targstoptstdbfiletpfiletdbopentopttargtdbtk((s//usr/lib64/python2.7/Tools/scripts/db2pickle.pytmain2s�$














'

t__main__i(RRRtImportErrorRR
RRRtcPickleRtargvtprogRR(t__name__texit(((s//usr/lib64/python2.7/Tools/scripts/db2pickle.pyt<module>s6









		Tfixcid.py000075500000023413151732701350006376 0ustar00#! /usr/bin/python2.7

# Perform massive identifier substitution on C source files.
# This actually tokenizes the files (to some extent) so it can
# avoid making substitutions inside strings or comments.
# Inside strings, substitutions are never made; inside comments,
# it is a user option (off by default).
#
# The substitutions are read from one or more files whose lines,
# when not empty, after stripping comments starting with #,
# must contain exactly two words separated by whitespace: the
# old identifier and its replacement.
#
# The option -r reverses the sense of the substitutions (this may be
# useful to undo a particular substitution).
#
# If the old identifier is prefixed with a '*' (with no intervening
# whitespace), then it will not be substituted inside comments.
#
# Command line arguments are files or directories to be processed.
# Directories are searched recursively for files whose name looks
# like a C file (ends in .h or .c).  The special filename '-' means
# operate in filter mode: read stdin, write stdout.
#
# Symbolic links are always ignored (except as explicit directory
# arguments).
#
# The original files are kept as back-up with a "~" suffix.
#
# Changes made are reported to stdout in a diff-like format.
#
# NB: by changing only the function fixline() you can turn this
# into a program for different changes to C source files; by
# changing the function wanted() you can make a different selection of
# files.

import sys
import re
import os
from stat import *
import getopt

err = sys.stderr.write
dbg = err
rep = sys.stdout.write

def usage():
    progname = sys.argv[0]
    err('Usage: ' + progname +
              ' [-c] [-r] [-s file] ... file-or-directory ...\n')
    err('\n')
    err('-c           : substitute inside comments\n')
    err('-r           : reverse direction for following -s options\n')
    err('-s substfile : add a file of substitutions\n')
    err('\n')
    err('Each non-empty non-comment line in a substitution file must\n')
    err('contain exactly two words: an identifier and its replacement.\n')
    err('Comments start with a # character and end at end of line.\n')
    err('If an identifier is preceded with a *, it is not substituted\n')
    err('inside a comment even when -c is specified.\n')

def main():
    try:
        opts, args = getopt.getopt(sys.argv[1:], 'crs:')
    except getopt.error, msg:
        err('Options error: ' + str(msg) + '\n')
        usage()
        sys.exit(2)
    bad = 0
    if not args: # No arguments
        usage()
        sys.exit(2)
    for opt, arg in opts:
        if opt == '-c':
            setdocomments()
        if opt == '-r':
            setreverse()
        if opt == '-s':
            addsubst(arg)
    for arg in args:
        if os.path.isdir(arg):
            if recursedown(arg): bad = 1
        elif os.path.islink(arg):
            err(arg + ': will not process symbolic links\n')
            bad = 1
        else:
            if fix(arg): bad = 1
    sys.exit(bad)

# Change this regular expression to select a different set of files
Wanted = r'^[a-zA-Z0-9_]+\.[ch]$'
def wanted(name):
    return re.match(Wanted, name)

def recursedown(dirname):
    dbg('recursedown(%r)\n' % (dirname,))
    bad = 0
    try:
        names = os.listdir(dirname)
    except os.error, msg:
        err(dirname + ': cannot list directory: ' + str(msg) + '\n')
        return 1
    names.sort()
    subdirs = []
    for name in names:
        if name in (os.curdir, os.pardir): continue
        fullname = os.path.join(dirname, name)
        if os.path.islink(fullname): pass
        elif os.path.isdir(fullname):
            subdirs.append(fullname)
        elif wanted(name):
            if fix(fullname): bad = 1
    for fullname in subdirs:
        if recursedown(fullname): bad = 1
    return bad

def fix(filename):
##  dbg('fix(%r)\n' % (filename,))
    if filename == '-':
        # Filter mode
        f = sys.stdin
        g = sys.stdout
    else:
        # File replacement mode
        try:
            f = open(filename, 'r')
        except IOError, msg:
            err(filename + ': cannot open: ' + str(msg) + '\n')
            return 1
        head, tail = os.path.split(filename)
        tempname = os.path.join(head, '@' + tail)
        g = None
    # If we find a match, we rewind the file and start over but
    # now copy everything to a temp file.
    lineno = 0
    initfixline()
    while 1:
        line = f.readline()
        if not line: break
        lineno = lineno + 1
        while line[-2:] == '\\\n':
            nextline = f.readline()
            if not nextline: break
            line = line + nextline
            lineno = lineno + 1
        newline = fixline(line)
        if newline != line:
            if g is None:
                try:
                    g = open(tempname, 'w')
                except IOError, msg:
                    f.close()
                    err(tempname+': cannot create: '+
                        str(msg)+'\n')
                    return 1
                f.seek(0)
                lineno = 0
                initfixline()
                rep(filename + ':\n')
                continue # restart from the beginning
            rep(repr(lineno) + '\n')
            rep('< ' + line)
            rep('> ' + newline)
        if g is not None:
            g.write(newline)

    # End of file
    if filename == '-': return 0 # Done in filter mode
    f.close()
    if not g: return 0 # No changes
    g.close()

    # Finishing touch -- move files

    # First copy the file's mode to the temp file
    try:
        statbuf = os.stat(filename)
        os.chmod(tempname, statbuf[ST_MODE] & 07777)
    except os.error, msg:
        err(tempname + ': warning: chmod failed (' + str(msg) + ')\n')
    # Then make a backup of the original file as filename~
    try:
        os.rename(filename, filename + '~')
    except os.error, msg:
        err(filename + ': warning: backup failed (' + str(msg) + ')\n')
    # Now move the temp file to the original file
    try:
        os.rename(tempname, filename)
    except os.error, msg:
        err(filename + ': rename failed (' + str(msg) + ')\n')
        return 1
    # Return success
    return 0

# Tokenizing ANSI C (partly)

Identifier = '(struct )?[a-zA-Z_][a-zA-Z0-9_]+'
String = r'"([^\n\\"]|\\.)*"'
Char = r"'([^\n\\']|\\.)*'"
CommentStart = r'/\*'
CommentEnd = r'\*/'

Hexnumber = '0[xX][0-9a-fA-F]*[uUlL]*'
Octnumber = '0[0-7]*[uUlL]*'
Decnumber = '[1-9][0-9]*[uUlL]*'
Intnumber = Hexnumber + '|' + Octnumber + '|' + Decnumber
Exponent = '[eE][-+]?[0-9]+'
Pointfloat = r'([0-9]+\.[0-9]*|\.[0-9]+)(' + Exponent + r')?'
Expfloat = '[0-9]+' + Exponent
Floatnumber = Pointfloat + '|' + Expfloat
Number = Floatnumber + '|' + Intnumber

# Anything else is an operator -- don't list this explicitly because of '/*'

OutsideComment = (Identifier, Number, String, Char, CommentStart)
OutsideCommentPattern = '(' + '|'.join(OutsideComment) + ')'
OutsideCommentProgram = re.compile(OutsideCommentPattern)

InsideComment = (Identifier, Number, CommentEnd)
InsideCommentPattern = '(' + '|'.join(InsideComment) + ')'
InsideCommentProgram = re.compile(InsideCommentPattern)

def initfixline():
    global Program
    Program = OutsideCommentProgram

def fixline(line):
    global Program
##  print '-->', repr(line)
    i = 0
    while i < len(line):
        match = Program.search(line, i)
        if match is None: break
        i = match.start()
        found = match.group(0)
##      if Program is InsideCommentProgram: print '...',
##      else: print '   ',
##      print found
        if len(found) == 2:
            if found == '/*':
                Program = InsideCommentProgram
            elif found == '*/':
                Program = OutsideCommentProgram
        n = len(found)
        if found in Dict:
            subst = Dict[found]
            if Program is InsideCommentProgram:
                if not Docomments:
                    print 'Found in comment:', found
                    i = i + n
                    continue
                if found in NotInComment:
##                  print 'Ignored in comment:',
##                  print found, '-->', subst
##                  print 'Line:', line,
                    subst = found
##              else:
##                  print 'Substituting in comment:',
##                  print found, '-->', subst
##                  print 'Line:', line,
            line = line[:i] + subst + line[i+n:]
            n = len(subst)
        i = i + n
    return line

Docomments = 0
def setdocomments():
    global Docomments
    Docomments = 1

Reverse = 0
def setreverse():
    global Reverse
    Reverse = (not Reverse)

Dict = {}
NotInComment = {}
def addsubst(substfile):
    try:
        fp = open(substfile, 'r')
    except IOError, msg:
        err(substfile + ': cannot read substfile: ' + str(msg) + '\n')
        sys.exit(1)
    lineno = 0
    while 1:
        line = fp.readline()
        if not line: break
        lineno = lineno + 1
        try:
            i = line.index('#')
        except ValueError:
            i = -1          # Happens to delete trailing \n
        words = line[:i].split()
        if not words: continue
        if len(words) == 3 and words[0] == 'struct':
            words[:2] = [words[0] + ' ' + words[1]]
        elif len(words) != 2:
            err(substfile + '%s:%r: warning: bad line: %r' % (substfile, lineno, line))
            continue
        if Reverse:
            [value, key] = words
        else:
            [key, value] = words
        if value[0] == '*':
            value = value[1:]
        if key[0] == '*':
            key = key[1:]
            NotInComment[key] = value
        if key in Dict:
            err('%s:%r: warning: overriding: %r %r\n' % (substfile, lineno, key, value))
            err('%s:%r: warning: previous: %r\n' % (substfile, lineno, Dict[key]))
        Dict[key] = value
    fp.close()

if __name__ == '__main__':
    main()
fixps.pyc000064400000001711151732701350006416 0ustar00�
�fc@s;ddlZddlZd�Zedkr7e�ndS(i����NcCs�x�tjdD]�}yt|d�}Wn#tk
rL}|GdG|GHqnX|j�}tjd|�s�|GdGH|j�qn|j�}|j�tj	dd|�}|GdGt
|�GHt|d	�}|j|�|j|�|j�qWdS(
Nitrs: can't open :s^#! */usr/local/bin/pythons$: not a /usr/local/bin/python scripts/usr/local/bin/pythons/usr/bin/env pythont:tw(tsystargvtopentIOErrortreadlinetretmatchtclosetreadtsubtreprtwrite(tfilenametftmsgtlinetrest((s+/usr/lib64/python2.7/Tools/scripts/fixps.pytmain
s(
	

	

t__main__(RRRt__name__(((s+/usr/lib64/python2.7/Tools/scripts/fixps.pyt<module>s	hotshotmain.pyo000064400000003507151732701360007644 0ustar00�
�fc@s�dZddlZddlZddlZddlZddlZdZd�Zd�Ze	dkr�ej
eejd��ndS(s�
Run a Python script under hotshot's control.

Adapted from a posting on python-dev by Walter D�rwald

usage %prog [ %prog args ] filename [ filename args ]

Any arguments after the filename are used as sys.argv for the filename.
i����Nshotshot.profcCs�tj|�}tjjdtjj|��|g|t_|jd|�|j	�tj
j|�}|jdd�tj
}tjt_
|j�|t_
dS(Nisexecfile(%r)ttimetcalls(thotshottProfiletsystpathtinserttostdirnametargvtruntclosetstatstloadt
sort_statststdouttstderrtprint_stats(tfilenametprofiletargstprofRtsave_stdout((s1/usr/lib64/python2.7/Tools/scripts/hotshotmain.pytrun_hotshots
	
	cCs�tjt�}|j�|jdddddtdddd	�|j|�\}}t|�d
kry|jd�dS|d
}t	||j
|d�S(
Ns-ps	--profiletactiontstoretdefaulttdestRthelpsSpecify profile file to useismissing script to executei(toptparsetOptionParsert__doc__tdisable_interspersed_argst
add_optiontPROFILEt
parse_argstlent
print_helpRR(RtparsertoptionsR((s1/usr/lib64/python2.7/Tools/scripts/hotshotmain.pytmain(s



t__main__i(RRRRRt
hotshot.statsR"RR(t__name__texitR	(((s1/usr/lib64/python2.7/Tools/scripts/hotshotmain.pyt<module>s		ndiff.py000075500000007340151732701360006220 0ustar00#! /usr/bin/python2.7

# Module ndiff version 1.7.0
# Released to the public domain 08-Dec-2000,
# by Tim Peters (tim.one@home.com).

# Provided as-is; use at your own risk; no warranty; no promises; enjoy!

# ndiff.py is now simply a front-end to the difflib.ndiff() function.
# Originally, it contained the difflib.SequenceMatcher class as well.
# This completes the raiding of reusable code from this formerly
# self-contained script.

"""ndiff [-q] file1 file2
    or
ndiff (-r1 | -r2) < ndiff_output > file1_or_file2

Print a human-friendly file difference report to stdout.  Both inter-
and intra-line differences are noted.  In the second form, recreate file1
(-r1) or file2 (-r2) on stdout, from an ndiff report on stdin.

In the first form, if -q ("quiet") is not specified, the first two lines
of output are

-: file1
+: file2

Each remaining line begins with a two-letter code:

    "- "    line unique to file1
    "+ "    line unique to file2
    "  "    line common to both files
    "? "    line not present in either input file

Lines beginning with "? " attempt to guide the eye to intraline
differences, and were not present in either input file.  These lines can be
confusing if the source files contain tab characters.

The first file can be recovered by retaining only lines that begin with
"  " or "- ", and deleting those 2-character prefixes; use ndiff with -r1.

The second file can be recovered similarly, but by retaining only "  " and
"+ " lines; use ndiff with -r2; or, on Unix, the second file can be
recovered by piping the output through

    sed -n '/^[+ ] /s/^..//p'
"""

__version__ = 1, 7, 0

import difflib, sys

def fail(msg):
    out = sys.stderr.write
    out(msg + "\n\n")
    out(__doc__)
    return 0

# open a file & return the file object; gripe and return 0 if it
# couldn't be opened
def fopen(fname):
    try:
        return open(fname, 'U')
    except IOError, detail:
        return fail("couldn't open " + fname + ": " + str(detail))

# open two files & spray the diff to stdout; return false iff a problem
def fcompare(f1name, f2name):
    f1 = fopen(f1name)
    f2 = fopen(f2name)
    if not f1 or not f2:
        return 0

    a = f1.readlines(); f1.close()
    b = f2.readlines(); f2.close()
    for line in difflib.ndiff(a, b):
        print line,

    return 1

# crack args (sys.argv[1:] is normal) & compare;
# return false iff a problem

def main(args):
    import getopt
    try:
        opts, args = getopt.getopt(args, "qr:")
    except getopt.error, detail:
        return fail(str(detail))
    noisy = 1
    qseen = rseen = 0
    for opt, val in opts:
        if opt == "-q":
            qseen = 1
            noisy = 0
        elif opt == "-r":
            rseen = 1
            whichfile = val
    if qseen and rseen:
        return fail("can't specify both -q and -r")
    if rseen:
        if args:
            return fail("no args allowed with -r option")
        if whichfile in ("1", "2"):
            restore(whichfile)
            return 1
        return fail("-r value must be 1 or 2")
    if len(args) != 2:
        return fail("need 2 filename args")
    f1name, f2name = args
    if noisy:
        print '-:', f1name
        print '+:', f2name
    return fcompare(f1name, f2name)

# read ndiff output from stdin, and print file1 (which=='1') or
# file2 (which=='2') to stdout

def restore(which):
    restored = difflib.restore(sys.stdin.readlines(), which)
    sys.stdout.writelines(restored)

if __name__ == '__main__':
    args = sys.argv[1:]
    if "-profile" in args:
        import profile, pstats
        args.remove("-profile")
        statf = "ndiff.pro"
        profile.run("main(args)", statf)
        stats = pstats.Stats(statf)
        stats.strip_dirs().sort_stats('time').print_stats()
    else:
        main(args)
mkreal.py000075500000003133151732701370006402 0ustar00#! /usr/bin/python2.7

# mkreal
#
# turn a symlink to a directory into a real directory

import sys
import os
from stat import *

join = os.path.join

error = 'mkreal error'

BUFSIZE = 32*1024

def mkrealfile(name):
    st = os.stat(name) # Get the mode
    mode = S_IMODE(st[ST_MODE])
    linkto = os.readlink(name) # Make sure again it's a symlink
    f_in = open(name, 'r') # This ensures it's a file
    os.unlink(name)
    f_out = open(name, 'w')
    while 1:
        buf = f_in.read(BUFSIZE)
        if not buf: break
        f_out.write(buf)
    del f_out # Flush data to disk before changing mode
    os.chmod(name, mode)

def mkrealdir(name):
    st = os.stat(name) # Get the mode
    mode = S_IMODE(st[ST_MODE])
    linkto = os.readlink(name)
    files = os.listdir(name)
    os.unlink(name)
    os.mkdir(name, mode)
    os.chmod(name, mode)
    linkto = join(os.pardir, linkto)
    #
    for filename in files:
        if filename not in (os.curdir, os.pardir):
            os.symlink(join(linkto, filename), join(name, filename))

def main():
    sys.stdout = sys.stderr
    progname = os.path.basename(sys.argv[0])
    if progname == '-c': progname = 'mkreal'
    args = sys.argv[1:]
    if not args:
        print 'usage:', progname, 'path ...'
        sys.exit(2)
    status = 0
    for name in args:
        if not os.path.islink(name):
            print progname+':', name+':', 'not a symlink'
            status = 1
        else:
            if os.path.isdir(name):
                mkrealdir(name)
            else:
                mkrealfile(name)
    sys.exit(status)

if __name__ == '__main__':
    main()
google.pyo000064400000001430151732701370006555 0ustar00�
�fc@s;ddlZddlZd�Zedkr7e�ndS(i����NcCs�tjd}|s'dtjdGHdSg}xg|D]_}d|kr[|jdd�}nd|krtd|}n|jdd�}|j|�q4Wdj|�}d|}tj|�dS(	NisUsage: %s querystringit+s%2Bt s"%s"s!http://www.google.com/search?q=%s(tsystargvtreplacetappendtjoint
webbrowsertopen(targstlisttargtsturl((s,/usr/lib64/python2.7/Tools/scripts/google.pytmains



t__main__(RRRt__name__(((s,/usr/lib64/python2.7/Tools/scripts/google.pyt<module>s	crlf.py000075500000001142151732701370006053 0ustar00#! /usr/bin/python2.7
"Replace CRLF with LF in argument files.  Print names of changed files."

import sys, os

def main():
    for filename in sys.argv[1:]:
        if os.path.isdir(filename):
            print filename, "Directory!"
            continue
        data = open(filename, "rb").read()
        if '\0' in data:
            print filename, "Binary!"
            continue
        newdata = data.replace("\r\n", "\n")
        if newdata != data:
            print filename
            f = open(filename, "wb")
            f.write(newdata)
            f.close()

if __name__ == '__main__':
    main()
pindent.pyo000064400000026447151732701370006761 0ustar00�
�fc@s�ddlmZdZdZeZddlZddlZddlZiZ	d e	d<e	d<d!e	d<e	d	<d"e	d<d#e	d
<de	d<e	d<e	d
<e	d<e	d<d$e	d<d%Z
dd&d��YZejej
eeed�Zejej
eeed�Zejej
eeed�Zeeed�Zeeed�Zeeed�Zd�Zeeed�Zeeed�Zeeed�Zde�Zd�Zd�Zedkr�e�ndS('i����(tprint_functioniNteliftelsetendtiftwhiletfortexcepttfinallyttrytwithtdeftclasstPythonIndentercBsneZejejeeed�Zd�Z	d�Z
d�Zd�Zd�Z
d�Zd�Zd�ZRS(	cCs|||_||_||_||_d|_||_|j|_tj	d�|_
tj	d�|_tj	d�|_dS(NisC^(?:\s|\\\n)*(?P<kw>[a-z]+)((?:\s|\\\n)+(?P<id>[a-zA-Z_]\w*))?[^\w]sE^(?:\s|\\\n)*#?\s*end\s+(?P<kw>[a-z]+)(\s+(?P<id>[a-zA-Z_]\w*))?[^\w]s^[ \t]*(
tfpitfpot
indentsizettabsizetlinenot
expandtabstwritet_writetretcompiletkwprogtendprogtwsprog(tselfRRRRR((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyt__init__fs						cCs6|jr%|j|j|j��n
|j|�dS(N(RRR(Rtline((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyRzs	cCs+|jj�}|r'|jd7_n|S(Ni(RtreadlineR(RR((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyR�scGsE|r||}ntjjd|j|f�|jd|�dS(NsError at line %d: %s
s### %s ###
(tsyststderrRR(Rtfmttargs((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyterror�s
cCsG|j�}x4|ddkrB|j�}|s5Pn||7}qW|S(Ni����s\
(R(RRtline2((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytgetline�scCs{t||j|j�\}}|jj|�j�}||}|d dkrjd|d||}n|j|�dS(Nis
s
ts	t (s
s
R&(tdivmodRRRtmatchRR(RRtindentttabstspacesti((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytputline�s
cCs�g}xutr}|j�}|s%Pn|jj|�}|r�d}|jd�}|sh|jd�n&|j�d|kr�|jd�n|j|t|��q	n|j	j|�}|rd|jd�}|t
kr|j|t|��|j||f�q	ntj
|�rd|rd|j|t|�d�|d\}}||f|d<q	qdn|j|t|��q	W|r�|jd�x(|D]\}}|jd	|�q�WndS(
NRtkwsunexpected endis
unmatched endii����sunterminated keywordss	%s
(tTrueR%RR)tgroupR#tpopR.tlenRtstarttappendtnextthas_keyR(RtstackRtmR/tkw2tkwatkwb((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytreformat�s@		
cCs�d}d}x�tr�|j�}|s+Pn|jj|�}|rS|d7}qn|jj|�}|r�|jd�}|tkr�|d7}q�n|j|�qW||dkr�tj	jd�n#||dkr�tj	jd�ndS(NiiR/s5Warning: input contained more end tags than expected
s5Warning: input contained less end tags than expected
(
R0R%RR)RR1R4RRR (Rt
begin_countertend_counterRR9R/((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytdelete�s(	
cCs\g}g}d}}}}}x3trW|j�}|jj|�j�}	|jj|�}
|
r�d}|
jd�}|
jd�}n�|jj|�}
|
r�|
jd�}tj	|�s�d}n|d
kr�|
jd�}q$d}n0||	|	d!dkr|j
|�q%nd}||	 }
t|
j|j
��}t|j|j
��}x�||kr�|r�|r�d
||f}n
d|}|j||�d}}n|j�\}}}}t|j|j
��}qaW||kr�|r�|dkr/||kr"|jd�nd}}q�|sB|tkr�|r[d
||f}n
d|}|j||�d}}}q�n||kr�|j
||||f�|r�|tkr�d}n|
|||f\}}}}n|r|tkr|}}|}q|}nx|D]}|j|�q Wg}|sGPn|j|�q%WdS(NR&RR/tidRRis
t#s# end %s %s
s	# end %s
smismatched end(RR(s
RB(R0R%RR)RRR1RR6R7R5R3RRRR2R#R4(RR8ttodot	currentwstthisidtfirstkwtlastkwttopidRR-R9tthiskwtendkwtindentwsR*tcurrenttstl((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytcomplete�s�			





	!
		
(t__name__t
__module__RtstdintstdouttSTEPSIZEtTABSIZEt
EXPANDTABSRRRR#R%R.R=R@RO(((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyR
ds					
	+	cCs&t|||||�}|j�dS(N(R
RO(tinputtoutputtstepsizeRRtpi((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytcomplete_filterMscCs&t|||||�}|j�dS(N(R
R@(RWRXRYRRRZ((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyt
delete_filterSscCs&t|||||�}|j�dS(N(R
R=(RWRXRYRRRZ((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytreformat_filterYscCsGtj|�}tj�}t|||||�}|j�|j�S(N(tiotBytesIOR
ROtgetvalue(tsourceRYRRRWRXRZ((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytcomplete_string_s

cCsGtj|�}tj�}t|||||�}|j�|j�S(N(R^R_R
R@R`(RaRYRRRWRXRZ((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyt
delete_stringgs

cCsGtj|�}tj�}t|||||�}|j�|j�S(N(R^R_R
R=R`(RaRYRRRWRXRZ((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytreformat_stringos

cCs�ddl}ddl}|d}|jj|�ryy|j|�Wqy|jk
rutd|fdtj�qyXny|j	||�Wn1|jk
r�td||fdtj�nXdS(Ni����t~sCan't remove backup %rtfilesCan't rename %r to %r(
tostos.pathtpathtlexiststremoveR#tprintRR trename(tfilenameRgtbackup((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytmake_backupws
!cCs|t|d��}|j�}WdQXt||||�}||krIdSt|�t|d��}|j|�WdQXdS(Ntritwi(topentreadRbRpR(RnRYRRtfRatresult((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyt
complete_file�s
cCs|t|d��}|j�}WdQXt||||�}||krIdSt|�t|d��}|j|�WdQXdS(NRqiRri(RsRtRcRpR(RnRYRRRuRaRv((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytdelete_file�s
cCs|t|d��}|j�}WdQXt||||�}||krIdSt|�t|d��}|j|�WdQXdS(NRqiRri(RsRtRdRpR(RnRYRRRuRaRv((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyt
reformat_file�s
sG
usage: pindent (-c|-d|-r) [-s stepsize] [-t tabsize] [-e] [file] ...
-c         : complete a correctly indented program (add #end directives)
-d         : delete #end directives
-r         : reformat a completed program (use #end directives)
-s stepsize: indentation step (default %(STEPSIZE)d)
-t tabsize : the worth in spaces of a tab (default %(TABSIZE)d)
-e         : expand TABs into spaces (default OFF)
[file] ... : files are changed in place, with backups in file~
If no files are specified or a single - is given,
the program acts as a filter (reads stdin, writes stdout).
cCsEtjjd|d|dd�tjjt�tjd�dS(Ns Error: You can not specify both s and -is at the same time
i(RR Rtusagetexit(top1top2((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyt
error_both�s$cCs'ddl}y#|jtjdd�\}}WnG|jk
rx}tjjd|�tjjt�tjd�nXd}t	}t
}t}x�|D]�\}}	|dkr�|r�t||�nd}q�|dkr�|r�t||�nd	}q�|d
kr%|rt||�nd}q�|dkr@t
|	�}q�|d
kr[t
|	�}q�|dkr�t}q�q�W|s�tjjd�tjjt�tjd�n|s�|dgkr�t|d�}|tjtj|||�n4t|d�}x!|D]}
||
|||�qWdS(Ni����iscdrs:t:es
Error: %s
is-cROs-dR@s-rR=s-ss-ts-es7You must specify -c(omplete), -d(elete) or -r(eformat)
t-t_filtert_file(tgetoptRtargvR#R RRzR{tNoneRTRURVR~tintR0tevalRRRS(R�toptsR"tmsgtactionRYRRtotaRn((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyttest�sR#			
	
t__main__(RRR(RR(RR(RRRR((RRRR	R
RR((t
__future__RRTRUtFalseRVR^RRR6R4R
RRRSR[R\R]RbRcRdRpRwRxRytvarsRzR~R�RP(((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyt<module>OsB

*
�	
		3fixheader.pyc000064400000002677151732701370007242 0ustar00�
�fc@s8ddlZd�Zd�Zedkr4e�ndS(i����NcCs,tjd}x|D]}t|�qWdS(Ni(tsystargvtprocess(targstfilename((s//usr/lib64/python2.7/Tools/scripts/fixheader.pytmains

cCs�yt|d�}Wn4tk
rI}tjjd|t|�f�dSX|j�}|j�|d dkr�tjjd|�dSyt|d�}Wn4tk
r�}tjjd|t|�f�dSXtjjd|�d	}xI|D]A}t|�d
kr*|j	�r*||j
�}q�|d}q�W|t_dG|GHd
G|GHdGHdGHdGHH|j|�HdGHdGHdGHdGd|GdGHdS(Ntrs%s: can't open: %s
is/*s!%s does not begin with C comment
tws%s: can't write: %s
sProcessing %s ...
tPy_i�t_s#ifndefs#defines#ifdef __cplusplussextern "C" {s#endift}s	#endif /*t!s*/(topentIOErrorRtstderrtwritetstrtreadtclosetordtisalnumtuppertstdout(Rtftmsgtdatatmagictc((s//usr/lib64/python2.7/Tools/scripts/fixheader.pyRsD 
 
			
t__main__(RRRt__name__(((s//usr/lib64/python2.7/Tools/scripts/fixheader.pyt<module>s		$xxci.pyo000064400000007661151732701370006270 0ustar00�
�fc@s8ddlZddlZddlTddlZdZd*Zd�Zd�Zdd	d
ddgZd
ddddgZ	ddddddddddddddgZ
gZd �Zd!�Z
d"�Zd#�Zd$�Zd%�Zd&�Zd'�Zed(kr4ye�ee��Wq4ek
r0d)GHq4XndS(+i����N(t*s`i�icCs�tjd}|r|SdGHg}xBtjtj�D].}t|�s5|jt|�|f�q5q5W|j�|s�dGHtj	d�n|j�|j
�x!|D]\}}|j|�q�W|S(Nis1No arguments, checking almost *, in "ls -t" ordersNothing to do -- exit 1(tsystargvtostlistdirtcurdirtskipfiletappendtgetmtimetsorttexittreverse(targstlisttfiletmtime((s*/usr/lib64/python2.7/Tools/scripts/xxci.pytgetargss"
 


cCs7ytj|�}|tSWntjk
r2dSXdS(Ni����(RtstattST_MTIMEterror(Rtst((s*/usr/lib64/python2.7/Tools/scripts/xxci.pyR"s
ttagstTAGStxyzzys	nohup.outtcoret.t,t@t#so.t~s.as.os.olds.baks.origs.news.prevs.nots.pycs.fdcs.rgbs.elcs,vcCs�tt(xtD]}tj|d�qWxtD]}tjd|�q0Wytdd�}Wntk
rrdSXt|j�j�t(dS(NRs.xxcigntr(	tbadnamestignoretbadprefixesRtbadsuffixestopentIOErrortreadtsplit(tptf((s*/usr/lib64/python2.7/Tools/scripts/xxci.pytsetup0s


cCs�x$tD]}tj||�rdSqWytj|�}Wntjk
rQdSXt|t�sfdS|ttkrzdSy2t	|d�j
tt��}|tkr�dSWnnXdS(NiRi(
R tfnmatchRtlstatRtS_ISREGtST_MODEtST_SIZEtMAXSIZER#R%tlent	EXECMAGIC(RR'Rtdata((s*/usr/lib64/python2.7/Tools/scripts/xxci.pyR<s$
cCs/x(tD] }|t|� |krdSqWdS(Nii(R!R0(Rtbad((s*/usr/lib64/python2.7/Tools/scripts/xxci.pyt	badprefixOs
cCs0x)tD]!}|t|�|krdSqWdS(Nii(R"R0(RR3((s*/usr/lib64/python2.7/Tools/scripts/xxci.pyt	badsuffixTs
cCstxm|D]e}|dGHt|�rt|�td|d�rltjd|�}tjd|�}qlqqWdS(Nt:s	Check in s ? srcs -l sci -l (t	differingt	showdiffstaskyesnoRtsystem(RRtsts((s*/usr/lib64/python2.7/Tools/scripts/xxci.pytgoYs
	
cCs+d|d|}tj|�}|dkS(Nsco -p s 2>/dev/null | cmp -s - i(RR:(RtcmdR;((s*/usr/lib64/python2.7/Tools/scripts/xxci.pyR7bscCs!d|d}tj|�}dS(Nsrcsdiff s 2>&1 | ${PAGER-more}(RR:(RR=R;((s*/usr/lib64/python2.7/Tools/scripts/xxci.pyR8gscCst|�}|dkS(Ntytyes(R>R?(t	raw_input(tpromptts((s*/usr/lib64/python2.7/Tools/scripts/xxci.pyR9kst__main__s[Intr]i (RRRR*R1R/RRRR!R"R R)RR4R5R<R7R8R9t__name__tKeyboardInterrupt(((s*/usr/lib64/python2.7/Tools/scripts/xxci.pyt<module>s4
											
rgrep.py000075500000002724151732701370006253 0ustar00#! /usr/bin/python2.7

"""Reverse grep.

Usage: rgrep [-i] pattern file
"""

import sys
import re
import getopt

def main():
    bufsize = 64*1024
    reflags = 0
    opts, args = getopt.getopt(sys.argv[1:], "i")
    for o, a in opts:
        if o == '-i':
            reflags = reflags | re.IGNORECASE
    if len(args) < 2:
        usage("not enough arguments")
    if len(args) > 2:
        usage("exactly one file argument required")
    pattern, filename = args
    try:
        prog = re.compile(pattern, reflags)
    except re.error, msg:
        usage("error in regular expression: %s" % str(msg))
    try:
        f = open(filename)
    except IOError, msg:
        usage("can't open %s: %s" % (repr(filename), str(msg)), 1)
    f.seek(0, 2)
    pos = f.tell()
    leftover = None
    while pos > 0:
        size = min(pos, bufsize)
        pos = pos - size
        f.seek(pos)
        buffer = f.read(size)
        lines = buffer.split("\n")
        del buffer
        if leftover is None:
            if not lines[-1]:
                del lines[-1]
        else:
            lines[-1] = lines[-1] + leftover
        if pos > 0:
            leftover = lines[0]
            del lines[0]
        else:
            leftover = None
        lines.reverse()
        for line in lines:
            if prog.search(line):
                print line

def usage(msg, code=2):
    sys.stdout = sys.stderr
    print msg
    print __doc__
    sys.exit(code)

if __name__ == '__main__':
    main()
byext.pyc000064400000010651151732701370006425 0ustar00�
�fc@sddZddlmZddlZddlZddd��YZd�Zedkr`e�ndS(	s"Show file statistics by extension.i����(tprint_functionNtStatscBs>eZd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs
i|_dS(N(tstats(tself((s+/usr/lib64/python2.7/Tools/scripts/byext.pyt__init__scCs�xy|D]q}tjj|�r/|j|�qtjj|�rQ|j|�qtjjd|�|j	ddd�qWdS(NsCan't find %s
s<???>tunknowni(
tostpathtisdirtstatdirtisfiletstatfiletsyststderrtwritetaddstats(Rtargstarg((s+/usr/lib64/python2.7/Tools/scripts/byext.pytstatargss
cCs|jddd�yttj|��}WnDtjk
rr}tjjd||f�|jddd�dSXx�|D]�}|jd�r�qzn|j	d�r�qzntj
j||�}tj
j|�r�|jdd	d�qztj
j
|�r	|j|�qz|j|�qzWdS(
Ns<dir>tdirsisCan't list %s: %s
t
unlistables.#t~s<lnk>tlinks(RtsortedRtlistdirterrorRR
Rt
startswithtendswithRtjointislinkRR	R(Rtdirtnamesterrtnametfull((s+/usr/lib64/python2.7/Tools/scripts/byext.pyR	s$
c
Cs�tjj|�\}}tjj|�\}}||krEd}ntjj|�}|sfd}n|j|dd�yt|d�}WnAtk
r�}tj	j
d||f�|j|dd�dSX|j�}|j�|j|dt
|��d	|kr"|j|d
d�dS|s>|j|dd�n|j�}|j|dt
|��~|j�}	|j|d
t
|	��dS(Nts<none>tfilesitrbsCan't open %s: %s
t
unopenabletbytesstbinarytemptytlinestwords(RRtsplitexttsplittnormcaseRtopentIOErrorRR
Rtreadtclosetlent
splitlines(
RtfilenametheadtexttbasetfR tdataR*R+((s+/usr/lib64/python2.7/Tools/scripts/byext.pyR.s6		
cCs3|jj|i�}|j|d�|||<dS(Ni(Rt
setdefaulttget(RR7tkeytntd((s+/usr/lib64/python2.7/Tools/scripts/byext.pyRLscst|jj��}i}x"|D]}|j|j|�q"Wt|j���i�tg|D]}t|�^qb��d<d}i|jd<x��D]�}d}t|t|��}xb|D]Z}|j|j|�}|dkr�d}	ntd|�}	||7}t||	�}q�Wt|tt|���}|�|<||jd|<q�W|j	d�x|D]}||j|d<qoW�j
dd���fd�}
|
�x]|D]U}xE�D]=}|j|j|d�}td�||fd	d
�q�Wt�q�W|
�dS(NR7itTOTALis%dcs:x,�D]$}td�||fdd�qWt�dS(Ns%*stendt (tprint(tcol(tcolstcolwidth(s+/usr/lib64/python2.7/Tools/scripts/byext.pytprintheaderms
"R#s%*sRARB(RRtkeystupdatetmaxR3R<tNonetstrtappendtinsertRC(RtextstcolumnsR7tminwidthRDttotaltcwtvaluetwRG((RERFs+/usr/lib64/python2.7/Tools/scripts/byext.pytreportPsD
)


	





"(t__name__t
__module__RRR	RRRV(((s+/usr/lib64/python2.7/Tools/scripts/byext.pyR
s		
			cCsFtjd}|s"tjg}nt�}|j|�|j�dS(Ni(RtargvRtcurdirRRRV(Rts((s+/usr/lib64/python2.7/Tools/scripts/byext.pytmainys
	
t__main__((t__doc__t
__future__RRRRR\RW(((s+/usr/lib64/python2.7/Tools/scripts/byext.pyt<module>so	hotshotmain.py000075500000002713151732701370007467 0ustar00#! /usr/bin/python2.7
# -*- coding: iso-8859-1 -*-

"""
Run a Python script under hotshot's control.

Adapted from a posting on python-dev by Walter D�rwald

usage %prog [ %prog args ] filename [ filename args ]

Any arguments after the filename are used as sys.argv for the filename.
"""

import sys
import optparse
import os
import hotshot
import hotshot.stats

PROFILE = "hotshot.prof"

def run_hotshot(filename, profile, args):
    prof = hotshot.Profile(profile)
    sys.path.insert(0, os.path.dirname(filename))
    sys.argv = [filename] + args
    prof.run("execfile(%r)" % filename)
    prof.close()
    stats = hotshot.stats.load(profile)
    stats.sort_stats("time", "calls")

    # print_stats uses unadorned print statements, so the only way
    # to force output to stderr is to reassign sys.stdout temporarily
    save_stdout = sys.stdout
    sys.stdout = sys.stderr
    stats.print_stats()
    sys.stdout = save_stdout

    return 0

def main(args):
    parser = optparse.OptionParser(__doc__)
    parser.disable_interspersed_args()
    parser.add_option("-p", "--profile", action="store", default=PROFILE,
                      dest="profile", help='Specify profile file to use')
    (options, args) = parser.parse_args(args)

    if len(args) == 0:
        parser.print_help("missing script to execute")
        return 1

    filename = args[0]
    return run_hotshot(filename, options.profile, args[1:])

if __name__ == "__main__":
    sys.exit(main(sys.argv[1:]))
findlinksto.pyc000064400000002621151732701370007614 0ustar00�
�fc@s\ddlZddlZddlZddlZd�Zd�ZedkrXe�ndS(i����NcCs�yJtjtjdd�\}}t|�dkrItjdd��nWn9tjk
r�}tjt_|GHdGHtjd�nX|d|d}}t	j
|�}x$|D]}tjj
|t|�q�WdS(Nitisnot enough argumentss(usage: findlinksto pattern directory ...i(tgetopttsystargvtlentGetoptErrortNonetstderrtstdouttexittretcompiletostpathtwalktvisit(toptstargstmsgtpattdirstprogtdirname((s1/usr/lib64/python2.7/Tools/scripts/findlinksto.pytmains
cCs�tjj|�rg|(dStjj|�r;dG|GHnxr|D]j}tjj||�}y8tj|�}|j|�dk	r�|GdG|GHnWqBtjk
r�qBXqBWdS(Nsdescend intos->(	RR
tislinktismounttjointreadlinktsearchRterror(RRtnamestnametlinkto((s1/usr/lib64/python2.7/Tools/scripts/findlinksto.pyRs
t__main__(RRR
RRRt__name__(((s1/usr/lib64/python2.7/Tools/scripts/findlinksto.pyt<module>s		xxci.py000075500000005355151732701370006112 0ustar00#! /usr/bin/python2.7

# xxci
#
# check in files for which rcsdiff returns nonzero exit status

import sys
import os
from stat import *
import fnmatch

EXECMAGIC = '\001\140\000\010'

MAXSIZE = 200*1024 # Files this big must be binaries and are skipped.

def getargs():
    args = sys.argv[1:]
    if args:
        return args
    print 'No arguments, checking almost *, in "ls -t" order'
    list = []
    for file in os.listdir(os.curdir):
        if not skipfile(file):
            list.append((getmtime(file), file))
    list.sort()
    if not list:
        print 'Nothing to do -- exit 1'
        sys.exit(1)
    list.sort()
    list.reverse()
    for mtime, file in list: args.append(file)
    return args

def getmtime(file):
    try:
        st = os.stat(file)
        return st[ST_MTIME]
    except os.error:
        return -1

badnames = ['tags', 'TAGS', 'xyzzy', 'nohup.out', 'core']
badprefixes = ['.', ',', '@', '#', 'o.']
badsuffixes = \
        ['~', '.a', '.o', '.old', '.bak', '.orig', '.new', '.prev', '.not', \
         '.pyc', '.fdc', '.rgb', '.elc', ',v']
ignore = []

def setup():
    ignore[:] = badnames
    for p in badprefixes:
        ignore.append(p + '*')
    for p in badsuffixes:
        ignore.append('*' + p)
    try:
        f = open('.xxcign', 'r')
    except IOError:
        return
    ignore[:] = ignore + f.read().split()

def skipfile(file):
    for p in ignore:
        if fnmatch.fnmatch(file, p): return 1
    try:
        st = os.lstat(file)
    except os.error:
        return 1 # Doesn't exist -- skip it
    # Skip non-plain files.
    if not S_ISREG(st[ST_MODE]): return 1
    # Skip huge files -- probably binaries.
    if st[ST_SIZE] >= MAXSIZE: return 1
    # Skip executables
    try:
        data = open(file, 'r').read(len(EXECMAGIC))
        if data == EXECMAGIC: return 1
    except:
        pass
    return 0

def badprefix(file):
    for bad in badprefixes:
        if file[:len(bad)] == bad: return 1
    return 0

def badsuffix(file):
    for bad in badsuffixes:
        if file[-len(bad):] == bad: return 1
    return 0

def go(args):
    for file in args:
        print file + ':'
        if differing(file):
            showdiffs(file)
            if askyesno('Check in ' + file + ' ? '):
                sts = os.system('rcs -l ' + file) # ignored
                sts = os.system('ci -l ' + file)

def differing(file):
    cmd = 'co -p ' + file + ' 2>/dev/null | cmp -s - ' + file
    sts = os.system(cmd)
    return sts != 0

def showdiffs(file):
    cmd = 'rcsdiff ' + file + ' 2>&1 | ${PAGER-more}'
    sts = os.system(cmd)

def askyesno(prompt):
    s = raw_input(prompt)
    return s in ['y', 'yes']

if __name__ == '__main__':
    try:
        setup()
        go(getargs())
    except KeyboardInterrupt:
        print '[Intr]'
setup.pyc000064400000001044151732701370006426 0ustar00�
�fc@sWddlmZedkrSeddddddd	d
ddd
dddg
�ndS(i����(tsetupt__main__tscriptssbyteyears.pyscheckpyc.pyscopytime.pyscrlf.pys	dutree.pysftpmirror.pysh2py.pyslfcr.pys../i18n/pygettext.pyslogmerge.pys../../Lib/tabnanny.pys../../Lib/timeit.pysuntabify.pyN(tdistutils.coreRt__name__(((s+/usr/lib64/python2.7/Tools/scripts/setup.pyt<module>scopytime.py000075500000001227151732701370006762 0ustar00#! /usr/bin/python2.7

# Copy one file's atime and mtime to another

import sys
import os
from stat import ST_ATIME, ST_MTIME # Really constants 7 and 8

def main():
    if len(sys.argv) <> 3:
        sys.stderr.write('usage: copytime source destination\n')
        sys.exit(2)
    file1, file2 = sys.argv[1], sys.argv[2]
    try:
        stat1 = os.stat(file1)
    except os.error:
        sys.stderr.write(file1 + ': cannot stat\n')
        sys.exit(1)
    try:
        os.utime(file2, (stat1[ST_ATIME], stat1[ST_MTIME]))
    except os.error:
        sys.stderr.write(file2 + ': cannot change time\n')
        sys.exit(2)

if __name__ == '__main__':
    main()
pdeps.pyc000064400000006224151732701370006406 0ustar00�
�fc@s�ddlZddlZddlZd�Zejd�Zejd�Zd�Zd�Zd�Z	d�Z
d	�Zed
kr�yej
e��Wq�ek
r�ej
d�q�XndS(i����NcCs�tjd}|sdGHdSi}x|D]}t||�q)WdGHt|�dGHt|�}t|�dGHt|�}t|�dGHt|�}t|�dS(	Nis usage: pdeps file.py file.py ...is--- Uses ---s--- Used By ---s--- Closure of Uses ---s--- Closure of Used By ---i(tsystargvtprocesstprintresultstinversetclosure(targsttabletargtinvtreachtinvreach((s+/usr/lib64/python2.7/Tools/scripts/pdeps.pytmains&





s^[ 	]*from[ 	]+([^ 	]+)[ 	]+s^[ 	]*import[ 	]+([^#]+)c
Csht|d�}tjj|�}|ddkr>|d }ng||<}x|j�}|sePnx8|ddkr�|j�}|s�Pn|d |}qhWtj|�dkr�tjd \\}}\}	}
n:tj|�dkrOtjd \\}}\}	}
nqO||	|
!j	d�}x6|D].}|j
�}||kr.|j|�q.q.WqOWdS(	Ntri����s.pyi����s\iit,(topentostpathtbasenametreadlinetm_importtmatchtregstm_fromtsplittstriptappend(
tfilenameRtfptmodtlisttlinetnextlinetatbta1tb1twordstword((s+/usr/lib64/python2.7/Tools/scripts/pdeps.pyRBs0
""
cCs�|j�}i}x|D]}||||<qWd}x�|r�d}xq|D]i}x`||D]T}||kr_x?||D]0}|||kr|||j|�d}q|q|Wq_q_WqNWq;W|S(Nii(tkeysR(RtmodulesR
Rtchangetmotm((s+/usr/lib64/python2.7/Tools/scripts/pdeps.pyR^s
	
cCsbi}xU|j�D]G}|j|�s5g||<nx"||D]}t|||�q@WqW|S(N(R'thas_keytstore(RR	tkeytitem((s+/usr/lib64/python2.7/Tools/scripts/pdeps.pyR{s
cCs4|j|�r#||j|�n
|g||<dS(N(R,R(tdictR.R/((s+/usr/lib64/python2.7/Tools/scripts/pdeps.pyR-�scCs�|j�}d}x#|D]}t|t|��}qW|j�x\|D]T}||}|j�|j|�GdG||kr�dGnx|D]
}|Gq�WHqIWdS(Nit:s(*)(R'tmaxtlentsorttljust(RR(tmaxlenRRtref((s+/usr/lib64/python2.7/Tools/scripts/pdeps.pyR�s





t__main__i(RtreRRtcompileRRRRRR-Rt__name__texittKeyboardInterrupt(((s+/usr/lib64/python2.7/Tools/scripts/pdeps.pyt<module>s							
checkappend.pyc000064400000011426151732701400007532 0ustar00�
�fc@s�dZdZddlZddlZddlZddlZdad�Zd�Zd�Z	e
d�\ZZZ
ZZd	d
d
��YZedkr�e�ndS(s�checkappend.py -- search for multi-argument .append() calls.

Usage:  specify one or more file or directory paths:
    checkappend [-v] file_or_dir [file_or_dir] ...

Each file_or_dir is checked for multi-argument .append() calls.  When
a directory, all .py files in the directory, and recursively in its
subdirectories, are checked.

Use -v for status msgs.  Use -vv for more status msgs.

In the absence of -v, the only output is pairs of the form

    filename(linenumber):
    line containing the suspicious append

Note that this finds multi-argument append calls regardless of whether
they're attached to list objects.  If a module defines a class with an
append method that takes more than one argument, calls to that method
will be listed.

Note that this will not find multi-argument list.append calls made via a
bound method object.  For example, this is not caught:

    somelist = []
    push = somelist.append
    push(1, 2, 3)
iii����NcGs3dj|�}tjj|�tjjd�dS(Nt s
(tjointsyststderrtwrite(targstmsg((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pyterrprint+scCs�tjd}y#tjtjdd�\}}Wn/tjk
ra}tt|�dt�dSXx-|D]%\}}|dkritdaqiqiW|s�tt�dSx|D]}t|�q�WdS(Nitvs

s-v(	RtargvtgetoptterrorRtstrt__doc__tverbosetcheck(RtoptsRtopttoptargtarg((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pytmain0s
#

cCsKtjj|�r�tjj|�r�tr:d|fGHntj|�}xq|D]i}tjj||�}tjj|�r�tjj|�s�tjj|d�dkrPt|�qPqPWdSyt	|�}Wn(t
k
r�}td||f�dSXtdkrd|fGHnt||�j
�}trG|rGd|fGHndS(Ns%r: listing directoryi����s.pys%r: I/O Error: %sischecking %r ...s%r: Clean bill of health.(tostpathtisdirtislinkRtlistdirRtnormcaseRtopentIOErrorRt
AppendCheckertrun(tfiletnamestnametfullnametfRtok((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pyRAs*%
iRcBsDeZd�Zd�Zejejejfejej	d�Z
RS(cCs(||_||_t|_d|_dS(Ni(tfnameRtFIND_DOTtstatetnerrors(tselfR%R((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pyt__init__bs			cCsjytj|jj|j�Wn=tjk
r\}td|j|f�|jd|_nX|jdkS(Ns%r: Token Error: %sii(ttokenizeRtreadlinet
tokeneatert
TokenErrorRR%R((R)R((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pyRhsc
Cs�|j}
||krn�|
tkrH||kr�|dkr�t}
q�n�|
tkr�||	kr�|dkr�||_|d|_t}
q�t}
n9|
tkr�||kr�|dkr�d|_t}
q�t}
n�|
tkr�||kr�|dkr
|jd|_q�|dkrA|jd|_|jdkr�t}
q�q�|dkr�|jdkr�|jd|_d|j	|j|jfGHt
}
q�q�n7|
t
kr�||kr�t}
q�ntd
|
f��|
|_dS(Nt.tappendit(it{t[t)t}t]t,s
%s(%d):
%ssunknown internal state '%r'(R1R2R3(R4R5R6(R'R&tFIND_APPENDtlinetlinenotFIND_LPARENtlevelt
FIND_COMMAR(R%t	FIND_STMTtSystemError(R)ttypettokentstarttendR9tNEWLINEtJUNKtOPtNAMER'((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pyR-psF		
					(t__name__t
__module__R*RR+RDtCOMMENTtNLRFRGR-(((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pyRas			t__main__(iii((R
t__version__RRR
R+RRRRtrangeR&R8R;R=R>RRH(((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pyt<module> s			Esuff.pyo000064400000001610151732701400006236 0ustar00�
�fc@s8ddlZd�Zd�Zedkr4e�ndS(i����NcCs�tjd}i}xG|D]?}t|�}|j|�sHg||<n||j|�qW|j�}|j�x'|D]}t|�Gt||�GHqzWdS(Ni(	tsystargvt	getsuffixthas_keytappendtkeystsorttreprtlen(tfilestsuffixestfilenametsuffR((s*/usr/lib64/python2.7/Tools/scripts/suff.pytmain	s




cCsDd}x7tt|��D]#}||dkr||}qqW|S(Ntt.(trangeR(RRti((s*/usr/lib64/python2.7/Tools/scripts/suff.pyRs
t__main__(RR
Rt__name__(((s*/usr/lib64/python2.7/Tools/scripts/suff.pyt<module>s	
	diff.pyc000064400000004522151732701410006175 0ustar00�
�fc@sedZddlZddlZddlZddlZddlZd�Zedkrae�ndS(sS Command line interface to difflib.py providing diffs in four formats:

* ndiff:    lists every line and highlights interline changes.
* context:  highlights clusters of changes in a before/after format.
* unified:  highlights clusters of changes in an inline format.
* html:     generates side by side comparison with change highlights.

i����Nc
Csed}tj|�}|jddddtdd�|jddddtdd	�|jd
dddtdd�|jddddtdd
�|jdddddddd�|j�\}}t|�dkr�|j�tjd�nt|�dkr|j	d�n|j
}|\}}tjt
j|�j�}tjt
j|�j�}t|d��}	|	j�}
WdQXt|d��}	|	j�}WdQX|jr�tj|
|||||d|�}n{|jr�tj|
|�}n]|jr-tj�j|
|||d|jd|�}n$tj|
|||||d|�}tjj|�dS(Ns&usage: %prog [options] fromfile tofiles-ctactiont
store_truetdefaultthelps'Produce a context format diff (default)s-usProduce a unified format diffs-msAProduce HTML side by side diff (can use -c and -l in conjunction)s-nsProduce a ndiff format diffs-ls--linesttypetintis'Set number of context lines (default 3)iiis*need to specify both a fromfile and tofiletUtntcontexttnumlines(toptparsetOptionParsert
add_optiontFalset
parse_argstlent
print_helptsystexitterrortlinesttimetctimetoststattst_mtimetopent	readlinestutdifflibtunified_diffRtndifftmtHtmlDifft	make_filetctcontext_difftstdoutt
writelines(
tusagetparsertoptionstargsRtfromfilettofiletfromdatettodatetft	fromlinesttolinestdiff((s*/usr/lib64/python2.7/Tools/scripts/diff.pytmain
s:"
		'		0$t__main__(t__doc__RRRRR
R3t__name__(((s*/usr/lib64/python2.7/Tools/scripts/diff.pyt<module>	s<	&redemo.pyc000064400000012201151732701410006531 0ustar00�
�fc@sRdZddlTddlZddd��YZd�ZedkrNe�ndS(	sDBasic regular expression demonstration facility (Perl style syntax).i����(t*NtReDemocBs;eZd�Zd�Zd�Zdd�Zdd�ZRS(c
Cs||_t|jdtdd�|_|jjdtdt�t|j�|_|jjdt�|jj	�|j
�t|jdddt�|_|jjdtdt�t|jdtdd�|_|jjdt�|jjdt�t
|�|_|jjdtdt�t|�|_|jjd�t|jdd	d
|jddd|j�|_|jjdt�t|jdd
d
|jddd|j�|_|jjdt�t|jdddd�|_|jjdtdd�|jjddd�t|jdddt�|_|jjdt�t|j�|_|jjdddt�|jjd|j�|jjd|j�d|_!|j�|jj"�}|jj"|d|d �|jj"�}|jj"|d|d �dS(Ntanchorttexts&Enter a Perl-style regular expression:tsidetfilltsEnter a string to search:tfirstsHighlight first matchtvariabletvaluetcommandsHighlight all matchestalltwidthi<theightitexpandithitt
backgroundtyellowsGroups:s<Key>(#tmastertLabeltWt
promptdisplaytpacktTOPtXtEntrytregexdisplayt	focus_sett
addoptionst
statusdisplaytlabeldisplaytFramet	showframet	StringVartshowvartsettRadiobuttont	recompiletshowfirstradiotLEFTtshowallradiotTextt
stringdisplaytBOTHt
tag_configuret
grouplabeltListboxt	grouplisttbindt
reevaluatetNonetcompiledtbindtags(tselfRtbtags((s,/usr/lib64/python2.7/Tools/scripts/redemo.pyt__init__	sZ	

			
c
Cs�g|_g|_g|_x�dD]�}t|j�ddkrst|j�}|jdt�|jj|�nt	t
|�}t�}t|d	|d
|ddd|d
|j
�}|jdt�|jj|�|jj|�q"WdS(Nt
IGNORECASEtLOCALEt	MULTILINEtDOTALLtVERBOSEiiRRRtoffvaluetonvalueR
R(R8R9R:R;R<(tframestboxestvarstlenRRRRtappendtgetattrtretIntVartCheckbuttonR%R'(R5tnametframetvaltvartbox((s,/usr/lib64/python2.7/Tools/scripts/redemo.pyRHs*			
		cCs4d}x!|jD]}||j�B}qW|}|S(Ni(RAtget(R5tflagsRK((s,/usr/lib64/python2.7/Tools/scripts/redemo.pytgetflags_s
cCs�yNtj|jj�|j��|_|jd}|jjddd|�WnBtj	k
r�}d|_|jjddt|�dd�nX|j�dS(NRRRsre.error: %stred(
REtcompileRRMROR3RRtconfigterrorR2tstrR1(R5teventtbgtmsg((s,/usr/lib64/python2.7/Tools/scripts/redemo.pyR%fs
	c
CsUy|jjddt�Wntk
r-nXy|jjddt�Wntk
r[nX|jjdt�|js|dS|jjddd�|jjddd�|jjdt�}d}d}xJ|t	|�kr|jj
||�}|dkrPn|j�\}}||kr4|d}d}nd}d	|}d	|}	|jj
|||	�|dkr�|jj|�t|j��}
|
jd|j��xDtt	|
��D]-}d
||
|f}|jjt|�q�Wn|d}|jj�dkr�Pq�q�W|dkr>|jjdd
dd�n|jjdd�dS(NRs1.0thit0iRRtorangeis1.0 + %d charss%2d: %rRRs
(no match)R(R*t
tag_removetENDtTclErrorR/tdeleteR3R,RMRBtsearchR2tspanttag_addtyview_pickplacetlisttgroupstinserttgrouptrangeR"RRR(
R5RURtlasttnmatchestmRttagtpfirsttplastRctitg((s,/usr/lib64/python2.7/Tools/scripts/redemo.pyR1ssT

	
	



N(t__name__t
__module__R7RROR2R%R1(((s,/usr/lib64/python2.7/Tools/scripts/redemo.pyRs
	?		
cCs6t�}t|�}|jd|j�|j�dS(NtWM_DELETE_WINDOW(tTkRtprotocoltquittmainloop(troottdemo((s,/usr/lib64/python2.7/Tools/scripts/redemo.pytmain�s	t__main__((t__doc__tTkinterRERRxRo(((s,/usr/lib64/python2.7/Tools/scripts/redemo.pyt<module>s
�	lll.pyo000064400000001656151732701410006071 0ustar00�
�fc@sNddlZddlZd�Zd�ZedkrJeejd�ndS(i����NcCsyxrtj|�D]a}|tjtjfkrtjj||�}tjj|�rq|GdGtj|�GHqqqqWdS(Ns->(tostlistdirtcurdirtpardirtpathtjointislinktreadlink(tdirnametnametfull((s)/usr/lib64/python2.7/Tools/scripts/lll.pytlll
s
cCsh|stjg}nd}xF|D]>}t|�dkrV|sDHnd}|dGHnt|�q"WdS(Niit:(RRtlenR(targstfirsttarg((s)/usr/lib64/python2.7/Tools/scripts/lll.pytmains
t__main__i(tsysRRRt__name__targv(((s)/usr/lib64/python2.7/Tools/scripts/lll.pyt<module>s		
setup.py000064400000000645151732701410006264 0ustar00from distutils.core import setup

if __name__ == '__main__':
    setup(
      scripts=[
        'byteyears.py',
        'checkpyc.py',
        'copytime.py',
        'crlf.py',
        'dutree.py',
        'ftpmirror.py',
        'h2py.py',
        'lfcr.py',
        '../i18n/pygettext.py',
        'logmerge.py',
        '../../Lib/tabnanny.py',
        '../../Lib/timeit.py',
        'untabify.py',
        ],
      )
finddiv.pyo000064400000006340151732701410006724 0ustar00�
�fc@s}dZddlZddlZddlZddlZd�Zd�Zd�Zd�Ze	dkryej
e��ndS(s	finddiv - a grep-like tool that looks for division operators.

Usage: finddiv [-l] file_or_directory ...

For directory arguments, all files in the directory whose name ends in
.py are processed, and subdirectories are processed recursively.

This actually tokenizes the files to avoid false hits in comments or
strings literals.

By default, this prints all lines containing a / or /= operator, in
grep -n style.  With the -l option specified, it prints the filename
of files that contain at least one / or /= operator.
i����Nc	Cs�y#tjtjdd�\}}Wn!tjk
rF}t|�dSX|s[td�dSd}x>|D]6\}}|dkr�tGHdS|dkrhd}qhqhWd}x)|D]!}t||�}|p�|}q�W|S(Nitlhis&at least one file argument is requiredis-hs-l(tgetopttsystargvterrortusaget__doc__tNonetprocess(	toptstargstmsgt	listnamestotatexittfilenametx((s-/usr/lib64/python2.7/Tools/scripts/finddiv.pytmains(#



cCs[tjjdtjd|f�tjjdtjd�tjjdtjd�dS(Ns%s: %s
isUsage: %s [-l] file ...
s"Try `%s -h' for more information.
(RtstderrtwriteR(R((s-/usr/lib64/python2.7/Tools/scripts/finddiv.pyR-s!cCs�tjj|�rt||�Syt|�}Wn(tk
rY}tjjd|�dSXt	j
|j�}d}xg|D]_\}}\}}	}
}|dkry|r�|GHPn||kr�|}d|||fGq�qyqyW|j
�dS(NsCan't open: %s
it/s/=s%s:%d:%s(Rs/=(tostpathtisdirt
processdirtopentIOErrorRRRttokenizetgenerate_tokenstreadlineRtclose(RRtfpRtgtlastrowttypettokentrowtcoltendtline((s-/usr/lib64/python2.7/Tools/scripts/finddiv.pyR2s$
"c	Cs�ytj|�}Wn+tjk
r@}tjjd|�dSXg}x`|D]X}tjj||�}tjj|�j	d�s�tjj
|�rN|j|�qNqNW|jd��d}x)|D]!}t||�}|p�|}q�W|S(NsCan't list directory: %s
is.pycSs%ttjj|�tjj|��S(N(tcmpRRtnormcase(Rtb((s-/usr/lib64/python2.7/Tools/scripts/finddiv.pyt<lambda>Qt(RtlistdirRRRRRtjoinR*tendswithRtappendtsortRR(	tdirRtnamesRtfilestnametfnRR((s-/usr/lib64/python2.7/Tools/scripts/finddiv.pyRFs 
-
t__main__(RRRRRRRRRt__name__R(((s-/usr/lib64/python2.7/Tools/scripts/finddiv.pyt<module>s				hotshotmain.pyc000064400000003507151732701410007624 0ustar00�
�fc@s�dZddlZddlZddlZddlZddlZdZd�Zd�Ze	dkr�ej
eejd��ndS(s�
Run a Python script under hotshot's control.

Adapted from a posting on python-dev by Walter D�rwald

usage %prog [ %prog args ] filename [ filename args ]

Any arguments after the filename are used as sys.argv for the filename.
i����Nshotshot.profcCs�tj|�}tjjdtjj|��|g|t_|jd|�|j	�tj
j|�}|jdd�tj
}tjt_
|j�|t_
dS(Nisexecfile(%r)ttimetcalls(thotshottProfiletsystpathtinserttostdirnametargvtruntclosetstatstloadt
sort_statststdouttstderrtprint_stats(tfilenametprofiletargstprofRtsave_stdout((s1/usr/lib64/python2.7/Tools/scripts/hotshotmain.pytrun_hotshots
	
	cCs�tjt�}|j�|jdddddtdddd	�|j|�\}}t|�d
kry|jd�dS|d
}t	||j
|d�S(
Ns-ps	--profiletactiontstoretdefaulttdestRthelpsSpecify profile file to useismissing script to executei(toptparsetOptionParsert__doc__tdisable_interspersed_argst
add_optiontPROFILEt
parse_argstlent
print_helpRR(RtparsertoptionsR((s1/usr/lib64/python2.7/Tools/scripts/hotshotmain.pytmain(s



t__main__i(RRRRRt
hotshot.statsR"RR(t__name__texitR	(((s1/usr/lib64/python2.7/Tools/scripts/hotshotmain.pyt<module>s		fixdiv.py000075500000033021151732701420006413 0ustar00#! /usr/bin/python2.7

"""fixdiv - tool to fix division operators.

To use this tool, first run `python -Qwarnall yourscript.py 2>warnings'.
This runs the script `yourscript.py' while writing warning messages
about all uses of the classic division operator to the file
`warnings'.  The warnings look like this:

  <file>:<line>: DeprecationWarning: classic <type> division

The warnings are written to stderr, so you must use `2>' for the I/O
redirect.  I know of no way to redirect stderr on Windows in a DOS
box, so you will have to modify the script to set sys.stderr to some
kind of log file if you want to do this on Windows.

The warnings are not limited to the script; modules imported by the
script may also trigger warnings.  In fact a useful technique is to
write a test script specifically intended to exercise all code in a
particular module or set of modules.

Then run `python fixdiv.py warnings'.  This first reads the warnings,
looking for classic division warnings, and sorts them by file name and
line number.  Then, for each file that received at least one warning,
it parses the file and tries to match the warnings up to the division
operators found in the source code.  If it is successful, it writes
its findings to stdout, preceded by a line of dashes and a line of the
form:

  Index: <file>

If the only findings found are suggestions to change a / operator into
a // operator, the output is acceptable input for the Unix 'patch'
program.

Here are the possible messages on stdout (N stands for a line number):

- A plain-diff-style change ('NcN', a line marked by '<', a line
  containing '---', and a line marked by '>'):

  A / operator was found that should be changed to //.  This is the
  recommendation when only int and/or long arguments were seen.

- 'True division / operator at line N' and a line marked by '=':

  A / operator was found that can remain unchanged.  This is the
  recommendation when only float and/or complex arguments were seen.

- 'Ambiguous / operator (..., ...) at line N', line marked by '?':

  A / operator was found for which int or long as well as float or
  complex arguments were seen.  This is highly unlikely; if it occurs,
  you may have to restructure the code to keep the classic semantics,
  or maybe you don't care about the classic semantics.

- 'No conclusive evidence on line N', line marked by '*':

  A / operator was found for which no warnings were seen.  This could
  be code that was never executed, or code that was only executed
  with user-defined objects as arguments.  You will have to
  investigate further.  Note that // can be overloaded separately from
  /, using __floordiv__.  True division can also be separately
  overloaded, using __truediv__.  Classic division should be the same
  as either of those.  (XXX should I add a warning for division on
  user-defined objects, to disambiguate this case from code that was
  never executed?)

- 'Phantom ... warnings for line N', line marked by '*':

  A warning was seen for a line not containing a / operator.  The most
  likely cause is a warning about code executed by 'exec' or eval()
  (see note below), or an indirect invocation of the / operator, for
  example via the div() function in the operator module.  It could
  also be caused by a change to the file between the time the test
  script was run to collect warnings and the time fixdiv was run.

- 'More than one / operator in line N'; or
  'More than one / operator per statement in lines N-N':

  The scanner found more than one / operator on a single line, or in a
  statement split across multiple lines.  Because the warnings
  framework doesn't (and can't) show the offset within the line, and
  the code generator doesn't always give the correct line number for
  operations in a multi-line statement, we can't be sure whether all
  operators in the statement were executed.  To be on the safe side,
  by default a warning is issued about this case.  In practice, these
  cases are usually safe, and the -m option suppresses these warning.

- 'Can't find the / operator in line N', line marked by '*':

  This really shouldn't happen.  It means that the tokenize module
  reported a '/' operator but the line it returns didn't contain a '/'
  character at the indicated position.

- 'Bad warning for line N: XYZ', line marked by '*':

  This really shouldn't happen.  It means that a 'classic XYZ
  division' warning was read with XYZ being something other than
  'int', 'long', 'float', or 'complex'.

Notes:

- The augmented assignment operator /= is handled the same way as the
  / operator.

- This tool never looks at the // operator; no warnings are ever
  generated for use of this operator.

- This tool never looks at the / operator when a future division
  statement is in effect; no warnings are generated in this case, and
  because the tool only looks at files for which at least one classic
  division warning was seen, it will never look at files containing a
  future division statement.

- Warnings may be issued for code not read from a file, but executed
  using an exec statement or the eval() function.  These may have
  <string> in the filename position, in which case the fixdiv script
  will attempt and fail to open a file named '<string>' and issue a
  warning about this failure; or these may be reported as 'Phantom'
  warnings (see above).  You're on your own to deal with these.  You
  could make all recommended changes and add a future division
  statement to all affected files, and then re-run the test script; it
  should not issue any warnings.  If there are any, and you have a
  hard time tracking down where they are generated, you can use the
  -Werror option to force an error instead of a first warning,
  generating a traceback.

- The tool should be run from the same directory as that from which
  the original script was run, otherwise it won't be able to open
  files given by relative pathnames.
"""

import sys
import getopt
import re
import tokenize

multi_ok = 0

def main():
    try:
        opts, args = getopt.getopt(sys.argv[1:], "hm")
    except getopt.error, msg:
        usage(msg)
        return 2
    for o, a in opts:
        if o == "-h":
            print __doc__
            return
        if o == "-m":
            global multi_ok
            multi_ok = 1
    if not args:
        usage("at least one file argument is required")
        return 2
    if args[1:]:
        sys.stderr.write("%s: extra file arguments ignored\n", sys.argv[0])
    warnings = readwarnings(args[0])
    if warnings is None:
        return 1
    files = warnings.keys()
    if not files:
        print "No classic division warnings read from", args[0]
        return
    files.sort()
    exit = None
    for filename in files:
        x = process(filename, warnings[filename])
        exit = exit or x
    return exit

def usage(msg):
    sys.stderr.write("%s: %s\n" % (sys.argv[0], msg))
    sys.stderr.write("Usage: %s [-m] warnings\n" % sys.argv[0])
    sys.stderr.write("Try `%s -h' for more information.\n" % sys.argv[0])

PATTERN = ("^(.+?):(\d+): DeprecationWarning: "
           "classic (int|long|float|complex) division$")

def readwarnings(warningsfile):
    prog = re.compile(PATTERN)
    try:
        f = open(warningsfile)
    except IOError, msg:
        sys.stderr.write("can't open: %s\n" % msg)
        return
    warnings = {}
    while 1:
        line = f.readline()
        if not line:
            break
        m = prog.match(line)
        if not m:
            if line.find("division") >= 0:
                sys.stderr.write("Warning: ignored input " + line)
            continue
        filename, lineno, what = m.groups()
        list = warnings.get(filename)
        if list is None:
            warnings[filename] = list = []
        list.append((int(lineno), intern(what)))
    f.close()
    return warnings

def process(filename, list):
    print "-"*70
    assert list # if this fails, readwarnings() is broken
    try:
        fp = open(filename)
    except IOError, msg:
        sys.stderr.write("can't open: %s\n" % msg)
        return 1
    print "Index:", filename
    f = FileContext(fp)
    list.sort()
    index = 0 # list[:index] has been processed, list[index:] is still to do
    g = tokenize.generate_tokens(f.readline)
    while 1:
        startlineno, endlineno, slashes = lineinfo = scanline(g)
        if startlineno is None:
            break
        assert startlineno <= endlineno is not None
        orphans = []
        while index < len(list) and list[index][0] < startlineno:
            orphans.append(list[index])
            index += 1
        if orphans:
            reportphantomwarnings(orphans, f)
        warnings = []
        while index < len(list) and list[index][0] <= endlineno:
            warnings.append(list[index])
            index += 1
        if not slashes and not warnings:
            pass
        elif slashes and not warnings:
            report(slashes, "No conclusive evidence")
        elif warnings and not slashes:
            reportphantomwarnings(warnings, f)
        else:
            if len(slashes) > 1:
                if not multi_ok:
                    rows = []
                    lastrow = None
                    for (row, col), line in slashes:
                        if row == lastrow:
                            continue
                        rows.append(row)
                        lastrow = row
                    assert rows
                    if len(rows) == 1:
                        print "*** More than one / operator in line", rows[0]
                    else:
                        print "*** More than one / operator per statement",
                        print "in lines %d-%d" % (rows[0], rows[-1])
            intlong = []
            floatcomplex = []
            bad = []
            for lineno, what in warnings:
                if what in ("int", "long"):
                    intlong.append(what)
                elif what in ("float", "complex"):
                    floatcomplex.append(what)
                else:
                    bad.append(what)
            lastrow = None
            for (row, col), line in slashes:
                if row == lastrow:
                    continue
                lastrow = row
                line = chop(line)
                if line[col:col+1] != "/":
                    print "*** Can't find the / operator in line %d:" % row
                    print "*", line
                    continue
                if bad:
                    print "*** Bad warning for line %d:" % row, bad
                    print "*", line
                elif intlong and not floatcomplex:
                    print "%dc%d" % (row, row)
                    print "<", line
                    print "---"
                    print ">", line[:col] + "/" + line[col:]
                elif floatcomplex and not intlong:
                    print "True division / operator at line %d:" % row
                    print "=", line
                elif intlong and floatcomplex:
                    print "*** Ambiguous / operator (%s, %s) at line %d:" % (
                        "|".join(intlong), "|".join(floatcomplex), row)
                    print "?", line
    fp.close()

def reportphantomwarnings(warnings, f):
    blocks = []
    lastrow = None
    lastblock = None
    for row, what in warnings:
        if row != lastrow:
            lastblock = [row]
            blocks.append(lastblock)
        lastblock.append(what)
    for block in blocks:
        row = block[0]
        whats = "/".join(block[1:])
        print "*** Phantom %s warnings for line %d:" % (whats, row)
        f.report(row, mark="*")

def report(slashes, message):
    lastrow = None
    for (row, col), line in slashes:
        if row != lastrow:
            print "*** %s on line %d:" % (message, row)
            print "*", chop(line)
            lastrow = row

class FileContext:
    def __init__(self, fp, window=5, lineno=1):
        self.fp = fp
        self.window = 5
        self.lineno = 1
        self.eoflookahead = 0
        self.lookahead = []
        self.buffer = []
    def fill(self):
        while len(self.lookahead) < self.window and not self.eoflookahead:
            line = self.fp.readline()
            if not line:
                self.eoflookahead = 1
                break
            self.lookahead.append(line)
    def readline(self):
        self.fill()
        if not self.lookahead:
            return ""
        line = self.lookahead.pop(0)
        self.buffer.append(line)
        self.lineno += 1
        return line
    def __getitem__(self, index):
        self.fill()
        bufstart = self.lineno - len(self.buffer)
        lookend = self.lineno + len(self.lookahead)
        if bufstart <= index < self.lineno:
            return self.buffer[index - bufstart]
        if self.lineno <= index < lookend:
            return self.lookahead[index - self.lineno]
        raise KeyError
    def report(self, first, last=None, mark="*"):
        if last is None:
            last = first
        for i in range(first, last+1):
            try:
                line = self[first]
            except KeyError:
                line = "<missing line>"
            print mark, chop(line)

def scanline(g):
    slashes = []
    startlineno = None
    endlineno = None
    for type, token, start, end, line in g:
        endlineno = end[0]
        if startlineno is None:
            startlineno = endlineno
        if token in ("/", "/="):
            slashes.append((start, line))
        if type == tokenize.NEWLINE:
            break
    return startlineno, endlineno, slashes

def chop(line):
    if line.endswith("\n"):
        return line[:-1]
    else:
        return line

if __name__ == "__main__":
    sys.exit(main())
db2pickle.py000075500000006762151732701420006775 0ustar00#! /usr/bin/python2.7

"""
Synopsis: %(prog)s [-h|-g|-b|-r|-a] dbfile [ picklefile ]

Convert the database file given on the command line to a pickle
representation.  The optional flags indicate the type of the database:

    -a - open using anydbm
    -b - open as bsddb btree file
    -d - open as dbm file
    -g - open as gdbm file
    -h - open as bsddb hash file
    -r - open as bsddb recno file

The default is hash.  If a pickle file is named it is opened for write
access (deleting any existing data).  If no pickle file is named, the pickle
output is written to standard output.

"""

import getopt
try:
    import bsddb
except ImportError:
    bsddb = None
try:
    import dbm
except ImportError:
    dbm = None
try:
    import gdbm
except ImportError:
    gdbm = None
try:
    import anydbm
except ImportError:
    anydbm = None
import sys
try:
    import cPickle as pickle
except ImportError:
    import pickle

prog = sys.argv[0]

def usage():
    sys.stderr.write(__doc__ % globals())

def main(args):
    try:
        opts, args = getopt.getopt(args, "hbrdag",
                                   ["hash", "btree", "recno", "dbm",
                                    "gdbm", "anydbm"])
    except getopt.error:
        usage()
        return 1

    if len(args) == 0 or len(args) > 2:
        usage()
        return 1
    elif len(args) == 1:
        dbfile = args[0]
        pfile = sys.stdout
    else:
        dbfile = args[0]
        try:
            pfile = open(args[1], 'wb')
        except IOError:
            sys.stderr.write("Unable to open %s\n" % args[1])
            return 1

    dbopen = None
    for opt, arg in opts:
        if opt in ("-h", "--hash"):
            try:
                dbopen = bsddb.hashopen
            except AttributeError:
                sys.stderr.write("bsddb module unavailable.\n")
                return 1
        elif opt in ("-b", "--btree"):
            try:
                dbopen = bsddb.btopen
            except AttributeError:
                sys.stderr.write("bsddb module unavailable.\n")
                return 1
        elif opt in ("-r", "--recno"):
            try:
                dbopen = bsddb.rnopen
            except AttributeError:
                sys.stderr.write("bsddb module unavailable.\n")
                return 1
        elif opt in ("-a", "--anydbm"):
            try:
                dbopen = anydbm.open
            except AttributeError:
                sys.stderr.write("anydbm module unavailable.\n")
                return 1
        elif opt in ("-g", "--gdbm"):
            try:
                dbopen = gdbm.open
            except AttributeError:
                sys.stderr.write("gdbm module unavailable.\n")
                return 1
        elif opt in ("-d", "--dbm"):
            try:
                dbopen = dbm.open
            except AttributeError:
                sys.stderr.write("dbm module unavailable.\n")
                return 1
    if dbopen is None:
        if bsddb is None:
            sys.stderr.write("bsddb module unavailable - ")
            sys.stderr.write("must specify dbtype.\n")
            return 1
        else:
            dbopen = bsddb.hashopen

    try:
        db = dbopen(dbfile, 'r')
    except bsddb.error:
        sys.stderr.write("Unable to open %s.  " % dbfile)
        sys.stderr.write("Check for format or version mismatch.\n")
        return 1

    for k in db.keys():
        pickle.dump((k, db[k]), pfile, 1==1)

    db.close()
    pfile.close()

    return 0

if __name__ == "__main__":
    sys.exit(main(sys.argv[1:]))
win_add2path.pyc000064400000004025151732701420007630 0ustar00�
�fc@s}dZddlZddlZddlZddlZejZdZdZdZ	d�Z
d�Zedkrye�ndS(	sAdd Python to the search path on Windows

This is a simple script to add Python to the Windows search path. It
modifies the current user (HKCU) tree of the registry.

Copyright (c) 2008 by Christian Heimes <christian@cheimes.de>
Licensed to PSF under a Contributor Agreement.
i����NtEnvironmenttPATHu%PATH%c	
Csgtjjtjjtj��}tjj|d�}tjd}tt	d�rt	j
j|d�}tjj|d�}nd}t
jtt���}yt
j|t�d}Wntk
r�t}nX|g}xK|||fD]:}|r�||kr�tjj|�r�|j|�q�q�Wtjj|�}t
j|tdt
j|�||fSWdQXdS(NtScriptstAPPDATAt	USER_SITEs	%APPDATA%i(tostpathtdirnametnormpathtsyst
executabletjointenvironthasattrtsiteRtreplacetNonet_winregt	CreateKeytHKCUtENVtQueryValueExRtWindowsErrortDEFAULTtisdirtappendtpathsept
SetValueExt
REG_EXPAND_SZ(	t
pythonpathtscriptstappdatatuserpathtuserscriptstkeytenvpathtpathsR((s2/usr/lib64/python2.7/Tools/scripts/win_add2path.pytmodifys&!


	$cCs`t�\}}t|�dkr;dGHdj|d�GHndGHd|GHdGHtj|�GHdS(NisPath(s) added:s
sNo path was addeds
PATH is now:
%s
s	Expanded:(R%tlenRRtExpandEnvironmentStrings(R$R#((s2/usr/lib64/python2.7/Tools/scripts/win_add2path.pytmain-s	t__main__(
t__doc__R	RRRtHKEY_CURRENT_USERRRRRR%R(t__name__(((s2/usr/lib64/python2.7/Tools/scripts/win_add2path.pyt<module>s			texi2html.pyo000064400000242573151732701420007234 0ustar00�
�fc@sbddlZddlZddlZddlZdZejd�Zejd�Zejd�Zejd�Z	ejd�Z
dfd	��YZd
efd��YZdfd
��YZ
de
fd��YZdfd��YZd�Zd�Zejd�Zd�Zd�ZejejdZd�Zd�Zd�Zedkr^e�ndS(i����Ns\input texinfos^@([a-z]+)([ 	]|$)s^[ 	]*$s@[a-z]+s	[
@{}&<>]s.^\* ([^:]*):(:|[ 	]*([^	,
.]+)([^ 	
]*))[ 	
]*tHTMLNodecBsteZdZdZdZdZdZd�Zd�Zd�Z	d
d
d�Zd	�Zd
�Z
d�Zd�ZRS(s�Some of the parser's functionality is separated into this class.

    A Node accumulates its contents, takes care of links to other Nodes
    and saves itself when it is finished and all links are resolved.
    s2<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">its</BODY></HTML>
cCs^||_||_|r$||_n	||_||_||_||_||_g|_dS(N(tdirnametnamettopnamettitletnexttprevtuptlines(tselftdirRRRRRR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt__init__gs							cGst|jj|�dS(N(tmapR	tappend(R
R	((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytwritetscCsat|jdt|j�d�}|j|j�|j|j�|j|j�|j�dS(Nt/tw(	topenRtmakefileRRtprologuettexttepiloguetclose(R
tfp((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytflushws
#cCs�|r�|j�dkr'd}d}nt|�}d|}|j|d|d|r_d|pbd|rrd|pud|d	|d
�
ndS(Ns(dir)s../dir.htmlRs TITLE="%s"s: <A HREF="t"s REL=s REV=t>s</A>  
(tlowerRR(R
tlabeltnodenametreltrevtaddrR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytlink~s	
cCs�t|j�}dj|j�|_g|_|j�|j�|j�dj|j�}g|_|jd|jdt	|j
�d|j
dt	|j�d|jdt	|j�d|jd||_
|dkr�d	||_ndS(
NRsF
<HTML><HEAD>
  <!-- Converted with texi2html and Python -->
  <TITLE>s </TITLE>
  <LINK REL=Next HREF="s	" TITLE="s">
  <LINK REL=Previous HREF="s">
  <LINK REL=Up HREF="s">
</HEAD><BODY>
is<P>
%s</BODY></HTML>
(tlenR	tjoinRt
open_linkstoutput_linkstclose_linkstDOCTYPERRRRRRR(R
tlengthtlinks((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytfinalize�s	


	i
cCs|jd�dS(Ns<HR>
(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR%�scCs|jd�dS(Ns<HR>
(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR'�scCs�|j|jkr(|jd|j�n|jd|jdd�|jd|jdd�|jd|jdd�|j|jkr�|jd	|j�ndS(
Ns  Conts  NextRtNexts  PrevtPreviouss  UptUps  Top(tcontRR"RRRR(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR&�sN(t__name__t
__module__t__doc__R(ttypeR/RRRRtNoneR"R+R%R'R&(((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRZs	
		
			t	HTML3NodecBs eZdZd�Zd�ZRS(s;<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML Level 3//EN//3.0">cCs|jd�dS(Ns<DIV CLASS=Navigation>
 <HR>
(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR%�scCs|jd�dS(Ns
 <HR>
</DIV>
(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR'�s(R0R1R(R%R'(((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR5�s	t
TexinfoParsercBs�
eZdZdZdedZdedZdZeZd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d �Z"d!�Z#d"�Z$d#�Z%d$�Z&d%�Z'd&�Z(d'�Z)d(�Z*d)�Z+d*�Z,d+�Z-d,�Z.d-�Z/d.�Z0d/�Z1d0�Z2d1�Z3d2�Z4d3�Z5d4�Z6d5�Z7d6�Z8d7�Z9d8�Z:d9�Z;d:�Z<d;�Z=d<�Z>d=�Z?d>�Z@d?�ZAd@�ZBdA�ZCdB�ZDdC�ZEdD�ZFdE�ZGdF�ZHdG�ZIdH�ZJdI�ZKdJ�ZLdK�ZMdL�ZNdM�ZOdN�ZPdO�ZQdP�ZRdQ�ZSdR�ZTdS�ZUdT�ZVdU�ZWdV�ZXdW�ZYdX�ZZdY�Z[dZ�Z\d[�Z]d\�Z^e]Z_e^Z`d]�Zad^�Zbd_�Zcd`�Zdda�Zedb�Zfdc�Zgdd�Zhde�Zidf�Zjdg�Zkdh�Zldi�Zmdj�Zndk�Zodl�Zpdm�Zqdn�Zrdo�Zsdp�Ztdq�Zudr�Zvds�Zwdt�Zxdu�Zydv�Zzdw�Z{dx�Z|dy�Z}dz�Z~d{�Zd|�Z�d}�Z�d~�Z�d�Z�d��Z�d��Z�d��Z�d��Z�e]Z�e^Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�e�Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�e�Z�e�Z�e�Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�e�Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�e�Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�e�Z�d��Z�d��Z�e�Z�d��Z�d��Z�e�Z�d��Z�d��Z�e�Z�d��Z�d��Z�e�Z�d��Z�d��Z�e�Z�d��Z�d��Z�e�Z�d��Z�d��Z�e�Z�d��Z�d��Z�e�Z�d��Z�d��Z�e�Z�d��Z�d��Z�e�Z�d��Z�d��Ze�Zd��Zd��Ze�Zd��Zd��ZeZd��Zd��Z	e�Z
d��Zd��Zd��Z
d��Zd��Zd��Zd��Zd��Zd��Zd��Zd��Zd��ZeZd��Zd��Zd��Zd��Zd��Zd��Zd��Zd��ZeZ eZ!eZ"eZ#e Z$e!Z%eZ&eZ'e&Z(e'Z)d��Z*d��Z+d��Z,d��Z-d��Z.d��Z/d��Z0d��Z1d��Z2d��Z3d��Z4d�Z5d�Z6d�Z7d�Z8d�Z9d�Z:d�Z;d�Z<e<Z=d�Z>d	�Z?d
�Z@RS(s&copy;s(%(id)s)s5<A NAME=footnoteref%(id)s HREF="#footnotetext%(id)s">s</A>s5<A NAME=footnotetext%(id)s HREF="#footnoteref%(id)s">s</A>
%(text)s<P>
sJ
<P>
<HR NOSHADE SIZE=1 WIDTH=200>
<STRONG><EM>Footnotes</EM></STRONG>
<P>cCsi|_i|_d|_d|_d|_d|_d|_d|_g|_	d|_
d|_d|_d|_
d|_d|_|j�g|_g|_d|_idd6|_i|_g|_d|_d|_d|_d|_g|_d|_d|_dS(Nittmpt.Rithtml(tunknownt	filenamest	debuggingt
print_headersR4tnodefpt
nodelinenoR*tsavetextt	savestackthtmlhelpRt
includedirRRRt
resetindextcontentst	numberingtnofilltvaluest	stackinfot	footnotestitemargt
itemnumbert	itemindextnodet	nodestackR/tincludedepth(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�s:															
											cCs
||_dS(N(RB(R
RB((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytsethtmlhelp�scCs
||_dS(N(R(R
R((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
setdirname�scCs
||_dS(N(RC(R
RC((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
setincludedir�scCs�|j�}d}x?|rS|ddks:tj|�rS|j�}|d}qW|tt� tkr}tdtf�n|j||�dS(Niit%sfile does not begin with %r(treadlinetblprogtmatchR#tMAGICtSyntaxErrort	parserest(R
Rtlinetlineno((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytparse�s(c
Cs<|}d|_d|_g|_g}x�|js�|j�}|jd|_|s�|r}|jst|j|�ng}n|dkr�dGHnPn|d}tj|�}|r-|jd�\}}|||!}	|	dkr�|j	|�q�|r|js|j|�ng}n|j
||�q*tj|�r�d|jkr�d|jkr�|r�|js�|j|�|jr�|j
d�n
|j
d	�g}q�q�q*|j	|�q*W|jr�d
GHn|jr�dGHdG|jGHn|jdkr8x<|jr4|jd
j�|jd
j�|jd
=q�WndS(Niis*** EOF before @byetnoindenttrefilltformattexamples
s<P>
s*** Still skipping at the ends*** Stack not empty at the ends***i����(R^R_(tdonetskiptstackRUR?tprocesstcmprogRWtspanRtcommandRVRGRRPROR+R(
R
Rtinitial_linenoR\taccuR[tmotatbtcmd((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRZsb					

			
	
		cCs2|jdkr%|jj|j�nd|_dS(NR(R@R4RAR(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytstartsaving@scCsN|j}t|j�dkr;|jd|_|jd=n	d|_|pMdS(Nii����R(R@R#RAR4(R
R@((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytcollectsavingsGs	
	cGs�ydj|�}Wn|GHt�nX|jdkrJ|j||_n8|jrf|jj|�n|jr�|jj|�ndS(NR(R$t	TypeErrorR@R4R>RRN(R
targsR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRQs
		cCs�|jdkr#dGH|j�}n|jr9|j�n|jr|jdkr�|jd�|jd \}}}}|j	d|�|j	d|�|j	d|�|j
|jkr�|j	d|j�n|jd�n|jd	�|jj�d|_n�|j
r�|jrf|j
jsI|j
jrf|j
jrf|j
jrf|j
j�|j
j�n|jj|j
�d|_
nd
|_
dS(Ns$*** Still saving text at end of nodeis<HR>
iR,tPrevR.tTops</BODY>
R(R@R4RpRJtwritefootnotesR>R?Rt	nodelinksR"RRRRNR/R3RRRR+RROR(R
tdummyRRRR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytendnode_s6	
	


	

$
c	Cs�|jdkrdd|jGdG|jG|jG|rA|dd Gn|ddsY|dr`dGnHn|j�r�xa|D]:}tj|�}|s�|j�d}|j|�qwn|jd�\}}|jd�\}}|jd�\}}	|jd	�\}
}|jd
�\}}
|||!}|||	!}|ddkrQ|}n
||
|!}|||
!}|j	dt
|�d
|d|d�|jj|�|j||�qwWndj
|�}|j|�dS(Nit!sprocess:iis...s
iiit:s  <LI><A HREF="s">s</A>R(R<RcRdtinmenutmiprogRWtstriptexpandRgRRRBtmenuitemR$(R
RjR[RktbgntendRlRmtctdtetftgthRRtpunctR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyResB



	

		
cCss|j}xS|r^|ddkr^y|jt|�r<dSWntk
rPnX|d }qW|or|ddkS(Ni����tifsettifclearitmenu(R�R�(RdRIR#tKeyError(R
Rd((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR{�s	
c
Cs'g}d}t|�}x�||kr|}tj||�}|rT|j�}n|j||�P|j|||!�||}|d}|dkr�|jd�qn|dkr�|jd�qn|dkr�|jd�qn|dkr
|jd	�qn|d
kr)|jd�qn|dkr�|sSd
GH|jd�qn|d}|d=yt|d|�}	Wn!tk
r�|j|�qnX|	�qn|dkr�t	d|�n|}x-||kr�||t
jkr�|d}q�W||krC|d}|||!}|dkr0q|j|�qn|||!}||kr�||d
kr�|d}|j|�yt|d|�}	Wn!tk
r�|j|�qnX|	�qnyt|d|�}	Wn!tk
r|j
|�qnX|	�qW|r#dG|GHndS(Niis
t<s&lt;Rs&gt;t&s&amp;t{Rt}s*** Unmatched }i����tclose_t@sunexpected funny %rRztopen_thandle_s*** Stack not empty at para:(R#tspprogtsearchtstartRRtgetattrtAttributeErrort
unknown_closetRuntimeErrortstringt
ascii_letterstunknown_opentunknown_handle(
R
RRdtitnR�RkR�Rntmethod((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR~�s�










"









cCsed|dGH|d}|jd|�|jj|�sId|j|<n|j|d|j|<dS(Ns*** No open func for @s{...}R�R�i(RR:thas_key(R
Rn((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�s

cCsbd|dGHd|}|jd�|jj|�sFd|j|<n|j|d|j|<dS(Ns*** No close func for @s{...}R�i(RR:R�(R
Rn((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�
s


cCsWd|GH|jd|�|jj|�s;d|j|<n|j|d|j|<dS(Ns*** No handler for @R�i(RR:R�(R
Rn((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�s
	cCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pythandle_noindent"RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
handle_refill$RcCs�|}tjj|j|�}yt|d�}Wn#tk
rV}dGt|�GHdSXd|jGdGt|�GH|j}|j	}|j
}|jd|_|j|d�|jd|_|j
�||_||_	||_
d|jGdGt|�GHdS(Ntrs*** Can't open include fileRys--> fileiis<-- file(tostpathR$RCRtIOErrortreprR<RbRcRdRPRZR(R
RrtfileRtmsgt	save_donet	save_skipt
save_stack((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
do_include(s&			
			cCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_dmn?RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	close_dmn@RcCs|jd�dS(Ns...(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	open_dotsBRcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
close_dotsCRcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_bulletERcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_bulletFRcCs|jd�dS(NtTeX(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_TeXHRcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	close_TeXIRcCs|j|j�dS(N(RtCOPYRIGHT_SYMBOL(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pythandle_copyrightKRcCs|j|j�dS(N(RR�(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_copyrightLRcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_copyrightMRcCs|jd�dS(Nt-(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
open_minusORcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_minusPRcCs|jd�dS(Ns&#161;(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_exclamdownvRcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_exclamdownwRcCs|jd�dS(Ns&#191;(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_questiondownxRcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_questiondownyRcCs|jd�dS(Ns&#229;(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_aazRcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_aa{RcCs|jd�dS(Ns&#197;(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_AA|RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_AA}RcCs|jd�dS(Ns&#230;(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_ae~RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_aeRcCs|jd�dS(Ns&#198;(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_AE�RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_AE�RcCs|jd�dS(Ns&#248;(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_o�RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_o�RcCs|jd�dS(Ns&#216;(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_O�RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_O�RcCs|jd�dS(Ns&#223;(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_ss�RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_ss�RcCs|jd�dS(Ntoe(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_oe�RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_oe�RcCs|jd�dS(NtOE(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_OE�RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_OE�RcCs|jd�dS(Nsl/(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_l�RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_l�RcCs|jd�dS(NsL/(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_L�RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_L�RcCs|jd�dS(Ns=&gt;(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_result�RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_result�RcCs|jd�dS(Ns==&gt;(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_expansion�RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_expansion�RcCs|jd�dS(Ns-|(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
open_print�RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_print�RcCs|jd�dS(Nserror--&gt;(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
open_error�RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_error�RcCs|jd�dS(Ns==(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
open_equiv�RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_equiv�RcCs|jd�dS(Ns-!-(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
open_point�RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_point�RcCs|jd�|j�dS(Nssee (RRo(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
open_pxref�s
cCs|j�dS(N(tmakeref(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_pxref�scCs|jd�|j�dS(NsSee (RRo(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	open_xref�s
cCs|j�dS(N(R�(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
close_xref�scCs|j�dS(N(Ro(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_ref�scCs|j�dS(N(R�(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	close_ref�scCs|jd�|j�dS(NsSee info file (RRo(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_inforef�s
cCs�|j�}g|jd�D]}|j�^q}x#t|�dkrY|jd�q7W|d}|d}|jd|d|d�dS(	Nt,iRiit`s	', node `s'(RptsplitR}R#RR(R
RtsRrRNR�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
close_inforef�s(

c	Cs�|j�}g|jd�D]}|j�^q}x#t|�dkrY|jd�q7W|d}}|dr|d}n|d}|d}t|�}|r�d|d	|}n|jd
|d|d�dS(
NR�iRiiiis../Rs	<A HREF="s">s</A>(RpR�R}R#RRR(	R
RR�RrRRR�Rthref((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR��s(



cCs|j�dS(N(Ro(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	open_uref�scCs�|j�}g|jd�D]}|j�^q}x#t|�dkrY|jd�q7W|d}|d}|s}|}n|jd|d|d�dS(	NR�iRiis	<A HREF="s">s</A>(RpR�R}R#RR(R
RR�RrR�R((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
close_uref�s(

	cCs|j�dS(N(Ro(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
open_image�scCs|j�dS(N(t	makeimage(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_image�sc
Cs~|j�}g|jd�D]}|j�^q}x#t|�dkrY|jd�q7W|d}|d}|d}|d}|d}|jd	|}	tjj|	d
�r�|d
7}nOtjj|	d�r�|d7}n,tjj|	d�r|d7}n	d
|	GH|j	d|d|r2d|dp5d|rId|dpLd|r`d|dpcdd�|j
j|	�dS(NR�iRiiiiiRs.pngs.jpgs.gifs*** Cannot find image s
<IMG SRC="Rs WIDTH="s	 HEIGHT="s ALT="s/>(RpR�R}R#RRR�R�texistsRRBtaddimage(
R
RR�Rrtfilenametwidththeighttalttextt
imagelocation((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR��s.(







	cCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�
RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�RcCs|jd�dS(Ns<CITE>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	open_citeRcCs|jd�dS(Ns</CITE>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
close_citeRcCs|jd�dS(Ns<CODE>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	open_codeRcCs|jd�dS(Ns</CODE>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
close_codeRcCs|jd�dS(Ns<TT>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_tRcCs|jd�dS(Ns</TT>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_tRcCs|jd�dS(Ns<DFN>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_dfnRcCs|jd�dS(Ns</DFN>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	close_dfnRcCs|jd�dS(Ns<EM>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	open_emphRcCs|jd�dS(Ns</EM>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
close_emph RcCs|jd�dS(Ns<I>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_i"RcCs|jd�dS(Ns</I>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_i#RcCsBt|j�d}|j|jit|�d6�|j�dS(Nitid(R#RJRtFN_SOURCE_PATTERNR�Ro(R
R((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
open_footnote%s!cCs3t|j�d}|jj||j�f�dS(Ni(R#RJRRp(R
R((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_footnote,scCs_|j|j�x?|jD]4\}}|j|jit|�d6|d6�qWg|_dS(NRR(Rt	FN_HEADERRJtFN_TARGET_PATTERNR�(R
RR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRu0s
 cCs|jd�dS(Ns<CODE>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	open_file7RcCs|jd�dS(Ns</CODE>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
close_file8RcCs|jd�dS(Ns<KBD>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_kbd:RcCs|jd�dS(Ns</KBD>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	close_kbd;RcCs|jd�dS(Ns<KEY>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_key=RcCs|jd�dS(Ns</KEY>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	close_key>RcCs|jd�dS(Ns<R>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_r@RcCs|jd�dS(Ns</R>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_rARcCs|jd�dS(Ns`<SAMP>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	open_sampCRcCs|jd�dS(Ns</SAMP>'(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
close_sampDRcCs|jd�dS(Ns<SMALLCAPS>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_scFRcCs|jd�dS(Ns</SMALLCAPS>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_scGRcCs|jd�dS(Ns<STRONG>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_strongIRcCs|jd�dS(Ns	</STRONG>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_strongJRcCs|jd�dS(Ns<B>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_bLRcCs|jd�dS(Ns</B>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_bMRcCs|jd�dS(Ns<VAR>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_varORcCs|jd�dS(Ns</VAR>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	close_varPRcCs|jd�dS(Ns	<NOBREAK>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_wRRcCs|jd�dS(Ns
</NOBREAK>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_wSRcCs|j�dS(N(Ro(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_urlURcCs)|j�}|jd|d|d�dS(Ns	<A HREF="s">s</A>(RpR(R
R((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	close_urlVscCs|j�dS(N(Ro(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
open_emailZRcCs)|j�}|jd|d|d�dS(Ns<A HREF="mailto:s">s</A>(RpR(R
R((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_email[scCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
open_smallbRcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_smallcRcCs#|jd�\}}|||!}||j�}|jdkrnd|jGdG|jG|jGd|G|GHnyt|d|�}Wnttk
r�yt|d|�}Wn.tk
r�|js�|j||�ndSX|jj|�||�dSX|js|dkr||�ndS(NiRyscommand:R�tdo_tbgn_R�(	RgR}R<RcRdR�R�tunknown_cmdR(R
R[RkRlRmRnRrtfunc((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRhes(


	
cCsOdGd|G|GH|jj|�s3d|j|<n|j|d|j|<dS(Ns*** unknownR�i(R:R�(R
RnRr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR2|scCs�|j�}|sdGHn�|d}|jsA|jd|krQdG|GdGHn
|jd=yt|d|�}Wntk
r�|j|�dSX|�dS(Ns*** @end w/o argsii����s*** @endt
unexpectedtend_(R�RdR�R�tunknown_end(R
RrtwordsRnR3((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_end�s



cCsUd|}dGd|GH|jj|�s9d|j|<n|j|d|j|<dS(Nsend s*** unknownR�i(R:R�(R
Rn((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR6�s


cCsdS(N((R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
do_comment�RcCsdS(N((R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
bgn_ifinfo�RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
end_ifinfo�RcCs|jd|_dS(Ni(Rc(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	bgn_iftex�RcCs|jd|_dS(Ni(Rc(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	end_iftex�RcCs|jd|_dS(Ni(Rc(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
bgn_ignore�RcCs|jd|_dS(Ni(Rc(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
end_ignore�RcCs|jd|_dS(Ni(Rc(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytbgn_tex�RcCs|jd|_dS(Ni(Rc(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytend_tex�RcCsX|jd�}|d}t|�dkr4d}ndj|d�}||j|<dS(Nt ii(R�R#R$RH(R
Rrtfieldstkeytvalue((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_set�s
	cCsd|j|<dS(N(R4RH(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_clear�scCsk||jj�ks(|j|dkrQ|jd|_d|jt|j�<nd|jt|j�<dS(Nii(RHtkeysR4RcRIR#Rd(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	bgn_ifset�s
cCsvyH|jt|j�dr0|jd|_n|jt|j�d=Wn'tk
rqdGt|j�dGHnXdS(Nis*** end_ifset: KeyError :(RIR#RdRcR�(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	end_ifset�s
cCsk||jj�krQ|j|dk	rQ|jd|_d|jt|j�<nd|jt|j�<dS(Nii(RHRHR4RcRIR#Rd(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytbgn_ifclear�s
cCsvyH|jt|j�dr0|jd|_n|jt|j�d=Wn'tk
rqdGt|j�dGHnXdS(Nis*** end_ifclear: KeyError :(RIR#RdRcR�(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytend_ifclear�s
cCs|j�dS(N(Ro(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
open_value�scCsE|j�}||jj�kr8|j|j|�n	dG|GHdS(Ns*** Undefined value: (RpRHRHR(R
RD((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_value�scCs*|j�|j|�|j�|_dS(N(RoR~RpR(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_settitle�s

cCsdS(N((R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
do_parskip�RcCs|j�d|_dS(Ni(RxRb(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_bye�s
cCs|jd|_dS(Ni(Rc(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
bgn_titlepage�RcCs|jd|_dS(Ni(Rc(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
end_titlepage�RcCsdS(N((R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_shorttitlepage�RcCs+|jd�|j|�|jd�dS(Ns<H1>s</H1>
(RR~(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	do_center�s

c
Cs�|j�d|_g|jd�D]}|j�^q#}x#t|�dkr`|jd�q>W||_|d \}}}}|jdt|�}|j	j
|�r�dG|GHn |jr�d|jGdG|GHnd	|j	|<||_|j
r|jr|j|jd
_
n|js(||_n|}	|jrK|	d|j}	n|j|j|j|j|	|||�|_|jj|j||||�dS(NiR�iRRs*** Filename already in use: Rys--- writingii����s -- (RxR?R�R}R#RRvRRR;R�R<RR/RORRtNodeRNRBtaddnode(
R
RrR�tpartsRRRRR�R((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_nodes0
	(		
			c	CsV|rR|j�dkr!d}nt|�}|j|d|d|d|d�ndS(Ns(dir)s../dir.htmls: <A HREF="s" TYPE="s">s</A>  
(RRR(R
RRR!((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR".s	cCs7|jr3||j_x|jr/|jdj|krf|jdj�|jdj�|jd=q|jdj|kr�|jdjs�|jj|jd_n|jjs�|jdj|j_n|jdj�|jdj�|jd=q|dkr+|jjr+|jdj|j_nPqWndS(Ni����i(	RNR3ROR+RRRRR(R
R3((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytpopstack9s$	

cCs$|jd|d�|jd�dS(NtH1ii(theadingRZ(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
do_chapterNscCs$|jd|d�|jd�dS(NR[i����i(R\RZ(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
do_unnumberedRscCs$|jd|d�|jd�dS(NR[i����i(R\RZ(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_appendixUscCs|jd|d�dS(NR[i����(R\(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_topXscCs|jd|d�dS(NR[i����(R\(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_chapheadingZscCs|jd|d�dS(NR[i����(R\(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_majorheading\scCs$|jd|d�|jd�dS(NR[ii(R\RZ(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
do_section_scCs$|jd|d�|jd�dS(NR[i����i(R\RZ(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_unnumberedseccscCs$|jd|d�|jd�dS(NR[i����i(R\RZ(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_appendixsecfscCs|jd|d�dS(NR[i����(R\(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
do_headingjscCs$|jd|d�|jd�dS(NtH2ii(R\RZ(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
do_subsectionmscCs$|jd|d�|jd�dS(NRgi����i(R\RZ(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_unnumberedsubsecpscCs$|jd|d�|jd�dS(NRgi����i(R\RZ(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_appendixsubsecsscCs|jd|d�dS(NRgi����(R\(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
do_subheadingvscCs$|jd|d�|jd�dS(NtH3ii(R\RZ(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_subsubsectionyscCs$|jd|d�|jd�dS(NRli����i(R\RZ(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_unnumberedsubsubsec|scCs$|jd|d�|jd�dS(NRli����i(R\RZ(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_appendixsubsubsecscCs|jd|d�dS(NRli����(R\(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_subsubheading�scCs|dkr�x)t|j�|kr7|jjd�qW|j|d3|j|d|j|<d}x%|jD]}|t|�d}qnW|d|}|jj|||jf�n|jd|d�|j|�|jd|d	�|js�|j	r
d
G|GHndS(NiiRR8RBR�Rs</s>
s---(
R#RFRR�RERRR~R<R=(R
R3RrtleveltxR�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR\�s
cCs|jdd�dS(NsTable of Contentsi�(tlistcontents(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_contents�scCsdS(N((R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_shortcontents�scCs!|jd|d�dg}x�|jD]�\}}}||krGq&n||dkr|jd|dd�|j|�nI||dkr�x6||dkr�|d=|jd|dd�q�Wn|jd|dt|�d	�|j|�|jd
�q&W|jdt|��dS(Ns<H1>s</H1>
<UL COMPACT PLAIN>
ii����s  s<UL PLAIN>
s</UL>
s<LI> <A HREF="s">s</A>
(RRERRR~R#(R
Rtmaxlevelt
prevlevelsRqRN((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRs�s$	
cCsdS(N((R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_page�RcCsdS(N((R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_need�RcCsdS(N((R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	bgn_group�RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	end_group�RcCs*|jr|jd�n
|jd�dS(Ns
s<P>
(RGR(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_sp�s	cCs|jd�dS(Ns<HR>(R(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_hline�scCs|jd�|j|�dS(Ns<DL>(Rt	do_deffnx(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	bgn_deffn�s
cCs|jd�dS(Ns</DL>
(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	end_deffn�scCs�|jd�t|d�}|d |d\}}}|jd|�x%|D]}|jdt|��qOW|jd�|jd|�dS(Ns<DT>is@b{%s}RBs
<DD>tfn(Rt
splitwordsR~tmakevartindex(R
RrR7tcategoryRtresttword((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR~�s


cCs|jd|�dS(Ns	Function (R(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	bgn_defun�RcCs|jd|�dS(Ns	Function (R~(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	do_defunx�RcCs|jd|�dS(NsMacro (R(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
bgn_defmac�RcCs|jd|�dS(NsMacro (R~(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
do_defmacx�RcCs|jd|�dS(Ns{Special Form} (R(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytbgn_defspec�RcCs|jd|�dS(Ns{Special Form} (R~(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_defspecx�RcCs|jd�|j|�dS(Ns<DL>(Rt	do_defvrx(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	bgn_defvr�s
cCs�|jd�t|d�}|d |d\}}}|jd|�x|D]}|jd|�qOW|jd�|jd|�dS(Ns<DT>is	@code{%s}RBs
<DD>tvr(RR�R~R�(R
RrR7R�RR�R�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR��s


cCs|jd|�dS(Ns	Variable (R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
bgn_defvar�RcCs|jd|�dS(Ns	Variable (R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
do_defvarx�RcCs|jd|�dS(Ns{User Option} (R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
bgn_defopt�RcCs|jd|�dS(Ns{User Option} (R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
do_defoptxRcCs|jd�|j|�dS(Ns<DL>(Rt
do_deftypefnx(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
bgn_deftypefns
cCs�|jd�t|d�}|d |d\}}}}|jd||f�x%|D]}|jdt|��qXW|jd�|jd|�dS(Ns<DT>is@code{%s} @b{%s}RBs
<DD>R�(RR�R~R�R�(R
RrR7R�tdatatypeRR�R�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�s


cCs|jd|�dS(Ns	Function (R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytbgn_deftypefunRcCs|jd|�dS(Ns	Function (R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_deftypefunxRcCs|jd�|j|�dS(Ns<DL>(Rt
do_deftypevrx(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
bgn_deftypevrs
cCs�|jd�t|d�}|d |d\}}}}|jd||f�x|D]}|jd|�qXW|jd�|jd|�dS(Ns<DT>is@code{%s} @b{%s}RBs
<DD>R�(RR�R~R�(R
RrR7R�R�RR�R�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR� s


cCs|jd|�dS(Ns	Variable (R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytbgn_deftypevar+scCs|jd|�dS(Ns	Variable (R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_deftypevarx.scCs|jd�|j|�dS(Ns<DL>(Rt	do_defcvx(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	bgn_defcv3s
cCs�|jd�t|d�}|d |d\}}}}|jd|�x|D]}|jd|�qRW|jd�|jdd||f�dS(Ns<DT>is@b{%s}RBs
<DD>R�s%s @r{on %s}(RR�R~R�(R
RrR7R�t	classnameRR�R�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�9s


cCs|jd|�dS(Ns{Instance Variable} (R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytbgn_defivarDscCs|jd|�dS(Ns{Instance Variable} (R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_defivarxGscCs|jd�|j|�dS(Ns<DL>(Rt	do_defopx(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	bgn_defopJs
cCs�|jd�t|d�}|d |d\}}}}|jd|�x%|D]}|jdt|��qRW|jd�|jdd||f�dS(Ns<DT>is@b{%s}RBs
<DD>R�s%s @r{on %s}(RR�R~R�R�(R
RrR7R�R�RR�R�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�Ps


cCs|jd|�dS(NsMethod (R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
bgn_defmethodZscCs|jd|�dS(NsMethod (R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
do_defmethodx]scCs|jd�|j|�dS(Ns<DL>(Rt	do_deftpx(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	bgn_deftpbs
cCs�|jd�t|d�}|d |d\}}}|jd|�x|D]}|jd|�qOW|jd�|jd|�dS(Ns<DT>is@b{%s}RBs
<DD>ttp(RR�R~R�(R
RrR7R�RR�R�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�hs


cCs\|s,|jd�d|jt|j�<n,||_|jd�d|jt|j�<dS(Ns<OL>
s</OL>
s<UL>
s</UL>
(RRIR#RdRL(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
bgn_enumeratets
	
cCsEd|_|j|jt|j�d�|jt|j�d=dS(Ni(R4RLRRIR#Rd(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
end_enumerate|s	!cCs||_|jd�dS(Ns<UL>
(RKR(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytbgn_itemize�s	cCsd|_|jd�dS(Ns</UL>
(R4RKR(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytend_itemize�s	cCs||_|jd�dS(Ns<DL>
(RKR(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	bgn_table�s	cCsd|_|jd�dS(Ns</DL>
(R4RKR(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	end_table�s	cCsd|_|j|�dS(NR�(RMR�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
bgn_ftable�s	cCsd|_|j�dS(N(R4RMR�(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
end_ftable�s	cCsd|_|j|�dS(NR�(RMR�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
bgn_vtable�s	cCsd|_|j�dS(N(R4RMR�(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
end_vtable�s	cCsv|jr|j|j|�n|jr�|jddkrv|jdrv|jdtjkrv|jd|d}q�|jd|}n|jdkr�|jd|}t|j�|_n|jr|jdd	kr|j	d
�|j
|�|j	d�nm|jrK|jddkrK|j	d
�|j
|�|j	d�n'|j	d�|j
|�|j	d�dS(NiR�iR�R�RBs. i����ttables<DT>s
<DD>t
multitables<TR><TD>s</TD>
</TR>
s<LI>s  (RMR�RKR�R�RLR4t	incrementRdRR~(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_item�s*		 





cCsd|_|jd�dS(Ns<TABLE BORDER="">
(R4RKR(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytbgn_multitable�s	cCsd|_|jd�dS(Ns</TABLE>
<BR>
(R4RKR(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytend_multitable�s	cCs
d|_dS(N(R4RK(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pythandle_columnfractions�scCs|jd�dS(Ns</TD>
    <TD>(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
handle_tab�scCs|jd�dS(Ns<BLOCKQUOTE>(R(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
bgn_quotation�RcCs|jd�dS(Ns</BLOCKQUOTE>
(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
end_quotation�RcCs!|jd|_|jd�dS(Nis<PRE>(RGR(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytbgn_example�scCs!|jd�|jd|_dS(Ns</PRE>
i(RRG(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytend_example�s
cCs|j|d�dS(Ns
(R~(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	do_exdent�RcCs!|jd|_|jd�dS(Nis<PRE>
(RGR(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
bgn_flushleft�scCs!|jd�|jd|_dS(Ns</PRE>
i(RRG(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
end_flushleft�s
cCs!|jd|_|jd�dS(Nis<ADDRESS COMPACT>
(RGR(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytbgn_flushright�scCs!|jd�|jd|_dS(Ns</ADDRESS>
i(RRG(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytend_flushright�s
cCs+|jd�|jd�|jj�dS(Ns<DIR>
s$  <STRONG><EM>Menu</EM></STRONG><P>
(RRBt	beginmenu(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytbgn_menu�s

cCs|jd�|jj�dS(Ns</DIR>
(RRBtendmenu(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytend_menu�s
cCsdS(N((R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
bgn_cartouche�RcCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
end_cartouche�RcCs�dg|_i|_d|jd<d|jd<d|jd<d|jd<d	|jd
<d|jd<i|_x$|jj�D]}g|j|<q|WdS(
NtcptConcepttFunctionR�tKeywordtkytProgramtpgtTypeR�tVariableR�(tnoncodeindicest
indextitlet
whichindexRH(R
R((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRD�s	





	cCs8|jj|�r%|j||�ndGt|�GHdS(Ns*** No index named(R�R�R�R�(R
RRr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
user_indexscCs|jd|�dS(NR�(R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	do_cindexRcCs|jd|�dS(NR�(R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	do_findexRcCs|jd|�dS(NR�(R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	do_kindexRcCs|jd|�dS(NR�(R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	do_pindexRcCs|jd|�dS(NR�(R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	do_tindexRcCs|jd|�dS(NR�(R�(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt	do_vindexRcCs7|j|j||jf�|jj||j�dS(N(R�RRRBR�(R
RRr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�scCs�|j�}t|�dkr+dG|GHdS|\}}|jj|�s]|jj|�rjdG|GHdS||kr�|j||j|k	r�|j|}|j||t|�)||j|<ndS(Nis*** bad @synindexs*** bad key(s) in @synindex(R�R#R�R�(R
RrR7toldtnewtinew((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_synindexs		
cCsR|j�}x?|D]7}|jj|�r;|j|�qdGt|�GHqWdS(Ns*** No index named(R�R�R�tprindexR�(R
RrR7R((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
do_printindex.s

cCs�||jk}|j|}|s&dS|jrQd|jGdG|j|GdGHng}tjd�}xr|D]j\}}|j�}|}	x3|j|�}
|
s�Pn|
j�}||}q�W|j	|||f�qmW|2|j
�|jd�d}}
x�|D]�\}}}||f||
fkr4qn|jdkr^d|jG|GdG|GHn|jd�|r�d	|d
}n||kr�|j
|�n|jdt|�|f�||}}
qW|jd�dS(
NRys--- GeneratingR�s^(@[a-z]+)?{s
<DL COMPACT>
iRzs<DT>s@code{R�s
<DD><A HREF="%s">%s</A>
s</DL>
(R�R�R<R�tretcompileRRWR�RtsortRR4R~R(R
RtiscodeindexR�tindex1tjunkprogRDRNtsortkeyt
oldsortkeyRkR�tprevkeytprevnode((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�6sH
	



cCsX|jrTdGH|jj�}|j�x*|D]}|jd�G|j|GHq.WndS(Ns--- Unrecognized commands ---i(R:RHR�tljust(R
tcmdsRn((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytreport^s	

(AR0R1R�t
FN_ID_PATTERNRRRRRVRRQRRRSR]RZRoRpRRxReR{R~R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�t	open_asist
close_asisRRRRRR	R
RRR
RRRRRuRRRRRRRRRRR R!R"R#R$R%R&R'R(R)R*R+R,R-topen_titlefonttclose_titlefontR.R/RhR2R8R6R9tdo_cR:R;R<R=R>R?R@RARFRGRIRJRKRLRMRNtdo_finalouttdo_setchapternewpagetdo_setfilenameRORPRQRRRSRTRUtdo_titletdo_subtitlet	do_authortdo_vskiptdo_vfilltdo_smallbooktdo_paragraphindenttdo_headingstdo_footnotestyletdo_evenheadingtdo_evenfootingt
do_oddheadingt
do_oddfootingtdo_everyheadingtdo_everyfootingRYR"RZR]R^R_R`RaRbRcRdRetdo_appendixsectionRfRhRiRjRkRmRnRoRpR\RtRutdo_summarycontentsRsRxRyRzR{R|R}RR�R~R�t	end_defunR�R�t
end_defmacR�R�tend_defspecR�R�t	end_defvrR�R�t
end_defvarR�R�t
end_defoptR�R�t
end_deftypefnR�R�tend_deftypefunR�R�t
end_deftypevrR�R�tend_deftypevarR�R�t	end_defcvR�R�tend_defivarR�R�t	end_defopR�R�t
end_defmethodR�R�t	end_deftpR�R�R�R�R�R�R�R�R�R�R�R�tdo_itemxR�R�R�R�R�R�R�R�tbgn_lisptend_lisptbgn_smallexampletend_smallexamplet
bgn_smalllispt
end_smalllisptbgn_displaytend_displayt
bgn_formatt
end_formatR�R�R�R�R�R�R�R�R�RDR�R�R�R�R�R�R�R�R�tdo_syncodeindexR�R�R�(((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR6�s~	!					8		
		 	#		T																					&																																																				&																																															
																																																												
																										
																																												(tTexinfoParserHTML3cBs�eZdZdZdedZdedZdZeZd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�ZRS(s&copy;s[%(id)s]s3<A ID=footnoteref%(id)s HREF="#footnotetext%(id)s">s</A>s;<FN ID=footnotetext%(id)s>
<P><A HREF="#footnoteref%(id)s">s</A>
%(text)s</P></FN>
s[<DIV CLASS=footnotes>
  <HR NOSHADE WIDTH=200>
  <STRONG><EM>Footnotes</EM></STRONG>
  <P>
cCs|jd�dS(Ns<BQ>(R(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�uRcCs|jd�dS(Ns</BQ>
(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�vRcCs!|jd|_|jd�dS(Nis<PRE CLASS=example><CODE>(RGR(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�xscCs!|jd�|jd|_dS(Ns</CODE></PRE>
i(RRG(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�}s
cCs!|jd|_|jd�dS(Nis<PRE CLASS=flushleft>
(RGR(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR��scCs!|jd|_|jd�dS(Nis4<DIV ALIGN=right CLASS=flushright><ADDRESS COMPACT>
(RGR(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR��scCs!|jd�|jd|_dS(Ns</ADDRESS></DIV>
i(RRG(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR��s
cCs|jd�|jd�dS(Ns<UL PLAIN CLASS=menu>
s  <LH>Menu</LH>
(R(R
Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR��s
cCs|jd�dS(Ns</UL>
(R(R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR��s(R0R1R�R�RRRR5RVR�R�R�R�R�R�R�R�R�(((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR&gs								tHTMLHelpcBs�eZdZejd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd	�Z
ejd
�Zejd�Zdejd
�Zdejd�Zd�Zejd�Zd�ZRS(s�
    This class encapsulates support for HTML Help. Node names,
    file names, menu items, index items, and image file names are
    accumulated until a call to finalize(). At that time, three
    output files are created in the current directory:

        `helpbase`.hhp  is a HTML Help Workshop project file.
                        It contains various information, some of
                        which I do not understand; I just copied
                        the default project info from a fresh
                        installation.
        `helpbase`.hhc  is the Contents file for the project.
        `helpbase`.hhk  is the Index file for the project.

    When these files are used as input to HTML Help Workshop,
    the resulting file will be named:

        `helpbase`.chm

    If none of the defaults in `helpbase`.hhp are changed,
    the .CHM file will have Contents, Index, Search, and
    Favorites tabs.
    s@code{(.*?)}cCsy||_||_d|_d|_d|_g|_i|_i|_i|_	g|_
d|_i|_i|_
dS(NR(thelpbaseRR4tprojectfiletcontentfilet	indexfiletnodelistt	nodenamest	nodeindexR;t	indexlisttcurrenttmenudicttdumped(R
R(R((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�s												cCse|||||f}||j|<t|j�|j|<|jj|�||_g|j|j<dS(N(R;R#R,R.RR0R1(R
RRRRR�RN((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRW�s
	cCs!|j|j}|j|�dS(N(R1R0R(R
RR�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�scCs||j|<dS(N(R;(R
t	imagename((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR��scCs|jj||f�dS(N(R/R(R
RrR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR��scCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR��scCsdS(N((R
((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR��scCs�|js
dS|jd}|jd}|jd}|jd}|j}|jd\}}}}	}
|
}y*t|d�}|dIJ|dIJ|d	IJ|d
IJ|dIJ|d|d
IJ|d|d
IJ|d|d
IJ|dIJ|d|d
IJ|d|d
IJ|dIJ|dIJ|dIJ|d
IJ|dIJ|d|d|dIJ|d
IJ|dIJ|d
IJ|j|�|j�Wn-tk
r�}
|GdG|
GHtjd�nXy�t|d�}|dIJ|dIJ|dIJ|d IJ|d!IJ|d"IJ|d#IJ|d$IJ|d%IJ|d&IJ|d'IJ|d(IJ|d)IJ|j|�|d*IJ|d+IJ|j�Wn-tk
r�}
|GdG|
GHtjd�nXy�t|d�}|dIJ|d,IJ|dIJ|d IJ|d!IJ|d"IJ|d#IJ|d$IJ|d-IJ|d.IJ|j	|�|d*IJ|d+IJ|j�Wn-tk
r�}
|GdG|
GHtjd�nXdS(/Ns.chms.hhps.hhcs.hhkiRs	[OPTIONS]sAuto Index=Yess
Binary TOC=NosBinary Index=YessCompatibility=1.1sCompiled file=RsContents file=sDefault topic=sError log file=ErrorLog.logsIndex file=sTitle=sDisplay compile progress=YessFull-text search=YessDefault window=mains	[WINDOWS]smain=,"s","s=","","",,,,,0x23520,222,0x1046,[10,10,780,560],0xB0000,,,,,,0s[FILES]Rzis.<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">s0<!-- This file defines the table of contents -->s<HTML>s<HEAD>sG<meta name="GENERATOR" content="Microsoft&reg; HTML Help Workshop 4.1">s<!-- Sitemap 1.0 -->s</HEAD>s<BODY>s'   <OBJECT type="text/site properties">s2     <param name="Window Styles" value="0x800025">s*     <param name="comment" value="title:">s)     <param name="comment" value="base:">s   </OBJECT>s</BODY>s</HTML>s$<!-- This file defines the index -->s$<OBJECT type="text/site properties">s	</OBJECT>(
R(R,Rt	dumpfilesRR�tsystexitt	dumpnodest	dumpindex(R
t
resultfileR)R*R+RRttopnextttopprevttopupttopfiletdefaulttopicRR�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR+�s�	



	














































cCs8|jj�}|j�x|D]}||IJq WdS(N(R;RHR�(R
toutfiletfilelistR�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR4;s

cCsyi|_|jr:|jd\}}}}}||_n|dIJx$|jD]}|j|d|�qNW|dIJdS(Nis<UL>s</UL>(R2R,ttopnodetdumpnode(R
R?RRwRN((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR7As		
ic
Cs�|r�|\}}}}}||_|jj|�r:dSd|j|<|d|I|dI|d|dI|d|dI|dIJy(|j|}	|j|	|d|�Wq�tk
r�q�XndS(	NiRBs <LI><OBJECT type="text/sitemap">s<param name="Name" value="s">s<param name="Local" value="s	</OBJECT>i(R0R2R�R1tdumpmenuR�(
R
RNtindentR?RRRRR�R�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRBLs 	




cCs�|r�|j}||jkr=|d|dIJ|d7}nx0|D](}|j|�}|j|||�qDW||jkr�|d|dIJ|d8}q�ndS(NRBs<UL>is</UL>(R0RAtgetnodeRB(R
R�RDR?tcurrentnodetitemtmenunode((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRCes	

cCsFy|j|}|j|SWn#tk
r0dStk
rAdSXdS(N(R.R,R�R4t
IndexError(R
RR�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRErs


cCs�|dIJx{|jD]p\}}|j|�}t|�}|jd|}|dI|d|dI|d|dI|dIJqW|dIJdS(	Ns<UL>Rs <LI><OBJECT type="text/sitemap">s<param name="Name" value="s">s<param name="Local" value="s	</OBJECT>s</UL>(R/t
codeexpandRR(R
R?RDtlocation((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR8|s

cCsg|jj|�}|s|S|jd�\}}|jd�\}}|| |||!||}|S(Nii(tcodeprogRWRg(R
R[tcoR�R�RlRm((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRJ�s(R0R1R2R�R�RLRRWRR�R�R�R�R+R5tstdoutR4R7RBRCRER8RJ(((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR'�s"								_
	
cCsd|dS(Ns@var{R�((tstr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR��scCs�g}d}t|�}xy||kr�x*||krS||dkrS|d}q*W||krdPn|}t|||�}|j|||!�qWx#t|�|kr�|jd�q�W|S(Nis 	
iR(R#tfindwordendR(ROt	minlengthR7R�R�R�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR��ss[@{} ]cCs�d}x�||kr�tj||�}|s1Pn|j�}||}|d}|dkrj|d}q	|dkr�|d}q	|dkr�|d}q	|dkr	|dkr	|dSq	W|S(NiiR�R�R�RB(tfwprogR�R�(ROR�R�RqRkR�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRP�s"




cCs|j�}t|�dS(Ns.html(R}t
fixfunnychars(R((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR�ss!@-=+.cCsld}x_|t|�krg||}|tkrTd}|| |||d}n|t|�}q	W|S(NiR�i(R#t	goodchars(R!R�R�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRS�s
cCs�|s
dSx�tjtjtjfD]�}|d}||kr#|j|�d}|t|�kr�t|�dkr�|dd}|dkr�d}q�q�t|d �|d}n|d ||}|Sq#W|S(Nt1i����iiit00t10(R�tdigitst	lowercaset	uppercaseR�R#R�(R�tsequencetlastcR�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR��s
cCs/ddl}d}d}d}d}d}x.|jddgkrZ|d}|jd=q-W|jddkr�d}|jd=n|jddkr�d}|jd=n|jddkr�d}|jd=n|jdd	kr�|jd
}|jdd5nt|j�dkr+dGd
GH|jd
�n|r=t�}n	t�}||_||_||_|jd}|jd
}	|j	|	�|j
tjj
|��t||	�}|j|�yt|d�}
Wn-tk
r�}|GdG|GH|jd�nX|j|
�|
j�|j�|j�dS(Ni����iRis-ds-ps-cs-3s-Hiis5usage: texi2hh [-d [-d]] [-p] [-c] [-3] [-H htmlhelp]sinputfile outputdirectoryR�Rz(R5targvR#R6R&R6R/R<R=RRRSR�R�RR'RQRR�R]RR�R+(R5R<R=R/thtml3RBR(tparserR�RRR�((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyttest�s\




				







t__main__(R�R5R�R�RXR�RfRVtkwprogR�R|RR5R6R&R'R�R�RRRPRR�RXRTRSR�R`R0(((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt<module>Bs<	Z������-�							9fixps.pyo000064400000001711151732701420006430 0ustar00�
�fc@s;ddlZddlZd�Zedkr7e�ndS(i����NcCs�x�tjdD]�}yt|d�}Wn#tk
rL}|GdG|GHqnX|j�}tjd|�s�|GdGH|j�qn|j�}|j�tj	dd|�}|GdGt
|�GHt|d	�}|j|�|j|�|j�qWdS(
Nitrs: can't open :s^#! */usr/local/bin/pythons$: not a /usr/local/bin/python scripts/usr/local/bin/pythons/usr/bin/env pythont:tw(tsystargvtopentIOErrortreadlinetretmatchtclosetreadtsubtreprtwrite(tfilenametftmsgtlinetrest((s+/usr/lib64/python2.7/Tools/scripts/fixps.pytmain
s(
	

	

t__main__(RRRt__name__(((s+/usr/lib64/python2.7/Tools/scripts/fixps.pyt<module>s	cvsfiles.pyc000064400000004163151732701420007105 0ustar00�
�fc@sqdZddlZddlZddlZddlZdad�Zd�Zd�Ze	dkrme�ndS(sDPrint a list of files that are mentioned in CVS directories.

Usage: cvsfiles.py [-n file] [directory] ...

If the '-n file' option is given, only files under CVS that are newer
than the given file are printed; by default, all files under CVS are
printed.  As a special case, if a file does not exist, it is always
printed.
i����NicCs�y#tjtjdd�\}}Wn tjk
rE}|GHtGdSXd}x/|D]'\}}|dkrSt|�aqSqSW|r�x%|D]}t|�q�Wn
td�dS(Nisn:s-nt.(	tgetopttsystargvterrort__doc__tNonetgetmtimet
cutofftimetprocess(toptstargstmsgt	newerfiletotatarg((s./usr/lib64/python2.7/Tools/scripts/cvsfiles.pytmains#
c
CsRd}g}tj|�}xo|D]g}tjj||�}|dkrR|}q"tjj|�r"tjj|�s�|j|�q�q"q"W|r3tjj|d�}x�t|�j�D]q}|j	d�}|ddkr�|dr�|d}tjj||�}t
r$t|�t
kr$q,|GHq�q�Wnx|D]}	t|	�q:WdS(NitCVStEntriest/ti(
tostlistdirtpathtjointisdirtislinktappendtopent	readlinestsplitRRR	(
tdirtcvsdirtsubdirstnamestnametfullnametentriestetwordstsub((s./usr/lib64/python2.7/Tools/scripts/cvsfiles.pyR	&s,
	

cCs6ytj|�}Wntjk
r*dSX|tjS(Ni(RtstatRtST_MTIME(tfilenametst((s./usr/lib64/python2.7/Tools/scripts/cvsfiles.pyR@s
t__main__(
RRRR*RRRR	Rt__name__(((s./usr/lib64/python2.7/Tools/scripts/cvsfiles.pyt<module>s			untabify.py000075500000002277151732701420006754 0ustar00#! /usr/bin/python2.7

"Replace tabs with spaces in argument files.  Print names of changed files."

import os
import sys
import getopt

def main():
    tabsize = 8
    try:
        opts, args = getopt.getopt(sys.argv[1:], "t:")
        if not args:
            raise getopt.error, "At least one file argument required"
    except getopt.error, msg:
        print msg
        print "usage:", sys.argv[0], "[-t tabwidth] file ..."
        return
    for optname, optvalue in opts:
        if optname == '-t':
            tabsize = int(optvalue)

    for filename in args:
        process(filename, tabsize)

def process(filename, tabsize, verbose=True):
    try:
        f = open(filename)
        text = f.read()
        f.close()
    except IOError, msg:
        print "%r: I/O error: %s" % (filename, msg)
        return
    newtext = text.expandtabs(tabsize)
    if newtext == text:
        return
    backup = filename + "~"
    try:
        os.unlink(backup)
    except os.error:
        pass
    try:
        os.rename(filename, backup)
    except os.error:
        pass
    with open(filename, "w") as f:
        f.write(newtext)
    if verbose:
        print filename

if __name__ == '__main__':
    main()
patchcheck.pyc000064400000021650151732701430007365 0ustar00�
�fc@sddlZddlZddlZddlZddlZddlZddlZddlZej	j
ddd�ej	j
ddd�ej	j
ddd�ej	j
dd�ej	j
dd�gZejd	�Z
d
�Zedd�Zd�Zd
�Zeddd��d��Zeddd��dd��Zd�Zedde�d��Zedde�d��Zejd�Zedde�d��Zedde�d��Zed de�d!��Zed"de�d#��Zd$�Z e!d%kre �ndS(&i����NtModulest_ctypestlibffit
libffi_osxtlibffi_msvctexpattzlibtsrcdircCs"dj||dkrdnd�S(s7Return 'N file(s)' with the proper plurality on 'file'.s	{} file{}itst(tformat(tcount((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytn_files_strscs���fd�}|S(s*Decorator to output status info to stdout.cs����fd�}|S(Ncsotjj�d�tjj��||�}�rF�rFdGHn%�rZ�|�GHn|rfdndGH|S(Ns ... tdonetyestNO(tsyststdouttwritetflush(targstkwargstresult(tfxntinfotmessagetmodal(s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytcall_fxns
((RR(RRR(Rs0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyt
decorated_fxns((RRRR((RRRs0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytstatuss
cCsBdj�}ytj|dtj�SWntjk
r=dSXdS(s0Get the symbolic name for the current git branchsgit rev-parse --abbrev-ref HEADtstderrN(tsplitt
subprocesstcheck_outputtPIPEtCalledProcessErrortNone(tcmd((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytget_git_branch.s
cCsBdj�}ytj|dtj�Wntjk
r=dSXdS(skGet the remote name to use for upstream branches

    Uses "upstream" if it exists, "origin" otherwise
    sgit remote get-url upstreamRtorigintupstream(RR R!R"R#(R%((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytget_git_upstream_remote7ssGetting base branch for PRRcCs|dk	r|SdS(Nsnot a PR branch(R$(tx((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyt<lambda>ER	cCs�tjjtjjtd��s%dStj}|jdkrFd}ndj	|�}t
�}|dksv||krzdSt�}|d|S(Ns.gittalphatmasters{0.major}.{0.minor}t/(tostpathtexiststjointSRCDIRR$Rtversion_infotreleaselevelR
R&R)(tversiontbase_branchtthis_branchtupstream_remote((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytget_base_branchDs!				s6Getting the list of files that have been added/changedcCstt|��S(N(Rtlen(R*((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyR+XR	csvtjjtjjtd��r
|r4d|}nd}g}tj|j�dtj�}z�x�|j	D]�}|j
�j�}|jd	d�\}�t
|�}|jd�s�qknd�kr��jdd�dj��n|j��qkWWd	|j	j�Xn
tjd
�g}xO|D]G�tjj���t�fd�tD��raq'n|j��q'W|S(s0Get the list of changed or added files from git.s.gitsgit diff --name-status sgit status --porcelainRitMAUs -> iNs)need a git checkout to get modified filesc3s|]}�j|�VqdS(N(t
startswith(t.0R0(tfilename(s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pys	<genexpr>zs(R/R0R1R2R3R tPopenRR"RtdecodetrstripR$tsettintersectiontstriptappendtcloseRtexittnormpathtanytEXCLUDE_DIRS(R7R%t	filenameststtlinetstatus_textRt
filenames2((R?s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyt
changed_filesWs2!


cCsrt|�}|dkr"t|�Sdjt|��g}x$|D]}|jdj|��qAWdj|�SdS(Nis{}:s  {}s
(R;RR
RFR2(t
file_pathsRtlinesR0((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytreport_modified_files�s

sFixing whitespacecCs\tt_g}xFd�|D�D]4}tjtjjt|��r |j|�q q W|S(sAMake sure that the whitespace for .py files have been normalized.css$|]}|jd�r|VqdS(s.pyN(tendswith(R>R*((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pys	<genexpr>�s(	tFalsetreindentt
makebackuptcheckR/R0R2R3RF(RRtfixedR0((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytnormalize_whitespace�s	sFixing C file whitespacecCs�g}xv|D]n}tjjt|�}t|d��}d|j�krRw
nWdQXtj|ddt�|j	|�q
W|S(sReport if any C files trs	Nitverbose(
R/R0R2R3topentreadtuntabifytprocessRVRF(RRRZR0tabspathtf((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytnormalize_c_whitespace�s
s\s+(\r?\n)$sFixing docs whitespacec	Cs�g}x�|D]�}tjjt|�}y�t|d��}|j�}WdQXg|D]}tjd|�^qV}||kr�tj	||d�t|d��}|j
|�WdQX|j|�nWq
tk
r�}d||fGHq
Xq
W|S(Ntrbs\1s.baktwbsCannot fix %s: %s(
R/R0R2R3R^t	readlinestws_retsubtshutiltcopyfilet
writelinesRFt	Exception(	RRRZR0RbRcRSRNt	new_linesterr((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytnormalize_docs_whitespace�s
%s
Docs modifiedRcCs
t|�S(s9Report if any file in the Doc directory has been changed.(tbool(RR((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyt
docs_modified�ssMisc/ACKS updatedcCstjjdd�|kS(s$Check if Misc/ACKS has been changed.tMisctACKS(R/R0R2(RR((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytcredit_given�ss Misc/NEWS.d updated with `blurb`cCstd�|D��S(s&Check if Misc/NEWS.d has been changed.css0|]&}|jtjjddd��VqdS(RssNEWS.dtnextN(R=R/R0R2(R>tp((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pys	<genexpr>�s(RJ(RR((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyt
reported_news�s	cCst�}t|�}g|D]}|jd�r|^q}g|D]}|jd�rD|^qD}g|D]*}|jd�rl|jd�rl|^ql}d�|D�}t|�t|�t|�t|�t|�t	|�|s�|r|rdnd	}Hd
|GHndS(
Ns.pys.cs.htDocs.rsts.inccSs%h|]}|jd�r|�qS(Rs(R=(R>Rw((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pys	<setcomp>�s	s and check for refleaks?t?sDid you run the test suite(s.cs.h(s.rsts.inc(
R:RQRUR=R[RdRpRrRuRx(R7RRtfntpython_filestc_filest	doc_filest
misc_filestend((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytmain�s"	((





t__main__("treRRjtos.pathR/R t	sysconfigRWR`R0R2RKtget_config_varR3RRVR$RR&R)R:RQRTR[RdtcompileRhRptTrueRrRuRxR�t__name__(((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyt<module>sB				
			)		byteyears.pyc000064400000002566151732701430007304 0ustar00�
�fc@sQddlZddlZddlZddlTd�ZedkrMe�ndS(i����N(t*c
Cs�y
tj}Wntk
r)tj}nXtjddkrPt}tjd=nRtjddkrvt}tjd=n,tjddkr�t}tjd=nt}d}tj�}d}d}x*tjdD]}t	|t
|��}q�Wx�tjdD]�}y||�}Wn<tjk
rO}tjj
d	||f�d}d
}nX|r�||}	|t}
||	}t|
�t|�|}|j|�Gtt|��jd
�GHq�q�Wtj|�dS(Nis-ms-cs-ag�v@g8@g �@iscan't stat %r: %r
ig�@g8~A((tostlstattAttributeErrortstattsystargvtST_MTIMEtST_CTIMEttimetmaxtlenterrortstderrtwritetST_SIZEtfloattljusttreprtinttrjusttexit(
tstatfunctitimet
secs_per_yeartnowtstatustmaxlentfilenametsttmsgtanytimetsizetaget	byteyears((s//usr/lib64/python2.7/Tools/scripts/byteyears.pytmainsF










!t__main__(RRR	RR#t__name__(((s//usr/lib64/python2.7/Tools/scripts/byteyears.pyt<module>	s$
	0eptags.pyo000064400000003524151732701430006567 0ustar00�
�fc@s_dZddlZddlZdZeje�Zd�Zd�Zedkr[e�ndS(s�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.
i����Ns;^[ \t]*(def|class)[ \t]+([a-zA-Z_][a-zA-Z0-9_]*)[ \t]*[:\(]c
Csyt|d�}Wntjjd|�dSXd}d}g}d}x�|j�}|scPn|d}tj|�}|r�|jd�d||f}	|j|	�|t	|	�}n|t	|�}qMW|jd||f�x|D]}	|j|	�q�WdS(sCAppend tags found in file named 'filename' to the open file 'outfp'trsCannot open %s
Niis%d,%d
s
%s,%d
(
topentsyststderrtwritetreadlinetmatchertsearchtgrouptappendtlen(
tfilenametoutfptfptcharnotlinenottagstsizetlinetmttag((s,/usr/lib64/python2.7/Tools/scripts/eptags.pyt
treat_files.


cCs8tdd�}x"tjdD]}t||�qWdS(NtTAGStwi(RRtargvR(RR((s,/usr/lib64/python2.7/Tools/scripts/eptags.pytmain2st__main__(	t__doc__RtretexprtcompileRRRt__name__(((s,/usr/lib64/python2.7/Tools/scripts/eptags.pyt<module>s		classfix.py000075500000013500151732701430006737 0ustar00#! /usr/bin/python2.7

# This script is obsolete -- it is kept for historical purposes only.
#
# Fix Python source files to use the new class definition syntax, i.e.,
# the syntax used in Python versions before 0.9.8:
#       class C() = base(), base(), ...: ...
# is changed to the current syntax:
#       class C(base, base, ...): ...
#
# The script uses heuristics to find class definitions that usually
# work but occasionally can fail; carefully check the output!
#
# Command line arguments are files or directories to be processed.
# Directories are searched recursively for files whose name looks
# like a python module.
# Symbolic links are always ignored (except as explicit directory
# arguments).  Of course, the original file is kept as a back-up
# (with a "~" attached to its name).
#
# Changes made are reported to stdout in a diff-like format.
#
# Undoubtedly you can do this using find and sed or perl, but this is
# a nice example of Python code that recurses down a directory tree
# and uses regular expressions.  Also note several subtleties like
# preserving the file's mode and avoiding to even write a temp file
# when no changes are needed for a file.
#
# NB: by changing only the function fixline() you can turn this
# into a program for a different change to Python programs...

import sys
import re
import os
from stat import *

err = sys.stderr.write
dbg = err
rep = sys.stdout.write

def main():
    bad = 0
    if not sys.argv[1:]: # No arguments
        err('usage: ' + sys.argv[0] + ' file-or-directory ...\n')
        sys.exit(2)
    for arg in sys.argv[1:]:
        if os.path.isdir(arg):
            if recursedown(arg): bad = 1
        elif os.path.islink(arg):
            err(arg + ': will not process symbolic links\n')
            bad = 1
        else:
            if fix(arg): bad = 1
    sys.exit(bad)

ispythonprog = re.compile('^[a-zA-Z0-9_]+\.py$')
def ispython(name):
    return ispythonprog.match(name) >= 0

def recursedown(dirname):
    dbg('recursedown(%r)\n' % (dirname,))
    bad = 0
    try:
        names = os.listdir(dirname)
    except os.error, msg:
        err('%s: cannot list directory: %r\n' % (dirname, msg))
        return 1
    names.sort()
    subdirs = []
    for name in names:
        if name in (os.curdir, os.pardir): continue
        fullname = os.path.join(dirname, name)
        if os.path.islink(fullname): pass
        elif os.path.isdir(fullname):
            subdirs.append(fullname)
        elif ispython(name):
            if fix(fullname): bad = 1
    for fullname in subdirs:
        if recursedown(fullname): bad = 1
    return bad

def fix(filename):
##  dbg('fix(%r)\n' % (filename,))
    try:
        f = open(filename, 'r')
    except IOError, msg:
        err('%s: cannot open: %r\n' % (filename, msg))
        return 1
    head, tail = os.path.split(filename)
    tempname = os.path.join(head, '@' + tail)
    g = None
    # If we find a match, we rewind the file and start over but
    # now copy everything to a temp file.
    lineno = 0
    while 1:
        line = f.readline()
        if not line: break
        lineno = lineno + 1
        while line[-2:] == '\\\n':
            nextline = f.readline()
            if not nextline: break
            line = line + nextline
            lineno = lineno + 1
        newline = fixline(line)
        if newline != line:
            if g is None:
                try:
                    g = open(tempname, 'w')
                except IOError, msg:
                    f.close()
                    err('%s: cannot create: %r\n' % (tempname, msg))
                    return 1
                f.seek(0)
                lineno = 0
                rep(filename + ':\n')
                continue # restart from the beginning
            rep(repr(lineno) + '\n')
            rep('< ' + line)
            rep('> ' + newline)
        if g is not None:
            g.write(newline)

    # End of file
    f.close()
    if not g: return 0 # No changes

    # Finishing touch -- move files

    # First copy the file's mode to the temp file
    try:
        statbuf = os.stat(filename)
        os.chmod(tempname, statbuf[ST_MODE] & 07777)
    except os.error, msg:
        err('%s: warning: chmod failed (%r)\n' % (tempname, msg))
    # Then make a backup of the original file as filename~
    try:
        os.rename(filename, filename + '~')
    except os.error, msg:
        err('%s: warning: backup failed (%r)\n' % (filename, msg))
    # Now move the temp file to the original file
    try:
        os.rename(tempname, filename)
    except os.error, msg:
        err('%s: rename failed (%r)\n' % (filename, msg))
        return 1
    # Return succes
    return 0

# This expression doesn't catch *all* class definition headers,
# but it's pretty darn close.
classexpr = '^([ \t]*class +[a-zA-Z0-9_]+) *( *) *((=.*)?):'
classprog = re.compile(classexpr)

# Expressions for finding base class expressions.
baseexpr = '^ *(.*) *( *) *$'
baseprog = re.compile(baseexpr)

def fixline(line):
    if classprog.match(line) < 0: # No 'class' keyword -- no change
        return line

    (a0, b0), (a1, b1), (a2, b2) = classprog.regs[:3]
    # a0, b0 = Whole match (up to ':')
    # a1, b1 = First subexpression (up to classname)
    # a2, b2 = Second subexpression (=.*)
    head = line[:b1]
    tail = line[b0:] # Unmatched rest of line

    if a2 == b2: # No base classes -- easy case
        return head + ':' + tail

    # Get rid of leading '='
    basepart = line[a2+1:b2]

    # Extract list of base expressions
    bases = basepart.split(',')

    # Strip trailing '()' from each base expression
    for i in range(len(bases)):
        if baseprog.match(bases[i]) >= 0:
            x1, y1 = baseprog.regs[1]
            bases[i] = bases[i][x1:y1]

    # Join the bases back again and build the new line
    basepart = ', '.join(bases)

    return head + '(' + basepart + '):' + tail

if __name__ == '__main__':
    main()
parseentities.py000075500000003267151732701430010013 0ustar00#! /usr/bin/python2.7
""" Utility for parsing HTML entity definitions available from:

      http://www.w3.org/ as e.g.
      http://www.w3.org/TR/REC-html40/HTMLlat1.ent

    Input is read from stdin, output is written to stdout in form of a
    Python snippet defining a dictionary "entitydefs" mapping literal
    entity name to character or numeric entity.

    Marc-Andre Lemburg, mal@lemburg.com, 1999.
    Use as you like. NO WARRANTIES.

"""
import re,sys
import TextTools

entityRE = re.compile('<!ENTITY +(\w+) +CDATA +"([^"]+)" +-- +((?:.|\n)+?) *-->')

def parse(text,pos=0,endpos=None):

    pos = 0
    if endpos is None:
        endpos = len(text)
    d = {}
    while 1:
        m = entityRE.search(text,pos,endpos)
        if not m:
            break
        name,charcode,comment = m.groups()
        d[name] = charcode,comment
        pos = m.end()
    return d

def writefile(f,defs):

    f.write("entitydefs = {\n")
    items = defs.items()
    items.sort()
    for name,(charcode,comment) in items:
        if charcode[:2] == '&#':
            code = int(charcode[2:-1])
            if code < 256:
                charcode = "'\%o'" % code
            else:
                charcode = repr(charcode)
        else:
            charcode = repr(charcode)
        comment = TextTools.collapse(comment)
        f.write("    '%s':\t%s,  \t# %s\n" % (name,charcode,comment))
    f.write('\n}\n')

if __name__ == '__main__':
    if len(sys.argv) > 1:
        infile = open(sys.argv[1])
    else:
        infile = sys.stdin
    if len(sys.argv) > 2:
        outfile = open(sys.argv[2],'w')
    else:
        outfile = sys.stdout
    text = infile.read()
    defs = parse(text)
    writefile(outfile,defs)
pickle2db.pyo000064400000007353151732701430007147 0ustar00�
�fc@sBdZddlZyddlZWnek
r;dZnXyddlZWnek
redZnXyddlZWnek
r�dZnXyddlZWnek
r�dZnXddlZyddl	Z
Wnek
r�ddl
Z
nXejdZd�Z
d�Zedkr>ejeejd��ndS(s,
Synopsis: %(prog)s [-h|-b|-g|-r|-a|-d] [ picklefile ] dbfile

Read the given picklefile as a series of key/value pairs and write to a new
database.  If the database already exists, any contents are deleted.  The
optional flags indicate the type of the output database:

    -a - open using anydbm
    -b - open as bsddb btree file
    -d - open as dbm file
    -g - open as gdbm file
    -h - open as bsddb hash file
    -r - open as bsddb recno file

The default is hash.  If a pickle file is named it is opened for read
access.  If no pickle file is named, the pickle input is read from standard
input.

Note that recno databases can only contain integer keys, so you can't dump a
hash or btree database using db2pickle.py and reconstitute it to a recno
database with %(prog)s unless your keys are integers.

i����NicCstjjtt��dS(N(tsyststderrtwritet__doc__tglobals(((s//usr/lib64/python2.7/Tools/scripts/pickle2db.pytusage4sc	Cs�y1tj|dddddddg�\}}Wntjk
rOt�dSXt|�d	kstt|�d
krt�dSt|�dkr�tj}|d	}nNyt|d	d�}Wn*tk
r�tjj	d|d	�dSX|d}d}x�|D]�\}}|d"krOy
tj}Wq�t
k
rKtjj	d�dSXq|d#kr�y
tj}Wq�t
k
r�tjj	d�dSXq|d$kr�y
tj}Wq�t
k
r�tjj	d�dSXq|d%kry
tj}Wq�t
k
rtjj	d�dSXq|d&krSy
tj}Wq�t
k
rOtjj	d�dSXq|d'kry
tj}Wq�t
k
r�tjj	d�dSXqqW|dkr�tdkr�tjj	d�tjj	d�dStj}ny||d�}Wn9tjk
r.tjj	d |�tjj	d!�dSXx|j�D]
}||=q<Wx<ytj|�\}	}
Wntk
r}PnX|
||	<qPW|j�|j�d	S((NthbrdagthashtbtreetrecnotdbmtanydbmtgdbmiiitrbsUnable to open %s
s-hs--hashsbsddb module unavailable.
s-bs--btrees-rs--recnos-as--anydbmsanydbm module unavailable.
s-gs--gdbmsgdbm module unavailable.
s-ds--dbmsdbm module unavailable.
sbsddb module unavailable - smust specify dbtype.
tcsUnable to open %s.  s&Check for format or version mismatch.
(s-hs--hash(s-bs--btree(s-rs--recno(s-as--anydbm(s-gs--gdbm(s-ds--dbm(tgetoptterrorRtlenRtstdintopentIOErrorRRtNonetbsddbthashopentAttributeErrortbtopentrnopenRRR
tkeystpickletloadtEOFErrortclose(targstoptstpfiletdbfiletdbopentopttargtdbtktkeytval((s//usr/lib64/python2.7/Tools/scripts/pickle2db.pytmain7s�$	

















t__main__i(RRRtImportErrorRR
RRRtcPickleRtargvtprogRR+t__name__texit(((s//usr/lib64/python2.7/Tools/scripts/pickle2db.pyt<module>s6









		[eqfix.py000075500000014246151733044200006243 0ustar00#! /usr/bin/python2.7

# Fix Python source files to use the new equality test operator, i.e.,
#       if x = y: ...
# is changed to
#       if x == y: ...
# The script correctly tokenizes the Python program to reliably
# distinguish between assignments and equality tests.
#
# Command line arguments are files or directories to be processed.
# Directories are searched recursively for files whose name looks
# like a python module.
# Symbolic links are always ignored (except as explicit directory
# arguments).  Of course, the original file is kept as a back-up
# (with a "~" attached to its name).
# It complains about binaries (files containing null bytes)
# and about files that are ostensibly not Python files: if the first
# line starts with '#!' and does not contain the string 'python'.
#
# Changes made are reported to stdout in a diff-like format.
#
# Undoubtedly you can do this using find and sed or perl, but this is
# a nice example of Python code that recurses down a directory tree
# and uses regular expressions.  Also note several subtleties like
# preserving the file's mode and avoiding to even write a temp file
# when no changes are needed for a file.
#
# NB: by changing only the function fixline() you can turn this
# into a program for a different change to Python programs...

import sys
import re
import os
from stat import *
import string

err = sys.stderr.write
dbg = err
rep = sys.stdout.write

def main():
    bad = 0
    if not sys.argv[1:]: # No arguments
        err('usage: ' + sys.argv[0] + ' file-or-directory ...\n')
        sys.exit(2)
    for arg in sys.argv[1:]:
        if os.path.isdir(arg):
            if recursedown(arg): bad = 1
        elif os.path.islink(arg):
            err(arg + ': will not process symbolic links\n')
            bad = 1
        else:
            if fix(arg): bad = 1
    sys.exit(bad)

ispythonprog = re.compile('^[a-zA-Z0-9_]+\.py$')
def ispython(name):
    return ispythonprog.match(name) >= 0

def recursedown(dirname):
    dbg('recursedown(%r)\n' % (dirname,))
    bad = 0
    try:
        names = os.listdir(dirname)
    except os.error, msg:
        err('%s: cannot list directory: %r\n' % (dirname, msg))
        return 1
    names.sort()
    subdirs = []
    for name in names:
        if name in (os.curdir, os.pardir): continue
        fullname = os.path.join(dirname, name)
        if os.path.islink(fullname): pass
        elif os.path.isdir(fullname):
            subdirs.append(fullname)
        elif ispython(name):
            if fix(fullname): bad = 1
    for fullname in subdirs:
        if recursedown(fullname): bad = 1
    return bad

def fix(filename):
##      dbg('fix(%r)\n' % (dirname,))
    try:
        f = open(filename, 'r')
    except IOError, msg:
        err('%s: cannot open: %r\n' % (filename, msg))
        return 1
    head, tail = os.path.split(filename)
    tempname = os.path.join(head, '@' + tail)
    g = None
    # If we find a match, we rewind the file and start over but
    # now copy everything to a temp file.
    lineno = 0
    while 1:
        line = f.readline()
        if not line: break
        lineno = lineno + 1
        if g is None and '\0' in line:
            # Check for binary files
            err(filename + ': contains null bytes; not fixed\n')
            f.close()
            return 1
        if lineno == 1 and g is None and line[:2] == '#!':
            # Check for non-Python scripts
            words = string.split(line[2:])
            if words and re.search('[pP]ython', words[0]) < 0:
                msg = filename + ': ' + words[0]
                msg = msg + ' script; not fixed\n'
                err(msg)
                f.close()
                return 1
        while line[-2:] == '\\\n':
            nextline = f.readline()
            if not nextline: break
            line = line + nextline
            lineno = lineno + 1
        newline = fixline(line)
        if newline != line:
            if g is None:
                try:
                    g = open(tempname, 'w')
                except IOError, msg:
                    f.close()
                    err('%s: cannot create: %r\n' % (tempname, msg))
                    return 1
                f.seek(0)
                lineno = 0
                rep(filename + ':\n')
                continue # restart from the beginning
            rep(repr(lineno) + '\n')
            rep('< ' + line)
            rep('> ' + newline)
        if g is not None:
            g.write(newline)

    # End of file
    f.close()
    if not g: return 0 # No changes

    # Finishing touch -- move files

    # First copy the file's mode to the temp file
    try:
        statbuf = os.stat(filename)
        os.chmod(tempname, statbuf[ST_MODE] & 07777)
    except os.error, msg:
        err('%s: warning: chmod failed (%r)\n' % (tempname, msg))
    # Then make a backup of the original file as filename~
    try:
        os.rename(filename, filename + '~')
    except os.error, msg:
        err('%s: warning: backup failed (%r)\n' % (filename, msg))
    # Now move the temp file to the original file
    try:
        os.rename(tempname, filename)
    except os.error, msg:
        err('%s: rename failed (%r)\n' % (filename, msg))
        return 1
    # Return succes
    return 0


from tokenize import tokenprog

match = {'if':':', 'elif':':', 'while':':', 'return':'\n', \
         '(':')', '[':']', '{':'}', '`':'`'}

def fixline(line):
    # Quick check for easy case
    if '=' not in line: return line

    i, n = 0, len(line)
    stack = []
    while i < n:
        j = tokenprog.match(line, i)
        if j < 0:
            # A bad token; forget about the rest of this line
            print '(Syntax error:)'
            print line,
            return line
        a, b = tokenprog.regs[3] # Location of the token proper
        token = line[a:b]
        i = i+j
        if stack and token == stack[-1]:
            del stack[-1]
        elif match.has_key(token):
            stack.append(match[token])
        elif token == '=' and stack:
            line = line[:a] + '==' + line[b:]
            i, n = a + len('=='), len(line)
        elif token == '==' and not stack:
            print '(Warning: \'==\' at top level:)'
            print line,
    return line

if __name__ == "__main__":
    main()
README000064400000001761151733044200005430 0ustar00This directory contains a collection of executable Python scripts.

See also the Tools/scripts directory!

beer.py			Print the classic 'bottles of beer' list
eqfix.py		Fix .py files to use the correct equality test operator
fact.py			Factorize numbers
find-uname.py		Search for Unicode characters using regexps
from.py			Summarize mailbox
lpwatch.py		Watch BSD line printer queues
makedir.py		Like mkdir -p
markov.py		Markov chain simulation of words or characters
mboxconvert.py		Convert MH or MMDF mailboxes to unix mailbox format
morse.py		Produce morse code (audible or on AIFF file)
newslist.py		List all newsgroups on a NNTP server as HTML pages
pi.py			Print all digits of pi -- given enough time and memory
pp.py			Emulate some Perl command line options
primes.py		Print prime numbers
queens.py		Dijkstra's solution to Wirth's "N Queens problem"
script.py		Equivalent to BSD script(1) -- by Steen Lumholt
unbirthday.py		Print unbirthday count
update.py		Update a bunch of files according to a script.
lpwatch.pyo000064400000005055151733044200006743 0ustar00�
Afc@stddlZddlZddlZdZdZd�Zd�Zedkrpye�Wqpek
rlqpXndS(i����Ntpsci
cCst}ytjd}Wntjd}nXtjd}|r�xlt|�D]-\}}|d dkrN|d||<qNqNWn.tjjd�r�tjdg}n	tg}tjdd�j	�}xJt
r|}x%|D]}|t||�d	7}q�W|GHtj
|�q�WdS(
NtLOGNAMEtUSERiis-PtPRINTERtcleartrs
(t	DEF_DELAYtostenvirontsystargvt	enumeratethas_keytDEF_PRINTERtpopentreadtTruet
makestatusttimetsleep(tdelaytthisusertprinterstitnamet	clearhomettext((s,/usr/lib64/python2.7/Demo/scripts/lpwatch.pytmain
s(
		
cCs�tjd|dd�}g}i}d}d}t}d}d}	xl|D]d}
|
j�}t|�}t|�dkrK||ddkrK|dd!\}
}}|dd	!}t||d
�}||kr�t}n|s�||7}|d7}n||7}|	d7}	|j|d�\}}|d7}||7}||f||<qK|rK|ddkrK|
j�}
|
dkr�|d
}
n|
ddkr�|}
n|j	|
�qKqKW|	r�d|dd}
|	t|�kr�|
d|	7}
nt|�dkr|
d|j
�df7}
nV|
dt|�7}
|rt|dkrU|
d|7}
qt|
d|dd|f7}
n|j	|
�n|j�}|r�|j	d|f�ndj|�S(Nslpq -Ps 2>&1Riiitbytesii����itRanks
no entriess: idlei��s is ready and printings%d Ki�is
 (%d jobs)s for %ss
 for %d userss (%s first)s (%d K before %s)slpq exit status %rs: (ii(
RRtFalsetsplittlentintRtgettstriptappendtkeystclosetjoin(RRtpipetlinestuserst
aheadbytest	aheadjobstuserseent
totalbytest	totaljobstlinetfieldstntranktusertjobtfilesRtujobstubyteststs((s,/usr/lib64/python2.7/Demo/scripts/lpwatch.pyR)sd
&
	






	t__main__(	RR	RR
RRRt__name__tKeyboardInterrupt(((s,/usr/lib64/python2.7/Demo/scripts/lpwatch.pyt<module>s		9
update.py000075500000005275151733044200006413 0ustar00#! /usr/bin/python2.7

# Update a bunch of files according to a script.
# The input file contains lines of the form <filename>:<lineno>:<text>,
# meaning that the given line of the given file is to be replaced
# by the given text.  This is useful for performing global substitutions
# on grep output:

import os
import sys
import re

pat = '^([^: \t\n]+):([1-9][0-9]*):'
prog = re.compile(pat)

class FileObj:
    def __init__(self, filename):
        self.filename = filename
        self.changed = 0
        try:
            self.lines = open(filename, 'r').readlines()
        except IOError, msg:
            print '*** Can\'t open "%s":' % filename, msg
            self.lines = None
            return
        print 'diffing', self.filename

    def finish(self):
        if not self.changed:
            print 'no changes to', self.filename
            return
        try:
            os.rename(self.filename, self.filename + '~')
            fp = open(self.filename, 'w')
        except (os.error, IOError), msg:
            print '*** Can\'t rewrite "%s":' % self.filename, msg
            return
        print 'writing', self.filename
        for line in self.lines:
            fp.write(line)
        fp.close()
        self.changed = 0

    def process(self, lineno, rest):
        if self.lines is None:
            print '(not processed): %s:%s:%s' % (
                      self.filename, lineno, rest),
            return
        i = eval(lineno) - 1
        if not 0 <= i < len(self.lines):
            print '*** Line number out of range: %s:%s:%s' % (
                      self.filename, lineno, rest),
            return
        if self.lines[i] == rest:
            print '(no change): %s:%s:%s' % (
                      self.filename, lineno, rest),
            return
        if not self.changed:
            self.changed = 1
        print '%sc%s' % (lineno, lineno)
        print '<', self.lines[i],
        print '---'
        self.lines[i] = rest
        print '>', self.lines[i],

def main():
    if sys.argv[1:]:
        try:
            fp = open(sys.argv[1], 'r')
        except IOError, msg:
            print 'Can\'t open "%s":' % sys.argv[1], msg
            sys.exit(1)
    else:
        fp = sys.stdin
    curfile = None
    while 1:
        line = fp.readline()
        if not line:
            if curfile: curfile.finish()
            break
        n = prog.match(line)
        if n < 0:
            print 'Funny line:', line,
            continue
        filename, lineno = prog.group(1, 2)
        if not curfile or filename <> curfile.filename:
            if curfile: curfile.finish()
            curfile = FileObj(filename)
        curfile.process(lineno, line[n:])

if __name__ == "__main__":
    main()
eqfix.pyc000064400000011032151733044200006371 0ustar00�
Afc@s�ddlZddlZddlZddlTddlZejjZeZej	jZ
d�Zejd�Z
d�Zd�Zd�ZddlmZid	d
6d	d6d	d6d
d6dd6dd6dd6dd6Zd�Zedkr�e�ndS(i����N(t*cCs�d}tjds<tdtjdd�tjd�nx}tjdD]n}tjj|�rzt|�r�d}q�qJtjj|�r�t|d�d}qJt	|�rJd}qJqJWtj|�dS(Niisusage: s file-or-directory ...
is": will not process symbolic links
(
tsystargvterrtexittostpathtisdirtrecursedowntislinktfix(tbadtarg((s*/usr/lib64/python2.7/Demo/scripts/eqfix.pytmain)s
	
s^[a-zA-Z0-9_]+\.py$cCstj|�dkS(Ni(tispythonprogtmatch(tname((s*/usr/lib64/python2.7/Demo/scripts/eqfix.pytispython9scCs1td|f�d}ytj|�}Wn+tjk
rW}td||f�dSX|j�g}x�|D]�}|tjtjfkr�qontjj	||�}tjj
|�r�qotjj|�r�|j|�qot
|�rot|�rd}qqoqoWx#|D]}t|�rd}qqW|S(Nsrecursedown(%r)
is%s: cannot list directory: %r
i(tdbgRtlistdirterrorRtsorttcurdirtpardirRtjoinR	RtappendRR
R(tdirnameRtnamestmsgtsubdirsRtfullname((s*/usr/lib64/python2.7/Demo/scripts/eqfix.pyR<s0



c
Cs�yt|d�}Wn(tk
r=}td||f�dSXtjj|�\}}tjj|d|�}d}d}x|j�}|s�Pn|d}|dkr�d|kr�t|d�|j	�dS|dkrf|dkrf|d d	krft
j|d�}	|	rftjd
|	d�dkrf|d|	d}|d}t|�|j	�dSnx>|d
dkr�|j�}
|
s�Pn||
}|d}qiWt
|�}||krm|dkr:yt|d�}Wn2tk
r}|j	�td||f�dSX|jd�d}t|d�q~ntt|�d�td|�td|�n|dk	r~|j|�q~q~W|j	�|s�dSy+tj|�}tj||td@�Wn*tjk
r�}td||f�nXytj||d�Wn*tjk
r=}td||f�nXytj||�Wn+tjk
r}td||f�dSXdS(Ntrs%s: cannot open: %r
it@iss!: contains null bytes; not fixed
is#!s	[pP]ythons: s script; not fixed
i����s\
tws%s: cannot create: %r
s:
s
s< s> i�s%s: warning: chmod failed (%r)
t~s %s: warning: backup failed (%r)
s%s: rename failed (%r)
(topentIOErrorRRRtsplitRtNonetreadlinetclosetstringtretsearchtfixlinetseektreptreprtwritetstattchmodtST_MODERtrename(
tfilenametfRtheadttailttempnametgtlinenotlinetwordstnextlinetnewlinetstatbuf((s*/usr/lib64/python2.7/Demo/scripts/eqfix.pyR
Rs�

("






(t	tokenprogt:tifteliftwhiles
treturnt)t(t]t[t}t{t`cCs?d|kr|Sdt|�}}g}x||kr:tj||�}|dkrcdGH|G|Stjd\}}|||!}||}|r�||dkr�|d=q,tj|�r�|jt|�q,|dkr|r|| d||}|td�t|�}}q,|dkr,|r,dGH|Gq,q,W|S(Nt=is(Syntax error:)ii����s==s(Warning: '==' at top level:)(tlenRARtregsthas_keyR(R<titntstacktjtatbttoken((s*/usr/lib64/python2.7/Demo/scripts/eqfix.pyR,�s0


 t__main__(RR*RR1R)tstderrR0RRtstdoutR.R
tcompileRRRR
ttokenizeRARR,t__name__(((s*/usr/lib64/python2.7/Demo/scripts/eqfix.pyt<module>s$
				R	find-uname.pyc000064400000002746151733044200007314 0ustar00�
Afc@sWdZddlZddlZddlZd�ZedkrSeejd�ndS(s)
For each argument on the command line, look for it in the set of all Unicode
names.  Arguments are treated as case-insensitive regular expressions, e.g.:

    % find-uname 'small letter a$' 'horizontal line'
    *** small letter a$ matches ***
    LATIN SMALL LETTER A (97)
    COMBINING LATIN SMALL LETTER A (867)
    CYRILLIC SMALL LETTER A (1072)
    PARENTHESIZED LATIN SMALL LETTER A (9372)
    CIRCLED LATIN SMALL LETTER A (9424)
    FULLWIDTH LATIN SMALL LETTER A (65345)
    *** horizontal line matches ***
    HORIZONTAL LINE EXTENSION (9135)
i����Nc	Cs�g}xUttjd�D]@}y&|j|tjt|��f�Wqtk
rYqXqWx�|D]�}tj	|tj
�}g|D]-\}}|j|�dk	r�||f^q�}|redG|GdGdGHx|D]}d|GHq�WqeqeWdS(Nis***tmatchess%s (%d)(
trangetsyst
maxunicodetappendtunicodedatatnametunichrt
ValueErrortretcompiletItsearchtNone(	targst
unicode_namestixtargtpattxtyRtmatch((s//usr/lib64/python2.7/Demo/scripts/find-uname.pytmains&

'
t__main__i(t__doc__RRR	Rt__name__targv(((s//usr/lib64/python2.7/Demo/scripts/find-uname.pyt<module>s	markov.py000075500000007005151733044200006421 0ustar00#! /usr/bin/python2.7

class Markov:
    def __init__(self, histsize, choice):
        self.histsize = histsize
        self.choice = choice
        self.trans = {}

    def add(self, state, next):
        self.trans.setdefault(state, []).append(next)

    def put(self, seq):
        n = self.histsize
        add = self.add
        add(None, seq[:0])
        for i in range(len(seq)):
            add(seq[max(0, i-n):i], seq[i:i+1])
        add(seq[len(seq)-n:], None)

    def get(self):
        choice = self.choice
        trans = self.trans
        n = self.histsize
        seq = choice(trans[None])
        while True:
            subseq = seq[max(0, len(seq)-n):]
            options = trans[subseq]
            next = choice(options)
            if not next:
                break
            seq += next
        return seq


def test():
    import sys, random, getopt
    args = sys.argv[1:]
    try:
        opts, args = getopt.getopt(args, '0123456789cdwq')
    except getopt.error:
        print 'Usage: %s [-#] [-cddqw] [file] ...' % sys.argv[0]
        print 'Options:'
        print '-#: 1-digit history size (default 2)'
        print '-c: characters (default)'
        print '-w: words'
        print '-d: more debugging output'
        print '-q: no debugging output'
        print 'Input files (default stdin) are split in paragraphs'
        print 'separated blank lines and each paragraph is split'
        print 'in words by whitespace, then reconcatenated with'
        print 'exactly one space separating words.'
        print 'Output consists of paragraphs separated by blank'
        print 'lines, where lines are no longer than 72 characters.'
        sys.exit(2)
    histsize = 2
    do_words = False
    debug = 1
    for o, a in opts:
        if '-0' <= o <= '-9': histsize = int(o[1:])
        if o == '-c': do_words = False
        if o == '-d': debug += 1
        if o == '-q': debug = 0
        if o == '-w': do_words = True
    if not args:
        args = ['-']

    m = Markov(histsize, random.choice)
    try:
        for filename in args:
            if filename == '-':
                f = sys.stdin
                if f.isatty():
                    print 'Sorry, need stdin from file'
                    continue
            else:
                f = open(filename, 'r')
            if debug: print 'processing', filename, '...'
            text = f.read()
            f.close()
            paralist = text.split('\n\n')
            for para in paralist:
                if debug > 1: print 'feeding ...'
                words = para.split()
                if words:
                    if do_words:
                        data = tuple(words)
                    else:
                        data = ' '.join(words)
                    m.put(data)
    except KeyboardInterrupt:
        print 'Interrupted -- continue with data read so far'
    if not m.trans:
        print 'No valid input files'
        return
    if debug: print 'done.'

    if debug > 1:
        for key in m.trans.keys():
            if key is None or len(key) < histsize:
                print repr(key), m.trans[key]
        if histsize == 0: print repr(''), m.trans['']
        print
    while True:
        data = m.get()
        if do_words:
            words = data
        else:
            words = data.split()
        n = 0
        limit = 72
        for w in words:
            if n + len(w) > limit:
                print
                n = 0
            print w,
            n += len(w) + 1
        print
        print

if __name__ == "__main__":
    test()
find-uname.py000075500000002267151733044200007152 0ustar00#! /usr/bin/python2.7

"""
For each argument on the command line, look for it in the set of all Unicode
names.  Arguments are treated as case-insensitive regular expressions, e.g.:

    % find-uname 'small letter a$' 'horizontal line'
    *** small letter a$ matches ***
    LATIN SMALL LETTER A (97)
    COMBINING LATIN SMALL LETTER A (867)
    CYRILLIC SMALL LETTER A (1072)
    PARENTHESIZED LATIN SMALL LETTER A (9372)
    CIRCLED LATIN SMALL LETTER A (9424)
    FULLWIDTH LATIN SMALL LETTER A (65345)
    *** horizontal line matches ***
    HORIZONTAL LINE EXTENSION (9135)
"""

import unicodedata
import sys
import re

def main(args):
    unicode_names = []
    for ix in range(sys.maxunicode+1):
        try:
            unicode_names.append((ix, unicodedata.name(unichr(ix))))
        except ValueError: # no name for the character
            pass
    for arg in args:
        pat = re.compile(arg, re.I)
        matches = [(y,x) for (x,y) in unicode_names
                   if pat.search(y) is not None]
        if matches:
            print "***", arg, "matches", "***"
            for match in matches:
                print "%s (%d)" % match

if __name__ == "__main__":
    main(sys.argv[1:])
unbirthday.py000075500000006103151733044200007271 0ustar00#! /usr/bin/python2.7

# Calculate your unbirthday count (see Alice in Wonderland).
# This is defined as the number of days from your birth until today
# that weren't your birthday.  (The day you were born is not counted).
# Leap years make it interesting.

import sys
import time
import calendar

def main():
    if sys.argv[1:]:
        year = int(sys.argv[1])
    else:
        year = int(raw_input('In which year were you born? '))
    if 0 <= year < 100:
        print "I'll assume that by", year,
        year = year + 1900
        print 'you mean', year, 'and not the early Christian era'
    elif not (1850 <= year <= time.localtime()[0]):
        print "It's hard to believe you were born in", year
        return

    if sys.argv[2:]:
        month = int(sys.argv[2])
    else:
        month = int(raw_input('And in which month? (1-12) '))
    if not (1 <= month <= 12):
        print 'There is no month numbered', month
        return

    if sys.argv[3:]:
        day = int(sys.argv[3])
    else:
        day = int(raw_input('And on what day of that month? (1-31) '))
    if month == 2 and calendar.isleap(year):
        maxday = 29
    else:
        maxday = calendar.mdays[month]
    if not (1 <= day <= maxday):
        print 'There are no', day, 'days in that month!'
        return

    bdaytuple = (year, month, day)
    bdaydate = mkdate(bdaytuple)
    print 'You were born on', format(bdaytuple)

    todaytuple = time.localtime()[:3]
    todaydate = mkdate(todaytuple)
    print 'Today is', format(todaytuple)

    if bdaytuple > todaytuple:
        print 'You are a time traveler.  Go back to the future!'
        return

    if bdaytuple == todaytuple:
        print 'You were born today.  Have a nice life!'
        return

    days = todaydate - bdaydate
    print 'You have lived', days, 'days'

    age = 0
    for y in range(year, todaytuple[0] + 1):
        if bdaytuple < (y, month, day) <= todaytuple:
            age = age + 1

    print 'You are', age, 'years old'

    if todaytuple[1:] == bdaytuple[1:]:
        print 'Congratulations!  Today is your', nth(age), 'birthday'
        print 'Yesterday was your',
    else:
        print 'Today is your',
    print nth(days - age), 'unbirthday'

def format((year, month, day)):
    return '%d %s %d' % (day, calendar.month_name[month], year)

def nth(n):
    if n == 1: return '1st'
    if n == 2: return '2nd'
    if n == 3: return '3rd'
    return '%dth' % n

def mkdate((year, month, day)):
    # January 1st, in 0 A.D. is arbitrarily defined to be day 1,
    # even though that day never actually existed and the calendar
    # was different then...
    days = year*365                  # years, roughly
    days = days + (year+3)//4        # plus leap years, roughly
    days = days - (year+99)//100     # minus non-leap years every century
    days = days + (year+399)//400    # plus leap years every 4 centirues
    for i in range(1, month):
        if i == 2 and calendar.isleap(year):
            days = days + 29
        else:
            days = days + calendar.mdays[i]
    days = days + day
    return days

if __name__ == "__main__":
    main()
lpwatch.py000075500000005425151733044200006570 0ustar00#! /usr/bin/python2.7

# Watch line printer queue(s).
# Intended for BSD 4.3 lpq.

import os
import sys
import time

DEF_PRINTER = 'psc'
DEF_DELAY = 10

def main():
    delay = DEF_DELAY # XXX Use getopt() later
    try:
        thisuser = os.environ['LOGNAME']
    except:
        thisuser = os.environ['USER']
    printers = sys.argv[1:]
    if printers:
        # Strip '-P' from printer names just in case
        # the user specified it...
        for i, name in enumerate(printers):
            if name[:2] == '-P':
                printers[i] = name[2:]
    else:
        if os.environ.has_key('PRINTER'):
            printers = [os.environ['PRINTER']]
        else:
            printers = [DEF_PRINTER]

    clearhome = os.popen('clear', 'r').read()

    while True:
        text = clearhome
        for name in printers:
            text += makestatus(name, thisuser) + '\n'
        print text
        time.sleep(delay)

def makestatus(name, thisuser):
    pipe = os.popen('lpq -P' + name + ' 2>&1', 'r')
    lines = []
    users = {}
    aheadbytes = 0
    aheadjobs = 0
    userseen = False
    totalbytes = 0
    totaljobs = 0
    for line in pipe:
        fields = line.split()
        n = len(fields)
        if len(fields) >= 6 and fields[n-1] == 'bytes':
            rank, user, job = fields[0:3]
            files = fields[3:-2]
            bytes = int(fields[n-2])
            if user == thisuser:
                userseen = True
            elif not userseen:
                aheadbytes += bytes
                aheadjobs += 1
            totalbytes += bytes
            totaljobs += 1
            ujobs, ubytes = users.get(user, (0, 0))
            ujobs += 1
            ubytes += bytes
            users[user] = ujobs, ubytes
        else:
            if fields and fields[0] != 'Rank':
                line = line.strip()
                if line == 'no entries':
                    line = name + ': idle'
                elif line[-22:] == ' is ready and printing':
                    line = name
                lines.append(line)

    if totaljobs:
        line = '%d K' % ((totalbytes+1023) // 1024)
        if totaljobs != len(users):
            line += ' (%d jobs)' % totaljobs
        if len(users) == 1:
            line += ' for %s' % (users.keys()[0],)
        else:
            line += ' for %d users' % len(users)
            if userseen:
                if aheadjobs == 0:
                    line += ' (%s first)' % thisuser
                else:
                    line += ' (%d K before %s)' % (
                        (aheadbytes+1023) // 1024, thisuser)
        lines.append(line)

    sts = pipe.close()
    if sts:
        lines.append('lpq exit status %r' % (sts,))
    return ': '.join(lines)

if __name__ == "__main__":
    try:
        main()
    except KeyboardInterrupt:
        pass
makedir.pyo000064400000001334151733044200006711 0ustar00�
Afc@sDddlZddlZd�Zd�Zedkr@e�ndS(i����NcCs&xtjdD]}t|�qWdS(Ni(tsystargvtmakedirs(tp((s,/usr/lib64/python2.7/Demo/scripts/makedir.pytmain
scCsR|rNtjj|�rNtjj|�\}}t|�tj|d�ndS(Ni�(tostpathtisdirtsplitRtmkdir(Rtheadttail((s,/usr/lib64/python2.7/Demo/scripts/makedir.pyRs
t__main__(RRRRt__name__(((s,/usr/lib64/python2.7/Demo/scripts/makedir.pyt<module>s		primes.py000075500000001132151733044200006414 0ustar00#! /usr/bin/python2.7

# Print prime numbers in a given range

def primes(min, max):
    if max >= 2 >= min:
        print 2
    primes = [2]
    i = 3
    while i <= max:
        for p in primes:
            if i % p == 0 or p*p > i:
                break
        if i % p != 0:
            primes.append(i)
            if i >= min:
                print i
        i += 2

def main():
    import sys
    min, max = 2, 0x7fffffff
    if sys.argv[1:]:
        min = int(sys.argv[1])
        if sys.argv[2:]:
            max = int(sys.argv[2])
    primes(min, max)

if __name__ == "__main__":
    main()
fact.pyo000064400000002217151733044200006213 0ustar00�
Afc@sHddlZddlmZd�Zd�ZedkrDe�ndS(i����N(tsqrtcCs�|dkrtd��n|dkr+gSg}x+|ddkr^|jd�|d}q4Wt|d�}d}xT||kr�||dkr�|j|�||}t|d�}qx|d7}qxW|dkr�|j|�n|S(Nisfact() argument should be >= 1iii(t
ValueErrortappendR(tntrestlimitti((s)/usr/lib64/python2.7/Demo/scripts/fact.pytfacts&


cCs�ttj�dkr%tjd}nttd�}xJ|D]B}yt|�}Wntk
rm|GdGHq;X|Gt|�GHq;WdS(Nitsis not an integer(tlentsystargvtitert	raw_inputtintRR(tsourcetargR((s)/usr/lib64/python2.7/Demo/scripts/fact.pytmain#s


t__main__(R
tmathRRRt__name__(((s)/usr/lib64/python2.7/Demo/scripts/fact.pyt<module>s
		
primes.pyo000064400000001631151733044200006574 0ustar00�
Afc@s,d�Zd�Zedkr(e�ndS(cCs�|dko|knr$dGHndg}d}x�||kr�x2|D]*}||dkso|||krIPqIqIW||dkr�|j|�||kr�|GHq�n|d7}q6WdS(Niii(tappend(tmintmaxtprimestitp((s+/usr/lib64/python2.7/Demo/scripts/primes.pyRs	
 
cCsoddl}d\}}|jdr^t|jd�}|jdr^t|jd�}q^nt||�dS(Ni����ii���i(ii���(tsystargvtintR(RRR((s+/usr/lib64/python2.7/Demo/scripts/primes.pytmains

t__main__N(RR	t__name__(((s+/usr/lib64/python2.7/Demo/scripts/primes.pyt<module>s			pi.py000075500000001567151733044200005541 0ustar00#! /usr/bin/python2.7

# Print digits of pi forever.
#
# The algorithm, using Python's 'long' integers ("bignums"), works
# with continued fractions, and was conceived by Lambert Meertens.
#
# See also the ABC Programmer's Handbook, by Geurts, Meertens & Pemberton,
# published by Prentice-Hall (UK) Ltd., 1990.

import sys

def main():
    k, a, b, a1, b1 = 2, 4, 1, 12, 4
    while True:
        # Next approximation
        p, q, k = k*k, 2*k+1, k+1
        a, b, a1, b1 = a1, b1, p*a+q*a1, p*b+q*b1
        # Print common digits
        d, d1 = a//b, a1//b1
        while d == d1:
            output(d)
            a, a1 = 10*(a%b), 10*(a1%b1)
            d, d1 = a//b, a1//b1

def output(d):
    # Use write() to avoid spaces between the digits
    sys.stdout.write(str(d))
    # Flush so the output is seen immediately
    sys.stdout.flush()

if __name__ == "__main__":
    main()
queens.pyc000064400000005720151733044210006565 0ustar00�
Afc@sBdZdZddd��YZd�Zedkr>e�ndS(s�N queens problem.

The (well-known) problem is due to Niklaus Wirth.

This solution is inspired by Dijkstra (Structured Programming).  It is
a classic recursive backtracking approach.

itQueenscBsSeZed�Zd�Zdd�Zd�Zd�Zd�ZdZ	d�Z
RS(cCs||_|j�dS(N(tntreset(tselfR((s+/usr/lib64/python2.7/Demo/scripts/queens.pyt__init__s	cCsf|j}dg||_dg||_dgd|d|_dgd|d|_d|_dS(Niii(RtNonetytrowtuptdowntnfound(RR((s+/usr/lib64/python2.7/Demo/scripts/queens.pyRs	icCs�x}t|j�D]l}|j||�r|j||�|d|jkrX|j�n|j|d�|j||�qqWdS(Ni(trangeRtsafetplacetdisplaytsolvetremove(RtxR((s+/usr/lib64/python2.7/Demo/scripts/queens.pyRs
cCs0|j|o/|j||o/|j||S(N(RRR	(RRR((s+/usr/lib64/python2.7/Demo/scripts/queens.pyR&scCs@||j|<d|j|<d|j||<d|j||<dS(Ni(RRRR	(RRR((s+/usr/lib64/python2.7/Demo/scripts/queens.pyR
)s

cCs@d|j|<d|j|<d|j||<d|j||<dS(Ni(RRRRR	(RRR((s+/usr/lib64/python2.7/Demo/scripts/queens.pyR/s

cCs�|jd|_|jrdSdd|jdGHxbt|jddd�D]G}dGx5t|j�D]$}|j||kr�dGqedGqeWdGHqKWdd|jdGHdS(	Nis+-s--t+i����t|tQt.(R
tsilentRRR(RRR((s+/usr/lib64/python2.7/Demo/scripts/queens.pyR7s	 	(t__name__t
__module__tNRRRRR
RRR(((s+/usr/lib64/python2.7/Demo/scripts/queens.pyRs	
			cCs�ddl}d}t}|jdd!dgkrDd}|jd=n|jdrgt|jd�}nt|�}||_|j�dG|jGdGHdS(Ni����iiis-ntFounds
solutions.(tsysRtargvtintRRRR
(RRRtq((s+/usr/lib64/python2.7/Demo/scripts/queens.pytmainFs

	
t__main__N((t__doc__RRRR(((s+/usr/lib64/python2.7/Demo/scripts/queens.pyt<module>
s
8	eqfix.pyo000064400000011032151733044210006406 0ustar00�
Afc@s�ddlZddlZddlZddlTddlZejjZeZej	jZ
d�Zejd�Z
d�Zd�Zd�ZddlmZid	d
6d	d6d	d6d
d6dd6dd6dd6dd6Zd�Zedkr�e�ndS(i����N(t*cCs�d}tjds<tdtjdd�tjd�nx}tjdD]n}tjj|�rzt|�r�d}q�qJtjj|�r�t|d�d}qJt	|�rJd}qJqJWtj|�dS(Niisusage: s file-or-directory ...
is": will not process symbolic links
(
tsystargvterrtexittostpathtisdirtrecursedowntislinktfix(tbadtarg((s*/usr/lib64/python2.7/Demo/scripts/eqfix.pytmain)s
	
s^[a-zA-Z0-9_]+\.py$cCstj|�dkS(Ni(tispythonprogtmatch(tname((s*/usr/lib64/python2.7/Demo/scripts/eqfix.pytispython9scCs1td|f�d}ytj|�}Wn+tjk
rW}td||f�dSX|j�g}x�|D]�}|tjtjfkr�qontjj	||�}tjj
|�r�qotjj|�r�|j|�qot
|�rot|�rd}qqoqoWx#|D]}t|�rd}qqW|S(Nsrecursedown(%r)
is%s: cannot list directory: %r
i(tdbgRtlistdirterrorRtsorttcurdirtpardirRtjoinR	RtappendRR
R(tdirnameRtnamestmsgtsubdirsRtfullname((s*/usr/lib64/python2.7/Demo/scripts/eqfix.pyR<s0



c
Cs�yt|d�}Wn(tk
r=}td||f�dSXtjj|�\}}tjj|d|�}d}d}x|j�}|s�Pn|d}|dkr�d|kr�t|d�|j	�dS|dkrf|dkrf|d d	krft
j|d�}	|	rftjd
|	d�dkrf|d|	d}|d}t|�|j	�dSnx>|d
dkr�|j�}
|
s�Pn||
}|d}qiWt
|�}||krm|dkr:yt|d�}Wn2tk
r}|j	�td||f�dSX|jd�d}t|d�q~ntt|�d�td|�td|�n|dk	r~|j|�q~q~W|j	�|s�dSy+tj|�}tj||td@�Wn*tjk
r�}td||f�nXytj||d�Wn*tjk
r=}td||f�nXytj||�Wn+tjk
r}td||f�dSXdS(Ntrs%s: cannot open: %r
it@iss!: contains null bytes; not fixed
is#!s	[pP]ythons: s script; not fixed
i����s\
tws%s: cannot create: %r
s:
s
s< s> i�s%s: warning: chmod failed (%r)
t~s %s: warning: backup failed (%r)
s%s: rename failed (%r)
(topentIOErrorRRRtsplitRtNonetreadlinetclosetstringtretsearchtfixlinetseektreptreprtwritetstattchmodtST_MODERtrename(
tfilenametfRtheadttailttempnametgtlinenotlinetwordstnextlinetnewlinetstatbuf((s*/usr/lib64/python2.7/Demo/scripts/eqfix.pyR
Rs�

("






(t	tokenprogt:tifteliftwhiles
treturnt)t(t]t[t}t{t`cCs?d|kr|Sdt|�}}g}x||kr:tj||�}|dkrcdGH|G|Stjd\}}|||!}||}|r�||dkr�|d=q,tj|�r�|jt|�q,|dkr|r|| d||}|td�t|�}}q,|dkr,|r,dGH|Gq,q,W|S(Nt=is(Syntax error:)ii����s==s(Warning: '==' at top level:)(tlenRARtregsthas_keyR(R<titntstacktjtatbttoken((s*/usr/lib64/python2.7/Demo/scripts/eqfix.pyR,�s0


 t__main__(RR*RR1R)tstderrR0RRtstdoutR.R
tcompileRRRR
ttokenizeRARR,t__name__(((s*/usr/lib64/python2.7/Demo/scripts/eqfix.pyt<module>s$
				R	pi.pyo000064400000001631151733044210005706 0ustar00�
Afc@s8ddlZd�Zd�Zedkr4e�ndS(i����Nc	Cs�d\}}}}}x�tr�||d|d|d}}}||||||||||f\}}}}||||}}xL||kr�t|�d||d||}}||||}}q�WqWdS(Niiiii
(iiiii(tTruetoutput(	tktatbta1tb1tptqtdtd1((s'/usr/lib64/python2.7/Demo/scripts/pi.pytmain
s	$6
cCs'tjjt|��tjj�dS(N(tsyststdouttwritetstrtflush(R	((s'/usr/lib64/python2.7/Demo/scripts/pi.pyRst__main__(RRRt__name__(((s'/usr/lib64/python2.7/Demo/scripts/pi.pyt<module>s	
	morse.pyc000064400000010517151733044210006412 0ustar00�
Afc@s�ddlZddlZddlZdZdeZdZiJdd6dd6dd	6dd
6dd6dd
6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6d d!6d d"6d#d$6d#d%6d&d'6d&d(6d)d*6d)d+6d,d-6d,d.6d/d06d/d16d2d36d2d46d5d66d5d76d8d96d8d:6d;d<6d;d=6d>d?6d>d@6dAdB6dAdC6dDdE6dDdF6dGdH6dGdI6dJdK6dJdL6dMdN6dMdO6dPdQ6dPdR6dSdT6dUdV6dWdX6dYd6dZd[6d\d]6d^d_6d`da6dbdc6ddde6dfdg6dhdi6djdk6dld>6dmdn6dodp6dqdr6dsdt6dudv6dsdw6dxdx6dydz6Zd{d|Zd}�Zee�Z	d~�Z
d�Zd��Zd��Z
d��Zed�kr�e
�ndS(�i����Niiis.-tAtas-...tBtbs-.-.tCtcs-..tDtdt.tEtes..-.tFtfs--.tGtgs....tHths..tItis.---tJtjs-.-tKtks.-..tLtls--tMtms-.tNtns---tOtos.--.tPtps--.-tQtqs.-.tRtrs...tStst-tTtts..-tUtus...-tVtvs.--tWtws-..-tXtxs-.--tYtys--..tZtzs-----t0s--..--t,s.----t1s.-.-.-s..---t2s..--..t?s...--t3s-.-.-.t;s....-t4s---...t:s.....t5s.----.t's-....t6s-....-s--...t7s-..-.t/s---..t8s-.--.-t(s----.t9t)t s..--.-t_si�cCsod}xbtd�D]T}ttjtj||d�d�}|t|d?d@�t|d@�7}qW|S(NtidgI@i0uii�(trangetinttmathtsintpitchr(toctavetsinewaveRtval((s*/usr/lib64/python2.7/Demo/scripts/morse.pytmkwave<s
(*cCs�ddl}y#|jtjdd�\}}Wn@|jk
rqtjjdtjdd�tjd�nXd}t}x�|D]�\}}|dkr�ddl	}|j
|d�}|jd	�|jd
�|j
d�n|dkr�tt|��}q�q�W|sjddl}|j�}|jd	�|jd
�|j
d�|j|_|j|_n|r�dj|�g}	nttjjd
�}	xF|	D]>}
t|
�}t|||�t|d�r�|j�q�q�W|j�dS(Ni����iso:p:sUsage is, [ -o outfile ] [ -p octave ] [ words ] ...
s-oR/iD�is-pRHRJtwait(tgetopttsystargvterrortstderrtwritetexittNonetdefaultwavetaifctopentsetframeratetsetsampwidthtsetnchannelsRTRLtaudiodevtAudioDevt
setoutratetstoptclosetwriteframestwriteframesrawtjointitertstdintreadlinetmorsetplaythasattrRU(RVtoptstargstdevtwaveRRR_Rdtsourcetlinetmline((s*/usr/lib64/python2.7/Demo/scripts/morse.pytmainEsF#





cCsEd}x8|D]0}y|t|d7}Wq
tk
r<q
Xq
W|S(NRJs(tmorsetabtKeyError(RwtresR((s*/usr/lib64/python2.7/Demo/scripts/morse.pyRoms

cCsqxj|D]b}|dkr,t|t|�n0|dkrKt|t|�nt|tt�t|t�qWdS(NRR'(tsinetDOTtDAHtpause(RwRtRuR((s*/usr/lib64/python2.7/Demo/scripts/morse.pyRpws
cCs(x!t|�D]}|j|�q
WdS(N(RKRj(RttlengthRuR((s*/usr/lib64/python2.7/Demo/scripts/morse.pyR}�scCs(x!t|�D]}|jt�q
WdS(N(RKRjtnowave(RtR�R((s*/usr/lib64/python2.7/Demo/scripts/morse.pyR��st__main__(RWRMRdR~RtOCTAVERzR�RTR^RyRoRpR}R�t__name__(((s*/usr/lib64/python2.7/Demo/scripts/morse.pyt<module>sf$

		(	
	
		script.py000075500000001701151733044210006424 0ustar00#! /usr/bin/python2.7

# script.py -- Make typescript of terminal session.
# Usage:
#       -a      Append to typescript.
#       -p      Use Python as shell.
# Author: Steen Lumholt.


import os, time, sys, getopt
import pty

def read(fd):
    data = os.read(fd, 1024)
    script.write(data)
    return data

shell = 'sh'
filename = 'typescript'
mode = 'w'
if os.environ.has_key('SHELL'):
    shell = os.environ['SHELL']

try:
    opts, args = getopt.getopt(sys.argv[1:], 'ap')
except getopt.error, msg:
    print '%s: %s' % (sys.argv[0], msg)
    sys.exit(2)

for o, a in opts:
    if o == '-a':
        mode = 'a'
    elif o == '-p':
        shell = 'python'

script = open(filename, mode)

sys.stdout.write('Script started, file is %s\n' % filename)
script.write('Script started on %s\n' % time.ctime(time.time()))
pty.spawn(shell, read)
script.write('Script done on %s\n' % time.ctime(time.time()))
sys.stdout.write('Script done, file is %s\n' % filename)
makedir.py000075500000000775151733044210006546 0ustar00#! /usr/bin/python2.7

# Like mkdir, but also make intermediate directories if necessary.
# It is not an error if the given directory already exists (as long
# as it is a directory).
# Errors are not treated specially -- you just get a Python exception.

import sys, os

def main():
    for p in sys.argv[1:]:
        makedirs(p)

def makedirs(p):
    if p and not os.path.isdir(p):
        head, tail = os.path.split(p)
        makedirs(head)
        os.mkdir(p, 0777)

if __name__ == "__main__":
    main()
mboxconvert.pyo000064400000006265151733044210007654 0ustar00�
Afc@s�ddlZddlZddlZddlZddlZddlZddlZd�Zejd�Z	d�Z
d�Zdadd�Z
ed	kr�e�ndS(
i����Nc	Cs�t}y#tjtjdd�\}}Wn7tjk
rb}tjjd|�tjd�nXx)|D]!\}}|dkrjt}qjqjW|s�dg}nd}x�|D]�}|dks�|dkr�|tj	�p�|}q�t
jj|�rt
|�p|}q�t
jj|�r�yt|�}Wn6tk
re}tjjd	||f�d}q�nX||�pu|}|j�q�tjjd
|�d}q�W|r�tj|�ndS(Nitfs%s
is-ft-its%s: %s
s%s: not found
(tmmdftgetopttsystargvterrortstderrtwritetexittmessagetstdintostpathtisdirtmhtisfiletopentIOErrortclose(	tdofiletoptstargstmsgtotatststargR((s0/usr/lib64/python2.7/Demo/scripts/mboxconvert.pytmains<#



s[1-9][0-9]*cCs�d}tj|�}x�|D]�}tj|�t|�krCqntjj||�}yt|�}Wn6tk
r�}t	j
jd||f�d}qnXt|�p�|}qW|S(Nis%s: %s
i(
R
tlistdirtnumerictmatchtlenRtjoinRRRRR	R(tdirRtmsgsRtfnR((s0/usr/lib64/python2.7/Demo/scripts/mboxconvert.pyR2s
cCsbd}xU|j�}|sPn|dkrCt||�p=|}q	tjjd|f�q	W|S(Nis
sBad line in MMFD mailbox: %r
(treadlineRRRR	(RRtline((s0/usr/lib64/python2.7/Demo/scripts/mboxconvert.pyRBs	iRc
Cszd}tj|�}|jd�\}}|jd�}|rQtj|�}n<tjjd|j	d�f�t
j|j��t
j}dG|Gtj|�GHx|jD]
}|Gq�W|jd�stdadt|�tf}	tjjd|	|f�d	G|	GHnHxa|j�}||kr0Pn|sPtjjd
�d}Pn|d dkrmd
|}n|GqWH|S(NitFromtDatesUnparseable date: %r
s
message-idis<%s.%d>sAdding Message-ID %s (From %s)
sMessage-ID:sUnexpected EOF in message
isFrom t>(trfc822tMessagetgetaddrtgetdatettimetmktimeRRR	t	getheaderR
tfstattfilenotstattST_MTIMEtctimetheadersthas_keytcounterthexR&(
Rt	delimiterRtmtfullnametemailtttttR'tmsgid((s0/usr/lib64/python2.7/Demo/scripts/mboxconvert.pyRQs@	

t__main__(R+RR/R
R4RtreRtcompileRRRR9Rt__name__(((s0/usr/lib64/python2.7/Demo/scripts/mboxconvert.pyt<module>s	!		
*beer.pyo000064400000001277151733044210006221 0ustar00�
Afc@s�ddlZdZejdr5eejd�Znd�ZxPeedd�D]<Zee�GdGHee�dGHdGHeed�Gd	GHqQWdS(
i����NidicCs.|dkrdS|dkr dSt|�dS(Nisno more bottles of beerisone bottle of beers bottles of beer(tstr(tn((s)/usr/lib64/python2.7/Demo/scripts/beer.pytbottles
ison the wall,t.sTake one down, pass it around,son the wall.(tsysRtargvtintRtrangeti(((s)/usr/lib64/python2.7/Demo/scripts/beer.pyt<module>s
	queens.py000075500000004276151733044210006432 0ustar00#! /usr/bin/python2.7

"""N queens problem.

The (well-known) problem is due to Niklaus Wirth.

This solution is inspired by Dijkstra (Structured Programming).  It is
a classic recursive backtracking approach.

"""

N = 8                                   # Default; command line overrides

class Queens:

    def __init__(self, n=N):
        self.n = n
        self.reset()

    def reset(self):
        n = self.n
        self.y = [None] * n             # Where is the queen in column x
        self.row = [0] * n              # Is row[y] safe?
        self.up = [0] * (2*n-1)         # Is upward diagonal[x-y] safe?
        self.down = [0] * (2*n-1)       # Is downward diagonal[x+y] safe?
        self.nfound = 0                 # Instrumentation

    def solve(self, x=0):               # Recursive solver
        for y in range(self.n):
            if self.safe(x, y):
                self.place(x, y)
                if x+1 == self.n:
                    self.display()
                else:
                    self.solve(x+1)
                self.remove(x, y)

    def safe(self, x, y):
        return not self.row[y] and not self.up[x-y] and not self.down[x+y]

    def place(self, x, y):
        self.y[x] = y
        self.row[y] = 1
        self.up[x-y] = 1
        self.down[x+y] = 1

    def remove(self, x, y):
        self.y[x] = None
        self.row[y] = 0
        self.up[x-y] = 0
        self.down[x+y] = 0

    silent = 0                          # If true, count solutions only

    def display(self):
        self.nfound = self.nfound + 1
        if self.silent:
            return
        print '+-' + '--'*self.n + '+'
        for y in range(self.n-1, -1, -1):
            print '|',
            for x in range(self.n):
                if self.y[x] == y:
                    print "Q",
                else:
                    print ".",
            print '|'
        print '+-' + '--'*self.n + '+'

def main():
    import sys
    silent = 0
    n = N
    if sys.argv[1:2] == ['-n']:
        silent = 1
        del sys.argv[1]
    if sys.argv[1:]:
        n = int(sys.argv[1])
    q = Queens(n)
    q.silent = silent
    q.solve()
    print "Found", q.nfound, "solutions."

if __name__ == "__main__":
    main()
morse.pyo000064400000010517151733044210006426 0ustar00�
Afc@s�ddlZddlZddlZdZdeZdZiJdd6dd6dd	6dd
6dd6dd
6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6d d!6d d"6d#d$6d#d%6d&d'6d&d(6d)d*6d)d+6d,d-6d,d.6d/d06d/d16d2d36d2d46d5d66d5d76d8d96d8d:6d;d<6d;d=6d>d?6d>d@6dAdB6dAdC6dDdE6dDdF6dGdH6dGdI6dJdK6dJdL6dMdN6dMdO6dPdQ6dPdR6dSdT6dUdV6dWdX6dYd6dZd[6d\d]6d^d_6d`da6dbdc6ddde6dfdg6dhdi6djdk6dld>6dmdn6dodp6dqdr6dsdt6dudv6dsdw6dxdx6dydz6Zd{d|Zd}�Zee�Z	d~�Z
d�Zd��Zd��Z
d��Zed�kr�e
�ndS(�i����Niiis.-tAtas-...tBtbs-.-.tCtcs-..tDtdt.tEtes..-.tFtfs--.tGtgs....tHths..tItis.---tJtjs-.-tKtks.-..tLtls--tMtms-.tNtns---tOtos.--.tPtps--.-tQtqs.-.tRtrs...tStst-tTtts..-tUtus...-tVtvs.--tWtws-..-tXtxs-.--tYtys--..tZtzs-----t0s--..--t,s.----t1s.-.-.-s..---t2s..--..t?s...--t3s-.-.-.t;s....-t4s---...t:s.....t5s.----.t's-....t6s-....-s--...t7s-..-.t/s---..t8s-.--.-t(s----.t9t)t s..--.-t_si�cCsod}xbtd�D]T}ttjtj||d�d�}|t|d?d@�t|d@�7}qW|S(NtidgI@i0uii�(trangetinttmathtsintpitchr(toctavetsinewaveRtval((s*/usr/lib64/python2.7/Demo/scripts/morse.pytmkwave<s
(*cCs�ddl}y#|jtjdd�\}}Wn@|jk
rqtjjdtjdd�tjd�nXd}t}x�|D]�\}}|dkr�ddl	}|j
|d�}|jd	�|jd
�|j
d�n|dkr�tt|��}q�q�W|sjddl}|j�}|jd	�|jd
�|j
d�|j|_|j|_n|r�dj|�g}	nttjjd
�}	xF|	D]>}
t|
�}t|||�t|d�r�|j�q�q�W|j�dS(Ni����iso:p:sUsage is, [ -o outfile ] [ -p octave ] [ words ] ...
s-oR/iD�is-pRHRJtwait(tgetopttsystargvterrortstderrtwritetexittNonetdefaultwavetaifctopentsetframeratetsetsampwidthtsetnchannelsRTRLtaudiodevtAudioDevt
setoutratetstoptclosetwriteframestwriteframesrawtjointitertstdintreadlinetmorsetplaythasattrRU(RVtoptstargstdevtwaveRRR_Rdtsourcetlinetmline((s*/usr/lib64/python2.7/Demo/scripts/morse.pytmainEsF#





cCsEd}x8|D]0}y|t|d7}Wq
tk
r<q
Xq
W|S(NRJs(tmorsetabtKeyError(RwtresR((s*/usr/lib64/python2.7/Demo/scripts/morse.pyRoms

cCsqxj|D]b}|dkr,t|t|�n0|dkrKt|t|�nt|tt�t|t�qWdS(NRR'(tsinetDOTtDAHtpause(RwRtRuR((s*/usr/lib64/python2.7/Demo/scripts/morse.pyRpws
cCs(x!t|�D]}|j|�q
WdS(N(RKRj(RttlengthRuR((s*/usr/lib64/python2.7/Demo/scripts/morse.pyR}�scCs(x!t|�D]}|jt�q
WdS(N(RKRjtnowave(RtR�R((s*/usr/lib64/python2.7/Demo/scripts/morse.pyR��st__main__(RWRMRdR~RtOCTAVERzR�RTR^RyRoRpR}R�t__name__(((s*/usr/lib64/python2.7/Demo/scripts/morse.pyt<module>sf$

		(	
	
		pi.pyc000064400000001631151733044210005672 0ustar00�
Afc@s8ddlZd�Zd�Zedkr4e�ndS(i����Nc	Cs�d\}}}}}x�tr�||d|d|d}}}||||||||||f\}}}}||||}}xL||kr�t|�d||d||}}||||}}q�WqWdS(Niiiii
(iiiii(tTruetoutput(	tktatbta1tb1tptqtdtd1((s'/usr/lib64/python2.7/Demo/scripts/pi.pytmain
s	$6
cCs'tjjt|��tjj�dS(N(tsyststdouttwritetstrtflush(R	((s'/usr/lib64/python2.7/Demo/scripts/pi.pyRst__main__(RRRt__name__(((s'/usr/lib64/python2.7/Demo/scripts/pi.pyt<module>s	
	primes.pyc000064400000001631151733044210006561 0ustar00�
Afc@s,d�Zd�Zedkr(e�ndS(cCs�|dko|knr$dGHndg}d}x�||kr�x2|D]*}||dkso|||krIPqIqIW||dkr�|j|�||kr�|GHq�n|d7}q6WdS(Niii(tappend(tmintmaxtprimestitp((s+/usr/lib64/python2.7/Demo/scripts/primes.pyRs	
 
cCsoddl}d\}}|jdr^t|jd�}|jdr^t|jd�}q^nt||�dS(Ni����ii���i(ii���(tsystargvtintR(RRR((s+/usr/lib64/python2.7/Demo/scripts/primes.pytmains

t__main__N(RR	t__name__(((s+/usr/lib64/python2.7/Demo/scripts/primes.pyt<module>s			morse.py000075500000010332151733044210006245 0ustar00#! /usr/bin/python2.7

# DAH should be three DOTs.
# Space between DOTs and DAHs should be one DOT.
# Space between two letters should be one DAH.
# Space between two words should be DOT DAH DAH.

import sys, math, audiodev

DOT = 30
DAH = 3 * DOT
OCTAVE = 2                              # 1 == 441 Hz, 2 == 882 Hz, ...

morsetab = {
        'A': '.-',              'a': '.-',
        'B': '-...',            'b': '-...',
        'C': '-.-.',            'c': '-.-.',
        'D': '-..',             'd': '-..',
        'E': '.',               'e': '.',
        'F': '..-.',            'f': '..-.',
        'G': '--.',             'g': '--.',
        'H': '....',            'h': '....',
        'I': '..',              'i': '..',
        'J': '.---',            'j': '.---',
        'K': '-.-',             'k': '-.-',
        'L': '.-..',            'l': '.-..',
        'M': '--',              'm': '--',
        'N': '-.',              'n': '-.',
        'O': '---',             'o': '---',
        'P': '.--.',            'p': '.--.',
        'Q': '--.-',            'q': '--.-',
        'R': '.-.',             'r': '.-.',
        'S': '...',             's': '...',
        'T': '-',               't': '-',
        'U': '..-',             'u': '..-',
        'V': '...-',            'v': '...-',
        'W': '.--',             'w': '.--',
        'X': '-..-',            'x': '-..-',
        'Y': '-.--',            'y': '-.--',
        'Z': '--..',            'z': '--..',
        '0': '-----',           ',': '--..--',
        '1': '.----',           '.': '.-.-.-',
        '2': '..---',           '?': '..--..',
        '3': '...--',           ';': '-.-.-.',
        '4': '....-',           ':': '---...',
        '5': '.....',           "'": '.----.',
        '6': '-....',           '-': '-....-',
        '7': '--...',           '/': '-..-.',
        '8': '---..',           '(': '-.--.-',
        '9': '----.',           ')': '-.--.-',
        ' ': ' ',               '_': '..--.-',
}

nowave = '\0' * 200

# If we play at 44.1 kHz (which we do), then if we produce one sine
# wave in 100 samples, we get a tone of 441 Hz.  If we produce two
# sine waves in these 100 samples, we get a tone of 882 Hz.  882 Hz
# appears to be a nice one for playing morse code.
def mkwave(octave):
    sinewave = ''
    for i in range(100):
        val = int(math.sin(math.pi * i * octave / 50.0) * 30000)
        sinewave += chr((val >> 8) & 255) + chr(val & 255)
    return sinewave

defaultwave = mkwave(OCTAVE)

def main():
    import getopt
    try:
        opts, args = getopt.getopt(sys.argv[1:], 'o:p:')
    except getopt.error:
        sys.stderr.write('Usage ' + sys.argv[0] +
                         ' [ -o outfile ] [ -p octave ] [ words ] ...\n')
        sys.exit(1)
    dev = None
    wave = defaultwave
    for o, a in opts:
        if o == '-o':
            import aifc
            dev = aifc.open(a, 'w')
            dev.setframerate(44100)
            dev.setsampwidth(2)
            dev.setnchannels(1)
        if o == '-p':
            wave = mkwave(int(a))
    if not dev:
        import audiodev
        dev = audiodev.AudioDev()
        dev.setoutrate(44100)
        dev.setsampwidth(2)
        dev.setnchannels(1)
        dev.close = dev.stop
        dev.writeframesraw = dev.writeframes
    if args:
        source = [' '.join(args)]
    else:
        source = iter(sys.stdin.readline, '')
    for line in source:
        mline = morse(line)
        play(mline, dev, wave)
        if hasattr(dev, 'wait'):
            dev.wait()
    dev.close()

# Convert a string to morse code with \001 between the characters in
# the string.
def morse(line):
    res = ''
    for c in line:
        try:
            res += morsetab[c] + '\001'
        except KeyError:
            pass
    return res

# Play a line of morse code.
def play(line, dev, wave):
    for c in line:
        if c == '.':
            sine(dev, DOT, wave)
        elif c == '-':
            sine(dev, DAH, wave)
        else:                   # space
            pause(dev, DAH + DOT)
        pause(dev, DOT)

def sine(dev, length, wave):
    for i in range(length):
        dev.writeframesraw(wave)

def pause(dev, length):
    for i in range(length):
        dev.writeframesraw(nowave)

if __name__ == '__main__':
    main()
makedir.pyc000064400000001334151733044210006676 0ustar00�
Afc@sDddlZddlZd�Zd�Zedkr@e�ndS(i����NcCs&xtjdD]}t|�qWdS(Ni(tsystargvtmakedirs(tp((s,/usr/lib64/python2.7/Demo/scripts/makedir.pytmain
scCsR|rNtjj|�rNtjj|�\}}t|�tj|d�ndS(Ni�(tostpathtisdirtsplitRtmkdir(Rtheadttail((s,/usr/lib64/python2.7/Demo/scripts/makedir.pyRs
t__main__(RRRRt__name__(((s,/usr/lib64/python2.7/Demo/scripts/makedir.pyt<module>s		from.pyo000064400000001357151733044220006247 0ustar00�
Afc@sddlZddlZyejdZWn4eefk
r_ejjd�ejd�nXye	e�Z
Wn"ek
r�ejde�nXx�e
j�Z
e
s�Pne
jd�r�e
d GxJe
j�Z
e
s�e
dkr�Pne
jd�r�ee
d	d!�Gq�q�WHq�q�WdS(
i����NtMAILsNo environment variable $MAIL
isCannot open mailbox file: sFrom s
s	Subject: i	(tsystostenvirontmailboxtAttributeErrortKeyErrortstderrtwritetexittopentmailtIOErrortreadlinetlinet
startswithtrepr(((s)/usr/lib64/python2.7/Demo/scripts/from.pyt<module>s,
fact.py000075500000002154151733044220006041 0ustar00#! /usr/bin/python2.7

# Factorize numbers.
# The algorithm is not efficient, but easy to understand.
# If there are large factors, it will take forever to find them,
# because we try all odd numbers between 3 and sqrt(n)...

import sys
from math import sqrt

def fact(n):
    if n < 1:
        raise ValueError('fact() argument should be >= 1')
    if n == 1:
        return []  # special case
    res = []
    # Treat even factors special, so we can use i += 2 later
    while n % 2 == 0:
        res.append(2)
        n //= 2
    # Try odd numbers up to sqrt(n)
    limit = sqrt(n+1)
    i = 3
    while i <= limit:
        if n % i == 0:
            res.append(i)
            n //= i
            limit = sqrt(n+1)
        else:
            i += 2
    if n != 1:
        res.append(n)
    return res

def main():
    if len(sys.argv) > 1:
        source = sys.argv[1:]
    else:
        source = iter(raw_input, '')
    for arg in source:
        try:
            n = int(arg)
        except ValueError:
            print arg, 'is not an integer'
        else:
            print n, fact(n)

if __name__ == "__main__":
    main()
update.pyc000064400000005307151733044220006551 0ustar00�
Afc@soddlZddlZddlZdZeje�Zddd��YZd�Zedkrke�ndS(i����Ns^([^: 	
]+):([1-9][0-9]*):tFileObjcBs#eZd�Zd�Zd�ZRS(cCsk||_d|_yt|d�j�|_Wn*tk
rZ}d|G|GHd|_dSXdG|jGHdS(Nitrs*** Can't open "%s":tdiffing(tfilenametchangedtopent	readlinestlinestIOErrortNone(tselfRtmsg((s+/usr/lib64/python2.7/Demo/scripts/update.pyt__init__s		
	cCs�|jsdG|jGHdSy0tj|j|jd�t|jd�}Wn-tjtfk
rx}d|jG|GHdSXdG|jGHx|jD]}|j|�q�W|j	�d|_dS(Ns
no changes tot~tws*** Can't rewrite "%s":twritingi(
RRtostrenameRterrorRRtwritetclose(R
tfpRtline((s+/usr/lib64/python2.7/Demo/scripts/update.pytfinishs	
cCs�|jdkr'd|j||fGdSt|�d}d|koWt|j�knstd|j||fGdS|j||kr�d|j||fGdS|js�d|_nd||fGHdG|j|GdGH||j|<d	G|j|GdS(
Ns(not processed): %s:%s:%siis&*** Line number out of range: %s:%s:%ss(no change): %s:%s:%ss%sc%st<s---t>(RR	RtevaltlenR(R
tlinenotrestti((s+/usr/lib64/python2.7/Demo/scripts/update.pytprocess,s(%	
(t__name__t
__module__RRR(((s+/usr/lib64/python2.7/Demo/scripts/update.pyRs		cCs1tjdrayttjdd�}Wqjtk
r]}dtjdG|GHtjd�qjXn	tj}d}x�|j�}|s�|r�|j�nPnt	j
|�}|dkr�dG|Gqsnt	jdd�\}}|s�||jkr|r|j�nt
|�}n|j|||�qsWdS(NiRsCan't open "%s":isFunny line:i(tsystargvRRtexittstdinR	treadlineRtprogtmatchtgroupRRR(RRtcurfileRtnRR((s+/usr/lib64/python2.7/Demo/scripts/update.pytmainBs0
	

t__main__((	RR"tretpattcompileR'RR,R (((s+/usr/lib64/python2.7/Demo/scripts/update.pyt<module>	s2	pp.pyc000064400000004436151733044220005710 0ustar00�
Afc@s_ddlZddlZdZgZdZdZdZdZdZy#ejej	dd�\Z
ZWnDejk
r�Z
ejjdej	de
f�ejd�nXx�e
D]�\ZZedkr�dZq�ed	kr�dZq�ed
kr�dZq�edkr4x{ejd�D]Zeje�qWq�ed
krIeZq�edkrddZdZq�edkrdZdZq�eGdGHq�Wes�ejd�nes(eddkr�ejZneedd�Zx+ej�Zes�Pnejed �q�W[ed=es(ejd�q(ner@dgZgZnfer�ddddddddddddd d!d"d#d$gZd%d"d&d'd(gZnd)gZgZdje�dZx eD]Zed*ed7Zq�Wedje�d7ZddlZej�Zeje�ej �erNddl!Z!e!j"d+ej#f�n
e$ej#�dS(,i����Ntiis	acde:F:nps%s: %s
is-as-cs-ds-es
s-Fs-ns-psnot recognized???t-trsif 0:s
LINECOUNT = 0sfor FILE in ARGS:s   	if FILE == '-':s   	   	FP = sys.stdins	   	else:s   	   	FP = open(FILE, 'r')s   	LINENO = 0s   	while 1:s   	   	LINE = FP.readline()s   	   	if not LINE: breaks   	   	LINENO = LINENO + 1s!   	   	LINECOUNT = LINECOUNT + 1s   	   	L = LINE[:-1]s   	   	aflag = AFLAGs   	   	if aflag:s"   	   	   	if FS: F = L.split(FS)s   	   	   	else: F = L.split()s   	   	if not PFLAG: continues#   	   	   	if FS: print FS.join(F)s#   	   	   	else: print ' '.join(F)s   	   	else: print Lsif 1:s   	   	sexecfile(%r)(%tsystgetopttFStSCRIPTtAFLAGtCFLAGtDFLAGtNFLAGtPFLAGtargvtoptlisttARGSterrortmsgtstderrtwritetexittoptiontoptargtsplittlinetappendtstdintfptopentreadlinetprologuetepiloguetjointprogramttempfiletNamedTemporaryFiletflushtpdbtruntnametexecfile(((s'/usr/lib64/python2.7/Demo/scripts/pp.pyt<module>s�#!						
				


lpwatch.pyc000064400000005055151733044220006731 0ustar00�
Afc@stddlZddlZddlZdZdZd�Zd�Zedkrpye�Wqpek
rlqpXndS(i����Ntpsci
cCst}ytjd}Wntjd}nXtjd}|r�xlt|�D]-\}}|d dkrN|d||<qNqNWn.tjjd�r�tjdg}n	tg}tjdd�j	�}xJt
r|}x%|D]}|t||�d	7}q�W|GHtj
|�q�WdS(
NtLOGNAMEtUSERiis-PtPRINTERtcleartrs
(t	DEF_DELAYtostenvirontsystargvt	enumeratethas_keytDEF_PRINTERtpopentreadtTruet
makestatusttimetsleep(tdelaytthisusertprinterstitnamet	clearhomettext((s,/usr/lib64/python2.7/Demo/scripts/lpwatch.pytmain
s(
		
cCs�tjd|dd�}g}i}d}d}t}d}d}	xl|D]d}
|
j�}t|�}t|�dkrK||ddkrK|dd!\}
}}|dd	!}t||d
�}||kr�t}n|s�||7}|d7}n||7}|	d7}	|j|d�\}}|d7}||7}||f||<qK|rK|ddkrK|
j�}
|
dkr�|d
}
n|
ddkr�|}
n|j	|
�qKqKW|	r�d|dd}
|	t|�kr�|
d|	7}
nt|�dkr|
d|j
�df7}
nV|
dt|�7}
|rt|dkrU|
d|7}
qt|
d|dd|f7}
n|j	|
�n|j�}|r�|j	d|f�ndj|�S(Nslpq -Ps 2>&1Riiitbytesii����itRanks
no entriess: idlei��s is ready and printings%d Ki�is
 (%d jobs)s for %ss
 for %d userss (%s first)s (%d K before %s)slpq exit status %rs: (ii(
RRtFalsetsplittlentintRtgettstriptappendtkeystclosetjoin(RRtpipetlinestuserst
aheadbytest	aheadjobstuserseent
totalbytest	totaljobstlinetfieldstntranktusertjobtfilesRtujobstubyteststs((s,/usr/lib64/python2.7/Demo/scripts/lpwatch.pyR)sd
&
	






	t__main__(	RR	RR
RRRt__name__tKeyboardInterrupt(((s,/usr/lib64/python2.7/Demo/scripts/lpwatch.pyt<module>s		9
find-uname.pyo000064400000002746151733044230007333 0ustar00�
Afc@sWdZddlZddlZddlZd�ZedkrSeejd�ndS(s)
For each argument on the command line, look for it in the set of all Unicode
names.  Arguments are treated as case-insensitive regular expressions, e.g.:

    % find-uname 'small letter a$' 'horizontal line'
    *** small letter a$ matches ***
    LATIN SMALL LETTER A (97)
    COMBINING LATIN SMALL LETTER A (867)
    CYRILLIC SMALL LETTER A (1072)
    PARENTHESIZED LATIN SMALL LETTER A (9372)
    CIRCLED LATIN SMALL LETTER A (9424)
    FULLWIDTH LATIN SMALL LETTER A (65345)
    *** horizontal line matches ***
    HORIZONTAL LINE EXTENSION (9135)
i����Nc	Cs�g}xUttjd�D]@}y&|j|tjt|��f�Wqtk
rYqXqWx�|D]�}tj	|tj
�}g|D]-\}}|j|�dk	r�||f^q�}|redG|GdGdGHx|D]}d|GHq�WqeqeWdS(Nis***tmatchess%s (%d)(
trangetsyst
maxunicodetappendtunicodedatatnametunichrt
ValueErrortretcompiletItsearchtNone(	targst
unicode_namestixtargtpattxtyRtmatch((s//usr/lib64/python2.7/Demo/scripts/find-uname.pytmains&

'
t__main__i(t__doc__RRR	Rt__name__targv(((s//usr/lib64/python2.7/Demo/scripts/find-uname.pyt<module>s	beer.py000075500000000712151733044230006040 0ustar00#! /usr/bin/python2.7

# By GvR, demystified after a version by Fredrik Lundh.

import sys

n = 100
if sys.argv[1:]:
    n = int(sys.argv[1])

def bottle(n):
    if n == 0: return "no more bottles of beer"
    if n == 1: return "one bottle of beer"
    return str(n) + " bottles of beer"

for i in range(n, 0, -1):
    print bottle(i), "on the wall,"
    print bottle(i) + "."
    print "Take one down, pass it around,"
    print bottle(i-1), "on the wall."
fact.pyc000064400000002217151733044230006202 0ustar00�
Afc@sHddlZddlmZd�Zd�ZedkrDe�ndS(i����N(tsqrtcCs�|dkrtd��n|dkr+gSg}x+|ddkr^|jd�|d}q4Wt|d�}d}xT||kr�||dkr�|j|�||}t|d�}qx|d7}qxW|dkr�|j|�n|S(Nisfact() argument should be >= 1iii(t
ValueErrortappendR(tntrestlimitti((s)/usr/lib64/python2.7/Demo/scripts/fact.pytfacts&


cCs�ttj�dkr%tjd}nttd�}xJ|D]B}yt|�}Wntk
rm|GdGHq;X|Gt|�GHq;WdS(Nitsis not an integer(tlentsystargvtitert	raw_inputtintRR(tsourcetargR((s)/usr/lib64/python2.7/Demo/scripts/fact.pytmain#s


t__main__(R
tmathRRRt__name__(((s)/usr/lib64/python2.7/Demo/scripts/fact.pyt<module>s
		
from.py000075500000001551151733044230006070 0ustar00#! /usr/bin/python2.7

# Print From and Subject of messages in $MAIL.
# Extension to multiple mailboxes and other bells & whistles are left
# as exercises for the reader.

import sys, os

# Open mailbox file.  Exits with exception when this fails.

try:
    mailbox = os.environ['MAIL']
except (AttributeError, KeyError):
    sys.stderr.write('No environment variable $MAIL\n')
    sys.exit(2)

try:
    mail = open(mailbox)
except IOError:
    sys.exit('Cannot open mailbox file: ' + mailbox)

while 1:
    line = mail.readline()
    if not line:
        break # EOF
    if line.startswith('From '):
        # Start of message found
        print line[:-1],
        while 1:
            line = mail.readline()
            if not line or line == '\n':
                break
            if line.startswith('Subject: '):
                print repr(line[9:-1]),
        print
script.pyc000064400000002323151733044230006567 0ustar00�
Afc@s�ddlZddlZddlZddlZddlZd�ZdZdZdZej	j
d�ryej	dZny#ejejdd�\ZZ
Wn9ejk
r�Zd	ejd
efGHejd�nXx>eD]6\ZZedkrd
Zq�edkr�dZq�q�Weee�Zejjde�ejdejej���ejee�ejdejej���ejjde�dS(i����NcCs#tj|d�}tj|�|S(Ni(tostreadtscripttwrite(tfdtdata((s+/usr/lib64/python2.7/Demo/scripts/script.pyR
s
tsht
typescripttwtSHELLitaps%s: %siis-atas-ptpythonsScript started, file is %s
sScript started on %s
sScript done on %s
sScript done, file is %s
(RttimetsystgetopttptyRtshelltfilenametmodetenvironthas_keytargvtoptstargsterrortmsgtexittoRtopenRtstdoutRtctimetspawn(((s+/usr/lib64/python2.7/Demo/scripts/script.pyt<module>
s.0	#	
  queens.pyo000064400000005720151733044240006604 0ustar00�
Afc@sBdZdZddd��YZd�Zedkr>e�ndS(s�N queens problem.

The (well-known) problem is due to Niklaus Wirth.

This solution is inspired by Dijkstra (Structured Programming).  It is
a classic recursive backtracking approach.

itQueenscBsSeZed�Zd�Zdd�Zd�Zd�Zd�ZdZ	d�Z
RS(cCs||_|j�dS(N(tntreset(tselfR((s+/usr/lib64/python2.7/Demo/scripts/queens.pyt__init__s	cCsf|j}dg||_dg||_dgd|d|_dgd|d|_d|_dS(Niii(RtNonetytrowtuptdowntnfound(RR((s+/usr/lib64/python2.7/Demo/scripts/queens.pyRs	icCs�x}t|j�D]l}|j||�r|j||�|d|jkrX|j�n|j|d�|j||�qqWdS(Ni(trangeRtsafetplacetdisplaytsolvetremove(RtxR((s+/usr/lib64/python2.7/Demo/scripts/queens.pyRs
cCs0|j|o/|j||o/|j||S(N(RRR	(RRR((s+/usr/lib64/python2.7/Demo/scripts/queens.pyR&scCs@||j|<d|j|<d|j||<d|j||<dS(Ni(RRRR	(RRR((s+/usr/lib64/python2.7/Demo/scripts/queens.pyR
)s

cCs@d|j|<d|j|<d|j||<d|j||<dS(Ni(RRRRR	(RRR((s+/usr/lib64/python2.7/Demo/scripts/queens.pyR/s

cCs�|jd|_|jrdSdd|jdGHxbt|jddd�D]G}dGx5t|j�D]$}|j||kr�dGqedGqeWdGHqKWdd|jdGHdS(	Nis+-s--t+i����t|tQt.(R
tsilentRRR(RRR((s+/usr/lib64/python2.7/Demo/scripts/queens.pyR7s	 	(t__name__t
__module__tNRRRRR
RRR(((s+/usr/lib64/python2.7/Demo/scripts/queens.pyRs	
			cCs�ddl}d}t}|jdd!dgkrDd}|jd=n|jdrgt|jd�}nt|�}||_|j�dG|jGdGHdS(Ni����iiis-ntFounds
solutions.(tsysRtargvtintRRRR
(RRRtq((s+/usr/lib64/python2.7/Demo/scripts/queens.pytmainFs

	
t__main__N((t__doc__RRRR(((s+/usr/lib64/python2.7/Demo/scripts/queens.pyt<module>
s
8	mboxconvert.py000075500000006164151733044240007501 0ustar00#! /usr/bin/python2.7

# Convert  MH directories (1 message per file) or MMDF mailboxes (4x^A
# delimited) to unix mailbox (From ... delimited) on stdout.
# If -f is given, files contain one message per file (e.g. MH messages)

import rfc822
import sys
import time
import os
import stat
import getopt
import re

def main():
    dofile = mmdf
    try:
        opts, args = getopt.getopt(sys.argv[1:], 'f')
    except getopt.error, msg:
        sys.stderr.write('%s\n' % msg)
        sys.exit(2)
    for o, a in opts:
        if o == '-f':
            dofile = message
    if not args:
        args = ['-']
    sts = 0
    for arg in args:
        if arg == '-' or arg == '':
            sts = dofile(sys.stdin) or sts
        elif os.path.isdir(arg):
            sts = mh(arg) or sts
        elif os.path.isfile(arg):
            try:
                f = open(arg)
            except IOError, msg:
                sys.stderr.write('%s: %s\n' % (arg, msg))
                sts = 1
                continue
            sts = dofile(f) or sts
            f.close()
        else:
            sys.stderr.write('%s: not found\n' % arg)
            sts = 1
    if sts:
        sys.exit(sts)

numeric = re.compile('[1-9][0-9]*')

def mh(dir):
    sts = 0
    msgs = os.listdir(dir)
    for msg in msgs:
        if numeric.match(msg) != len(msg):
            continue
        fn = os.path.join(dir, msg)
        try:
            f = open(fn)
        except IOError, msg:
            sys.stderr.write('%s: %s\n' % (fn, msg))
            sts = 1
            continue
        sts = message(f) or sts
    return sts

def mmdf(f):
    sts = 0
    while 1:
        line = f.readline()
        if not line:
            break
        if line == '\1\1\1\1\n':
            sts = message(f, line) or sts
        else:
            sys.stderr.write(
                    'Bad line in MMFD mailbox: %r\n' % (line,))
    return sts

counter = 0 # for generating unique Message-ID headers

def message(f, delimiter = ''):
    sts = 0
    # Parse RFC822 header
    m = rfc822.Message(f)
    # Write unix header line
    fullname, email = m.getaddr('From')
    tt = m.getdate('Date')
    if tt:
        t = time.mktime(tt)
    else:
        sys.stderr.write(
                'Unparseable date: %r\n' % (m.getheader('Date'),))
        t = os.fstat(f.fileno())[stat.ST_MTIME]
    print 'From', email, time.ctime(t)
    # Copy RFC822 header
    for line in m.headers:
        print line,
    # Invent Message-ID header if none is present
    if not m.has_key('message-id'):
        global counter
        counter = counter + 1
        msgid = "<%s.%d>" % (hex(t), counter)
        sys.stderr.write("Adding Message-ID %s (From %s)\n" %
                         (msgid, email))
        print "Message-ID:", msgid
    print
    # Copy body
    while 1:
        line = f.readline()
        if line == delimiter:
            break
        if not line:
            sys.stderr.write('Unexpected EOF in message\n')
            sts = 1
            break
        if line[:5] == 'From ':
            line = '>' + line
        print line,
    # Print trailing newline
    print
    return sts

if __name__ == "__main__":
    main()
script.pyo000064400000002323151733044240006604 0ustar00�
Afc@s�ddlZddlZddlZddlZddlZd�ZdZdZdZej	j
d�ryej	dZny#ejejdd�\ZZ
Wn9ejk
r�Zd	ejd
efGHejd�nXx>eD]6\ZZedkrd
Zq�edkr�dZq�q�Weee�Zejjde�ejdejej���ejee�ejdejej���ejjde�dS(i����NcCs#tj|d�}tj|�|S(Ni(tostreadtscripttwrite(tfdtdata((s+/usr/lib64/python2.7/Demo/scripts/script.pyR
s
tsht
typescripttwtSHELLitaps%s: %siis-atas-ptpythonsScript started, file is %s
sScript started on %s
sScript done on %s
sScript done, file is %s
(RttimetsystgetopttptyRtshelltfilenametmodetenvironthas_keytargvtoptstargsterrortmsgtexittoRtopenRtstdoutRtctimetspawn(((s+/usr/lib64/python2.7/Demo/scripts/script.pyt<module>
s.0	#	
  markov.pyo000064400000007671151733044240006612 0ustar00�
Afc@s6ddd��YZd�Zedkr2e�ndS(tMarkovcBs,eZd�Zd�Zd�Zd�ZRS(cCs||_||_i|_dS(N(thistsizetchoicettrans(tselfRR((s+/usr/lib64/python2.7/Demo/scripts/markov.pyt__init__s		cCs |jj|g�j|�dS(N(Rt
setdefaulttappend(Rtstatetnext((s+/usr/lib64/python2.7/Demo/scripts/markov.pytadd	scCs�|j}|j}|d|d �xFtt|��D]2}||td||�|!|||d!�q6W||t|�|d�dS(Nii(RR
tNonetrangetlentmax(RtseqtnR
ti((s+/usr/lib64/python2.7/Demo/scripts/markov.pytputs		0cCs�|j}|j}|j}||d�}xQtr~|tdt|�|�}||}||�}|sqPn||7}q.W|S(Ni(RRRRtTrueRR
(RRRRRtsubseqtoptionsR	((s+/usr/lib64/python2.7/Demo/scripts/markov.pytgets				
(t__name__t
__module__RR
RR(((s+/usr/lib64/python2.7/Demo/scripts/markov.pyRs			cCs�ddl}ddl}ddl}|jd}y|j|d�\}}Wnm|jk
r�d|jdGHdGHdGHdGHd	GHd
GHdGHdGHd
GHdGHdGHdGHdGH|jd�nXd}t}d}x�|D]�\}}	d|ko�dknrt|d�}n|dkr&t}n|dkr?|d7}n|dkrTd}n|dkr�t}q�q�W|sdg}nt	||j
�}
y�x�|D]�}|dkr�|j}|j�r�dGHq�q�nt
|d�}|r�dG|GdGHn|j�}
|j�|
jd�}xh|D]`}|dkr;dGHn|j�}|r!|rbt|�}nd j|�}|
j|�q!q!Wq�WWntk
r�d!GHnX|
js�d"GHdS|r�d#GHn|dkrIxN|
jj�D]=}|dkst|�|kr�t|�G|
j|GHq�q�W|dkrEtd$�G|
jd$GHnHnx�tr�|
j�}|rm|}n|j�}d}d%}xF|D]>}|t|�|kr�Hd}n|G|t|�d7}q�WHHqLWdS(&Ni����it0123456789cdwqs"Usage: %s [-#] [-cddqw] [file] ...isOptions:s$-#: 1-digit history size (default 2)s-c: characters (default)s	-w: wordss-d: more debugging outputs-q: no debugging outputs3Input files (default stdin) are split in paragraphss1separated blank lines and each paragraph is splits0in words by whitespace, then reconcatenated withs#exactly one space separating words.s0Output consists of paragraphs separated by blanks4lines, where lines are no longer than 72 characters.is-0s-9s-cs-ds-qs-wt-sSorry, need stdin from filetrt
processings...s

sfeeding ...t s-Interrupted -- continue with data read so farsNo valid input filessdone.tiH(tsystrandomtgetopttargvterrortexittFalsetintRRRtstdintisattytopentreadtclosetsplitttupletjoinRtKeyboardInterruptRtkeysRR
treprR(RR R!targstoptsRtdo_wordstdebugtotatmtfilenametfttexttparalisttparatwordstdatatkeyRtlimittw((s+/usr/lib64/python2.7/Demo/scripts/markov.pyttest#s�$
	
	

		


				
	t__main__N((RRCR(((s+/usr/lib64/python2.7/Demo/scripts/markov.pyt<module>s 	Uunbirthday.pyc000064400000005672151733044240007447 0ustar00�
Afc@sbddlZddlZddlZd�Zd�Zd�Zd�Zedkr^e�ndS(i����NcCs�tjdr#ttjd�}nttd��}d|koLdknrsdG|G|d}dG|GdGHn3d	|ko�tj�dkns�d
G|GHdStjdr�ttjd�}nttd��}d|ko�d
knsdG|GHdStjdr'ttjd�}nttd��}|dkr]tj|�r]d}n
tj|}d|ko�|kns�dG|GdGHdS|||f}t	|�}dGt
|�GHtj�d }t	|�}dGt
|�GH||krdGHdS||krdGHdS||}dG|GdGHd}	xQt||dd�D]8}
||
||fkoq|knrK|	d}	qKqKWdG|	GdGH|d|dkr�dGt|	�GdGHdGndGt||	�Gd GHdS(!NisIn which year were you born? iidsI'll assume that byilsyou meansand not the early Christian erai:s%It's hard to believe you were born inisAnd in which month? (1-12) isThere is no month numberedis&And on what day of that month? (1-31) isThere are nosdays in that month!sYou were born onsToday iss0You are a time traveler.  Go back to the future!s'You were born today.  Have a nice life!sYou have livedtdayssYou ares	years oldsCongratulations!  Today is yourtbirthdaysYesterday was yours
Today is yourt
unbirthday(
tsystargvtintt	raw_inputttimet	localtimetcalendartisleaptmdaystmkdatetformattrangetnth(tyeartmonthtdaytmaxdayt	bdaytupletbdaydatet
todaytuplet	todaydateRtagety((s//usr/lib64/python2.7/Demo/scripts/unbirthday.pytmainsb

&	
	
	



%
cCs'|\}}}d|tj||fS(Ns%d %s %d(R	t
month_name(t.0RRR((s//usr/lib64/python2.7/Demo/scripts/unbirthday.pyR
NscCs8|dkrdS|dkr dS|dkr0dSd|S(Nit1stit2ndit3rds%dth((tn((s//usr/lib64/python2.7/Demo/scripts/unbirthday.pyRQscCs�|\}}}|d}||dd}||dd}||dd}xPtd|�D]?}|d	kr�tj|�r�|d
}q_|tj|}q_W||}|S(Nimiiicidi�i�iii(RR	R
R(RRRRRti((s//usr/lib64/python2.7/Demo/scripts/unbirthday.pyRWs


t__main__(RRR	RR
RRt__name__(((s//usr/lib64/python2.7/Demo/scripts/unbirthday.pyt<module>s	B			update.pyo000064400000005307151733044240006567 0ustar00�
Afc@soddlZddlZddlZdZeje�Zddd��YZd�Zedkrke�ndS(i����Ns^([^: 	
]+):([1-9][0-9]*):tFileObjcBs#eZd�Zd�Zd�ZRS(cCsk||_d|_yt|d�j�|_Wn*tk
rZ}d|G|GHd|_dSXdG|jGHdS(Nitrs*** Can't open "%s":tdiffing(tfilenametchangedtopent	readlinestlinestIOErrortNone(tselfRtmsg((s+/usr/lib64/python2.7/Demo/scripts/update.pyt__init__s		
	cCs�|jsdG|jGHdSy0tj|j|jd�t|jd�}Wn-tjtfk
rx}d|jG|GHdSXdG|jGHx|jD]}|j|�q�W|j	�d|_dS(Ns
no changes tot~tws*** Can't rewrite "%s":twritingi(
RRtostrenameRterrorRRtwritetclose(R
tfpRtline((s+/usr/lib64/python2.7/Demo/scripts/update.pytfinishs	
cCs�|jdkr'd|j||fGdSt|�d}d|koWt|j�knstd|j||fGdS|j||kr�d|j||fGdS|js�d|_nd||fGHdG|j|GdGH||j|<d	G|j|GdS(
Ns(not processed): %s:%s:%siis&*** Line number out of range: %s:%s:%ss(no change): %s:%s:%ss%sc%st<s---t>(RR	RtevaltlenR(R
tlinenotrestti((s+/usr/lib64/python2.7/Demo/scripts/update.pytprocess,s(%	
(t__name__t
__module__RRR(((s+/usr/lib64/python2.7/Demo/scripts/update.pyRs		cCs1tjdrayttjdd�}Wqjtk
r]}dtjdG|GHtjd�qjXn	tj}d}x�|j�}|s�|r�|j�nPnt	j
|�}|dkr�dG|Gqsnt	jdd�\}}|s�||jkr|r|j�nt
|�}n|j|||�qsWdS(NiRsCan't open "%s":isFunny line:i(tsystargvRRtexittstdinR	treadlineRtprogtmatchtgroupRRR(RRtcurfileRtnRR((s+/usr/lib64/python2.7/Demo/scripts/update.pytmainBs0
	

t__main__((	RR"tretpattcompileR'RR,R (((s+/usr/lib64/python2.7/Demo/scripts/update.pyt<module>	s2	pp.py000075500000007346151733044240005555 0ustar00#! /usr/bin/python2.7

# Emulate some Perl command line options.
# Usage: pp [-a] [-c] [-d] [-e scriptline] [-F fieldsep] [-n] [-p] [file] ...
# Where the options mean the following:
#   -a            : together with -n or -p, splits each line into list F
#   -c            : check syntax only, do not execute any code
#   -d            : run the script under the debugger, pdb
#   -e scriptline : gives one line of the Python script; may be repeated
#   -F fieldsep   : sets the field separator for the -a option [not in Perl]
#   -n            : runs the script for each line of input
#   -p            : prints the line after the script has run
# When no script lines have been passed, the first file argument
# contains the script.  With -n or -p, the remaining arguments are
# read as input to the script, line by line.  If a file is '-'
# or missing, standard input is read.

# XXX To do:
# - add -i extension option (change files in place)
# - make a single loop over the files and lines (changes effect of 'break')?
# - add an option to specify the record separator
# - except for -n/-p, run directly from the file if at all possible

import sys
import getopt

FS = ''
SCRIPT = []
AFLAG = 0
CFLAG = 0
DFLAG = 0
NFLAG = 0
PFLAG = 0

try:
    optlist, ARGS = getopt.getopt(sys.argv[1:], 'acde:F:np')
except getopt.error, msg:
    sys.stderr.write('%s: %s\n' % (sys.argv[0], msg))
    sys.exit(2)

for option, optarg in optlist:
    if option == '-a':
        AFLAG = 1
    elif option == '-c':
        CFLAG = 1
    elif option == '-d':
        DFLAG = 1
    elif option == '-e':
        for line in optarg.split('\n'):
            SCRIPT.append(line)
    elif option == '-F':
        FS = optarg
    elif option == '-n':
        NFLAG = 1
        PFLAG = 0
    elif option == '-p':
        NFLAG = 1
        PFLAG = 1
    else:
        print option, 'not recognized???'

if not ARGS: ARGS.append('-')

if not SCRIPT:
    if ARGS[0] == '-':
        fp = sys.stdin
    else:
        fp = open(ARGS[0], 'r')
    while 1:
        line = fp.readline()
        if not line: break
        SCRIPT.append(line[:-1])
    del fp
    del ARGS[0]
    if not ARGS: ARGS.append('-')

if CFLAG:
    prologue = ['if 0:']
    epilogue = []
elif NFLAG:
    # Note that it is on purpose that AFLAG and PFLAG are
    # tested dynamically each time through the loop
    prologue = [
            'LINECOUNT = 0',
            'for FILE in ARGS:',
            '   \tif FILE == \'-\':',
            '   \t   \tFP = sys.stdin',
            '   \telse:',
            '   \t   \tFP = open(FILE, \'r\')',
            '   \tLINENO = 0',
            '   \twhile 1:',
            '   \t   \tLINE = FP.readline()',
            '   \t   \tif not LINE: break',
            '   \t   \tLINENO = LINENO + 1',
            '   \t   \tLINECOUNT = LINECOUNT + 1',
            '   \t   \tL = LINE[:-1]',
            '   \t   \taflag = AFLAG',
            '   \t   \tif aflag:',
            '   \t   \t   \tif FS: F = L.split(FS)',
            '   \t   \t   \telse: F = L.split()'
            ]
    epilogue = [
            '   \t   \tif not PFLAG: continue',
            '   \t   \tif aflag:',
            '   \t   \t   \tif FS: print FS.join(F)',
            '   \t   \t   \telse: print \' \'.join(F)',
            '   \t   \telse: print L',
            ]
else:
    prologue = ['if 1:']
    epilogue = []

# Note that we indent using tabs only, so that any indentation style
# used in 'command' will come out right after re-indentation.

program = '\n'.join(prologue) + '\n'
for line in SCRIPT:
    program += '   \t   \t' + line + '\n'
program += '\n'.join(epilogue) + '\n'

import tempfile
fp = tempfile.NamedTemporaryFile()
fp.write(program)
fp.flush()
if DFLAG:
    import pdb
    pdb.run('execfile(%r)' % (fp.name,))
else:
    execfile(fp.name)
pp.pyo000064400000004436151733044250005727 0ustar00�
Afc@s_ddlZddlZdZgZdZdZdZdZdZy#ejej	dd�\Z
ZWnDejk
r�Z
ejjdej	de
f�ejd�nXx�e
D]�\ZZedkr�dZq�ed	kr�dZq�ed
kr�dZq�edkr4x{ejd�D]Zeje�qWq�ed
krIeZq�edkrddZdZq�edkrdZdZq�eGdGHq�Wes�ejd�nes(eddkr�ejZneedd�Zx+ej�Zes�Pnejed �q�W[ed=es(ejd�q(ner@dgZgZnfer�ddddddddddddd d!d"d#d$gZd%d"d&d'd(gZnd)gZgZdje�dZx eD]Zed*ed7Zq�Wedje�d7ZddlZej�Zeje�ej �erNddl!Z!e!j"d+ej#f�n
e$ej#�dS(,i����Ntiis	acde:F:nps%s: %s
is-as-cs-ds-es
s-Fs-ns-psnot recognized???t-trsif 0:s
LINECOUNT = 0sfor FILE in ARGS:s   	if FILE == '-':s   	   	FP = sys.stdins	   	else:s   	   	FP = open(FILE, 'r')s   	LINENO = 0s   	while 1:s   	   	LINE = FP.readline()s   	   	if not LINE: breaks   	   	LINENO = LINENO + 1s!   	   	LINECOUNT = LINECOUNT + 1s   	   	L = LINE[:-1]s   	   	aflag = AFLAGs   	   	if aflag:s"   	   	   	if FS: F = L.split(FS)s   	   	   	else: F = L.split()s   	   	if not PFLAG: continues#   	   	   	if FS: print FS.join(F)s#   	   	   	else: print ' '.join(F)s   	   	else: print Lsif 1:s   	   	sexecfile(%r)(%tsystgetopttFStSCRIPTtAFLAGtCFLAGtDFLAGtNFLAGtPFLAGtargvtoptlisttARGSterrortmsgtstderrtwritetexittoptiontoptargtsplittlinetappendtstdintfptopentreadlinetprologuetepiloguetjointprogramttempfiletNamedTemporaryFiletflushtpdbtruntnametexecfile(((s'/usr/lib64/python2.7/Demo/scripts/pp.pyt<module>s�#!						
				


mboxconvert.pyc000064400000006265151733044250007644 0ustar00�
Afc@s�ddlZddlZddlZddlZddlZddlZddlZd�Zejd�Z	d�Z
d�Zdadd�Z
ed	kr�e�ndS(
i����Nc	Cs�t}y#tjtjdd�\}}Wn7tjk
rb}tjjd|�tjd�nXx)|D]!\}}|dkrjt}qjqjW|s�dg}nd}x�|D]�}|dks�|dkr�|tj	�p�|}q�t
jj|�rt
|�p|}q�t
jj|�r�yt|�}Wn6tk
re}tjjd	||f�d}q�nX||�pu|}|j�q�tjjd
|�d}q�W|r�tj|�ndS(Nitfs%s
is-ft-its%s: %s
s%s: not found
(tmmdftgetopttsystargvterrortstderrtwritetexittmessagetstdintostpathtisdirtmhtisfiletopentIOErrortclose(	tdofiletoptstargstmsgtotatststargR((s0/usr/lib64/python2.7/Demo/scripts/mboxconvert.pytmains<#



s[1-9][0-9]*cCs�d}tj|�}x�|D]�}tj|�t|�krCqntjj||�}yt|�}Wn6tk
r�}t	j
jd||f�d}qnXt|�p�|}qW|S(Nis%s: %s
i(
R
tlistdirtnumerictmatchtlenRtjoinRRRRR	R(tdirRtmsgsRtfnR((s0/usr/lib64/python2.7/Demo/scripts/mboxconvert.pyR2s
cCsbd}xU|j�}|sPn|dkrCt||�p=|}q	tjjd|f�q	W|S(Nis
sBad line in MMFD mailbox: %r
(treadlineRRRR	(RRtline((s0/usr/lib64/python2.7/Demo/scripts/mboxconvert.pyRBs	iRc
Cszd}tj|�}|jd�\}}|jd�}|rQtj|�}n<tjjd|j	d�f�t
j|j��t
j}dG|Gtj|�GHx|jD]
}|Gq�W|jd�stdadt|�tf}	tjjd|	|f�d	G|	GHnHxa|j�}||kr0Pn|sPtjjd
�d}Pn|d dkrmd
|}n|GqWH|S(NitFromtDatesUnparseable date: %r
s
message-idis<%s.%d>sAdding Message-ID %s (From %s)
sMessage-ID:sUnexpected EOF in message
isFrom t>(trfc822tMessagetgetaddrtgetdatettimetmktimeRRR	t	getheaderR
tfstattfilenotstattST_MTIMEtctimetheadersthas_keytcounterthexR&(
Rt	delimiterRtmtfullnametemailtttttR'tmsgid((s0/usr/lib64/python2.7/Demo/scripts/mboxconvert.pyRQs@	

t__main__(R+RR/R
R4RtreRtcompileRRRR9Rt__name__(((s0/usr/lib64/python2.7/Demo/scripts/mboxconvert.pyt<module>s	!		
*from.pyc000064400000001357151733044260006237 0ustar00�
Afc@sddlZddlZyejdZWn4eefk
r_ejjd�ejd�nXye	e�Z
Wn"ek
r�ejde�nXx�e
j�Z
e
s�Pne
jd�r�e
d GxJe
j�Z
e
s�e
dkr�Pne
jd�r�ee
d	d!�Gq�q�WHq�q�WdS(
i����NtMAILsNo environment variable $MAIL
isCannot open mailbox file: sFrom s
s	Subject: i	(tsystostenvirontmailboxtAttributeErrortKeyErrortstderrtwritetexittopentmailtIOErrortreadlinetlinet
startswithtrepr(((s)/usr/lib64/python2.7/Demo/scripts/from.pyt<module>s,
beer.pyc000064400000001277151733044260006212 0ustar00�
Afc@s�ddlZdZejdr5eejd�Znd�ZxPeedd�D]<Zee�GdGHee�dGHdGHeed�Gd	GHqQWdS(
i����NidicCs.|dkrdS|dkr dSt|�dS(Nisno more bottles of beerisone bottle of beers bottles of beer(tstr(tn((s)/usr/lib64/python2.7/Demo/scripts/beer.pytbottles
ison the wall,t.sTake one down, pass it around,son the wall.(tsysRtargvtintRtrangeti(((s)/usr/lib64/python2.7/Demo/scripts/beer.pyt<module>s
	unbirthday.pyo000064400000005672151733044260007465 0ustar00�
Afc@sbddlZddlZddlZd�Zd�Zd�Zd�Zedkr^e�ndS(i����NcCs�tjdr#ttjd�}nttd��}d|koLdknrsdG|G|d}dG|GdGHn3d	|ko�tj�dkns�d
G|GHdStjdr�ttjd�}nttd��}d|ko�d
knsdG|GHdStjdr'ttjd�}nttd��}|dkr]tj|�r]d}n
tj|}d|ko�|kns�dG|GdGHdS|||f}t	|�}dGt
|�GHtj�d }t	|�}dGt
|�GH||krdGHdS||krdGHdS||}dG|GdGHd}	xQt||dd�D]8}
||
||fkoq|knrK|	d}	qKqKWdG|	GdGH|d|dkr�dGt|	�GdGHdGndGt||	�Gd GHdS(!NisIn which year were you born? iidsI'll assume that byilsyou meansand not the early Christian erai:s%It's hard to believe you were born inisAnd in which month? (1-12) isThere is no month numberedis&And on what day of that month? (1-31) isThere are nosdays in that month!sYou were born onsToday iss0You are a time traveler.  Go back to the future!s'You were born today.  Have a nice life!sYou have livedtdayssYou ares	years oldsCongratulations!  Today is yourtbirthdaysYesterday was yours
Today is yourt
unbirthday(
tsystargvtintt	raw_inputttimet	localtimetcalendartisleaptmdaystmkdatetformattrangetnth(tyeartmonthtdaytmaxdayt	bdaytupletbdaydatet
todaytuplet	todaydateRtagety((s//usr/lib64/python2.7/Demo/scripts/unbirthday.pytmainsb

&	
	
	



%
cCs'|\}}}d|tj||fS(Ns%d %s %d(R	t
month_name(t.0RRR((s//usr/lib64/python2.7/Demo/scripts/unbirthday.pyR
NscCs8|dkrdS|dkr dS|dkr0dSd|S(Nit1stit2ndit3rds%dth((tn((s//usr/lib64/python2.7/Demo/scripts/unbirthday.pyRQscCs�|\}}}|d}||dd}||dd}||dd}xPtd|�D]?}|d	kr�tj|�r�|d
}q_|tj|}q_W||}|S(Nimiiicidi�i�iii(RR	R
R(RRRRRti((s//usr/lib64/python2.7/Demo/scripts/unbirthday.pyRWs


t__main__(RRR	RR
RRt__name__(((s//usr/lib64/python2.7/Demo/scripts/unbirthday.pyt<module>s	B			markov.pyc000064400000007671151733044260006600 0ustar00�
Afc@s6ddd��YZd�Zedkr2e�ndS(tMarkovcBs,eZd�Zd�Zd�Zd�ZRS(cCs||_||_i|_dS(N(thistsizetchoicettrans(tselfRR((s+/usr/lib64/python2.7/Demo/scripts/markov.pyt__init__s		cCs |jj|g�j|�dS(N(Rt
setdefaulttappend(Rtstatetnext((s+/usr/lib64/python2.7/Demo/scripts/markov.pytadd	scCs�|j}|j}|d|d �xFtt|��D]2}||td||�|!|||d!�q6W||t|�|d�dS(Nii(RR
tNonetrangetlentmax(RtseqtnR
ti((s+/usr/lib64/python2.7/Demo/scripts/markov.pytputs		0cCs�|j}|j}|j}||d�}xQtr~|tdt|�|�}||}||�}|sqPn||7}q.W|S(Ni(RRRRtTrueRR
(RRRRRtsubseqtoptionsR	((s+/usr/lib64/python2.7/Demo/scripts/markov.pytgets				
(t__name__t
__module__RR
RR(((s+/usr/lib64/python2.7/Demo/scripts/markov.pyRs			cCs�ddl}ddl}ddl}|jd}y|j|d�\}}Wnm|jk
r�d|jdGHdGHdGHdGHd	GHd
GHdGHdGHd
GHdGHdGHdGHdGH|jd�nXd}t}d}x�|D]�\}}	d|ko�dknrt|d�}n|dkr&t}n|dkr?|d7}n|dkrTd}n|dkr�t}q�q�W|sdg}nt	||j
�}
y�x�|D]�}|dkr�|j}|j�r�dGHq�q�nt
|d�}|r�dG|GdGHn|j�}
|j�|
jd�}xh|D]`}|dkr;dGHn|j�}|r!|rbt|�}nd j|�}|
j|�q!q!Wq�WWntk
r�d!GHnX|
js�d"GHdS|r�d#GHn|dkrIxN|
jj�D]=}|dkst|�|kr�t|�G|
j|GHq�q�W|dkrEtd$�G|
jd$GHnHnx�tr�|
j�}|rm|}n|j�}d}d%}xF|D]>}|t|�|kr�Hd}n|G|t|�d7}q�WHHqLWdS(&Ni����it0123456789cdwqs"Usage: %s [-#] [-cddqw] [file] ...isOptions:s$-#: 1-digit history size (default 2)s-c: characters (default)s	-w: wordss-d: more debugging outputs-q: no debugging outputs3Input files (default stdin) are split in paragraphss1separated blank lines and each paragraph is splits0in words by whitespace, then reconcatenated withs#exactly one space separating words.s0Output consists of paragraphs separated by blanks4lines, where lines are no longer than 72 characters.is-0s-9s-cs-ds-qs-wt-sSorry, need stdin from filetrt
processings...s

sfeeding ...t s-Interrupted -- continue with data read so farsNo valid input filessdone.tiH(tsystrandomtgetopttargvterrortexittFalsetintRRRtstdintisattytopentreadtclosetsplitttupletjoinRtKeyboardInterruptRtkeysRR
treprR(RR R!targstoptsRtdo_wordstdebugtotatmtfilenametfttexttparalisttparatwordstdatatkeyRtlimittw((s+/usr/lib64/python2.7/Demo/scripts/markov.pyttest#s�$
	
	

		


				
	t__main__N((RRCR(((s+/usr/lib64/python2.7/Demo/scripts/markov.pyt<module>s 	U