Your IP : 18.119.125.14


Current Path : /lib64/python2.7/
Upload File :
Current File : //lib64/python2.7/os.pyo

�
�mec@s�dZddlZddlZejZddddddd	d
ddd
dddgZd�Zdekr�dZdZddl	Tyddl	m
Z
Wnek
r�nXddlZ
ddl	Z	ejee	��[	n,dekrVdZdZddlTyddlm
Z
Wnek
r$nXddlZ
ddlZejee��[n�dekrdZdZddlTyddlm
Z
Wnek
r�nXejjd�dkr�ddlZ
nddlZ
ddlmZddlZejee��[n�dekr�dZdZddlTyddlm
Z
Wnek
rQnXddlZ
ddlZejee��[n�dekr�dZdZddlTyddlm
Z
Wnek
r�nXddlZ
ddlZejee��[n	ed�e
ejd<ddlmZmZmZmZm Z m!Z!m"Z"m#Z#[d Z$d!Z%d"Z&d#d$�Z'd%�Z(d&�Z)ejd'd(d)g�e*de,d*�Z-ej.d+�ye/Wne0k
r�iZ/nXd,�Z1d-�Z2d.�Z3d/�Z4d0�Z5d1�Z6ejd2d3d4d5d6d7g�dd8�Z7ye8Wne0k
rTn�Xddl9Z9ed_kryd9�Z:nedkr�dd:l;m<Z<nAed`kr�d;e9j=fd<��YZ<nd;e9j=fd=��YZ<e<e/�Z/dd>�Z>ej.d?�d@�Z?e?dA�rle?dB�rle?dC�rld Z@d!ZAZBdD�ZCdE�ZDdF�ZEdG�ZFdH�ZGne?dB�r�dI�ZHdJ�ZIejdBdKdLdMg�ne?dN�r�dO�ZJdP�ZKejdNdQdRdSg�ne?dA�rpe?dT�sdUddV�ZLej.dT�ne?dW�sBdUddX�ZMej.dW�ne?dY�spdUddZ�ZNej.dY�qpnddlOZPd[�ZQd\�ZRyePjSeTeReQ�Wne0k
r�nXd]�ZUd^�ZVyePjSeWeVeU�Wne0k
r�nXdS(as�OS routines for Mac, NT, or Posix depending on what system we're on.

This exports:
  - all functions from posix, nt, os2, or ce, e.g. unlink, stat, etc.
  - os.path is one of the modules posixpath, or ntpath
  - os.name is 'posix', 'nt', 'os2', 'ce' or 'riscos'
  - os.curdir is a string representing the current directory ('.' or ':')
  - os.pardir is a string representing the parent directory ('..' or '::')
  - os.sep is the (or a most common) pathname separator ('/' or ':' or '\\')
  - os.extsep is the extension separator ('.' or '/')
  - os.altsep is the alternate pathname separator (None or '/')
  - os.pathsep is the component separator used in $PATH etc
  - os.linesep is the line separator in text files ('\r' or '\n' or '\r\n')
  - os.defpath is the default search path for executables
  - os.devnull is the file path of the null device ('/dev/null', etc.)

Programs that import and use 'os' stand a better chance of being
portable between different platforms.  Of course, they must then
only use functions that are defined by all platforms (e.g., unlink
and opendir), and leave all pathname manipulation to os.path
(e.g., split and join).
i����NtaltseptcurdirtpardirtseptextseptpathseptlineseptdefpathtnametpathtdevnulltSEEK_SETtSEEK_CURtSEEK_ENDcCsSyt|j�SWn;tk
rNgt|�D]}|ddkr.|^q.SXdS(Nit_(tlistt__all__tAttributeErrortdir(tmoduletn((s/usr/lib64/python2.7/os.pyt_get_exports_list#s
tposixs
(t*(t_exittnts
tos2sEMX GCC(tlinktcetriscossno os specific module foundsos.path(RRRRRRRR
iiii�cCs�tj|�\}}|s3tj|�\}}n|r�|r�tj|�r�yt||�Wn+tk
r�}|jtjkr��q�nX|tkr�dSnt||�dS(smakedirs(path [, mode=0777])

    Super-mkdir; create a leaf directory and all intermediate ones.
    Works like mkdir, except that any intermediate path segment (not
    just the rightmost) will be created if it does not exist.  This is
    recursive.

    N(	R	tsplittexiststmakedirstOSErrorterrnotEEXISTRtmkdir(Rtmodetheadttailte((s/usr/lib64/python2.7/os.pyR �s	
cCs�t|�tj|�\}}|s=tj|�\}}nxH|r�|r�yt|�Wntk
rnPnXtj|�\}}q@WdS(s�removedirs(path)

    Super-rmdir; remove a leaf directory and all empty intermediate
    ones.  Works like rmdir except that, if the leaf directory is
    successfully removed, directories corresponding to rightmost path
    segments will be pruned away until either the whole path is
    consumed or an error occurs.  Errors during this latter phase are
    ignored -- they generally mean that a directory was not empty.

    N(trmdirR	Rterror(RR&R'((s/usr/lib64/python2.7/os.pyt
removedirs�s

cCs�tj|�\}}|r>|r>tj|�r>t|�nt||�tj|�\}}|r�|r�yt|�Wq�tk
r�q�XndS(s@renames(old, new)

    Super-rename; create directories as necessary and delete any left
    empty.  Works like rename, except creation of any intermediate
    directories needed to make the new pathname good is attempted
    first.  After the rename, directories corresponding to rightmost
    path segments of the old name will be pruned way until either the
    whole path is consumed or a nonempty directory is found.

    Note: this function can fail with the new directory structure made
    if you lack permissions needed to unlink the leaf directory or
    file.

    N(R	RRR trenameR+R*(toldtnewR&R'((s/usr/lib64/python2.7/os.pytrenames�s


R R+R/ccs:tjtjtj}}}yt|�}Wn-tk
r\}|dk	rX||�ndSXgg}	}
x@|D]8}||||��r�|	j|�qq|
j|�qqW|r�||	|
fVnxX|	D]P}|||�}|s�||�r�x%t||||�D]}
|
Vq	Wq�q�W|s6||	|
fVndS(s<
Directory tree generator.

    For each directory in the directory tree rooted at top (including top
    itself, but excluding '.' and '..'), yields a 3-tuple

        dirpath, dirnames, filenames

    dirpath is a string, the path to the directory.  dirnames is a list of
    the names of the subdirectories in dirpath (excluding '.' and '..').
    filenames is a list of the names of the non-directory files in dirpath.
    Note that the names in the lists are just names, with no path components.
    To get a full path (which begins with top) to a file or directory in
    dirpath, do os.path.join(dirpath, name).

    If optional arg 'topdown' is true or not specified, the triple for a
    directory is generated before the triples for any of its subdirectories
    (directories are generated top down).  If topdown is false, the triple
    for a directory is generated after the triples for all of its
    subdirectories (directories are generated bottom up).

    When topdown is true, the caller can modify the dirnames list in-place
    (e.g., via del or slice assignment), and walk will only recurse into the
    subdirectories whose names remain in dirnames; this can be used to prune
    the search, or to impose a specific order of visiting.  Modifying
    dirnames when topdown is false is ineffective, since the directories in
    dirnames have already been generated by the time dirnames itself is
    generated.

    By default errors from the os.listdir() call are ignored.  If
    optional arg 'onerror' is specified, it should be a function; it
    will be called with one argument, an os.error instance.  It can
    report the error to continue with the walk, or raise the exception
    to abort the walk.  Note that the filename is available as the
    filename attribute of the exception object.

    By default, os.walk does not follow symbolic links to subdirectories on
    systems that support them.  In order to get this functionality, set the
    optional argument 'followlinks' to true.

    Caution:  if you pass a relative pathname for top, don't change the
    current working directory between resumptions of walk.  walk never
    changes the current directory, and assumes that the client doesn't
    either.

    Example:

    import os
    from os.path import join, getsize
    for root, dirs, files in os.walk('python/Lib/email'):
        print root, "consumes",
        print sum([getsize(join(root, name)) for name in files]),
        print "bytes in", len(files), "non-directory files"
        if 'CVS' in dirs:
            dirs.remove('CVS')  # don't visit CVS directories
    N(	R	tislinktjointisdirtlistdirR*tNonetappendtwalk(ttopttopdowntonerrortfollowlinksR0R1R2tnamesterrtdirstnondirsRtnew_pathtx((s/usr/lib64/python2.7/os.pyR6�s*9



R6cGst||�dS(spexecl(file, *args)

    Execute the executable file with argument list args, replacing the
    current process. N(texecv(tfiletargs((s/usr/lib64/python2.7/os.pytexecl3scGs"|d}t||d |�dS(s�execle(file, *args, env)

    Execute the executable file with argument list args and
    environment env, replacing the current process. i����N(texecve(RBRCtenv((s/usr/lib64/python2.7/os.pytexecle:s
cGst||�dS(s�execlp(file, *args)

    Execute the executable file (which is searched for along $PATH)
    with argument list args, replacing the current process. N(texecvp(RBRC((s/usr/lib64/python2.7/os.pytexeclpBscGs"|d}t||d |�dS(s�execlpe(file, *args, env)

    Execute the executable file (which is searched for along $PATH)
    with argument list args and environment env, replacing the current
    process. i����N(texecvpe(RBRCRF((s/usr/lib64/python2.7/os.pytexeclpeIs
cCst||�dS(s�execvp(file, args)

    Execute the executable file (which is searched for along $PATH)
    with argument list args, replacing the current process.
    args may be a list or tuple of strings. N(t_execvpe(RBRC((s/usr/lib64/python2.7/os.pyRHRscCst|||�dS(s�execvpe(file, args, env)

    Execute the executable file (which is searched for along $PATH)
    with argument list args and environment env , replacing the
    current process.
    args may be a list or tuple of strings. N(RL(RBRCRF((s/usr/lib64/python2.7/os.pyRJZsRDRGRIRKRHRJcCsZ|dk	r!t}||f}nt}|f}t}tj|�\}}|rb|||�dSd|kr{|d}nt}|jt�}d}	d}
x�|D]�}tj||�}y|||�Wq�t	k
r0}
t
j�d}|
jtj
kr1|
jtjkr1|	dkr1|
}	|}
q1q�Xq�W|	rJt	|	|
�nt	|
|�dS(NtPATHi(R4RERAtenvironR	RRRR1R*tsystexc_infoR"tENOENTtENOTDIR(RBRCRFtfunctargrestR&R'tenvpathRMt	saved_exctsaved_tbRtfullnameR(ttb((s/usr/lib64/python2.7/os.pyRLes:	


$cCst|d�dS(Nt(tputenv(tkey((s/usr/lib64/python2.7/os.pytunsetenv�s(t_EnvironR^cBs�eZd�Zd�Zd�ZyeWnek
rEd�ZnXd�Zd�Zd�Z	d�Z
d�Zdd	�Z
dd
�Zd�ZRS(
cCsJtjj|�|j}x*|j�D]\}}|||j�<q&WdS(N(tUserDictt__init__tdatatitemstupper(tselfRNRatktv((s/usr/lib64/python2.7/os.pyR`�s	cCs$t||�||j|j�<dS(N(R[RaRc(RdR\titem((s/usr/lib64/python2.7/os.pyt__setitem__�s
cCs|j|j�S(N(RaRc(RdR\((s/usr/lib64/python2.7/os.pyt__getitem__�scCs|j|j�=dS(N(RaRc(RdR\((s/usr/lib64/python2.7/os.pyt__delitem__�scCst|�|j|j�=dS(N(R]RaRc(RdR\((s/usr/lib64/python2.7/os.pyRj�s
cCs2x+|jj�D]}t|�|j|=qWdS(N(RatkeysR](RdR\((s/usr/lib64/python2.7/os.pytclear�s
cGs#t|�|jj|j�|�S(N(R]RatpopRc(RdR\RC((s/usr/lib64/python2.7/os.pyRm�s
cCs|j�|jkS(N(RcRa(RdR\((s/usr/lib64/python2.7/os.pythas_key�scCs|j�|jkS(N(RcRa(RdR\((s/usr/lib64/python2.7/os.pyt__contains__�scCs|jj|j�|�S(N(RatgetRc(RdR\tfailobj((s/usr/lib64/python2.7/os.pyRp�scKs�|rmy|j�}Wn2tk
rJxA|D]\}}|||<q-WqmXx|D]}||||<qRWn|r�|j|�ndS(N(RkRtupdate(RdtdicttkwargsRkReRf((s/usr/lib64/python2.7/os.pyRr�s

cCs
t|�S(N(Rs(Rd((s/usr/lib64/python2.7/os.pytcopy�sN(t__name__t
__module__R`RhRiR]t	NameErrorRjRlRmRnRoR4RpRrRu(((s/usr/lib64/python2.7/os.pyR^�s			

					cBsfeZd�Zd�Zdd�ZyeWnek
r?nXd�Zd�Z	d�Z
d�ZRS(cCstjj|�||_dS(N(R_R`Ra(RdRN((s/usr/lib64/python2.7/os.pyR`�scCst||�||j|<dS(N(R[Ra(RdR\Rg((s/usr/lib64/python2.7/os.pyRh�s
cKs�|rmy|j�}Wn2tk
rJxA|D]\}}|||<q-WqmXx|D]}||||<qRWn|r�|j|�ndS(N(RkRRr(RdRsRtRkReRf((s/usr/lib64/python2.7/os.pyRr�s

cCst|�|j|=dS(N(R]Ra(RdR\((s/usr/lib64/python2.7/os.pyRj�s
cCs2x+|jj�D]}t|�|j|=qWdS(N(RaRkR](RdR\((s/usr/lib64/python2.7/os.pyRl�s
cGst|�|jj||�S(N(R]RaRm(RdR\RC((s/usr/lib64/python2.7/os.pyRm�s
cCs
t|�S(N(Rs(Rd((s/usr/lib64/python2.7/os.pyRu�sN(RvRwR`RhR4RrR]RxRjRlRmRu(((s/usr/lib64/python2.7/os.pyR^�s		
			cCstj||�S(s�Get an environment variable, return None if it doesn't exist.
    The optional second argument can specify an alternate default.(RNRp(R\tdefault((s/usr/lib64/python2.7/os.pytgetenv�sRzcCs
|t�kS(N(tglobals(R((s/usr/lib64/python2.7/os.pyt_existsstforktspawnvRAcCs�t�}|sVy0|dkr.|||�n||||�Wq�td�q�Xns|tkrf|Sx`t|d�\}}t|�r�qiqit|�r�t|�St|�r�t	|�St
d�qidS(Niis"Not stopped, signaled or exited???(R}R4RtP_NOWAITtwaitpidt
WIFSTOPPEDtWIFSIGNALEDtWTERMSIGt	WIFEXITEDtWEXITSTATUSR*(R%RBRCRFRStpidtwpidtsts((s/usr/lib64/python2.7/os.pyt	_spawnvefs&	
cCst|||dt�S(sspawnv(mode, file, args) -> integer

Execute file with arguments from args in a subprocess.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it. N(R�R4RA(R%RBRC((s/usr/lib64/python2.7/os.pyR~,scCst||||t�S(s:spawnve(mode, file, args, env) -> integer

Execute file with arguments from args in a subprocess with the
specified environment.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it. (R�RE(R%RBRCRF((s/usr/lib64/python2.7/os.pytspawnve5scCst|||dt�S(s8spawnvp(mode, file, args) -> integer

Execute file (which is looked for along $PATH) with arguments from
args in a subprocess.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it. N(R�R4RH(R%RBRC((s/usr/lib64/python2.7/os.pytspawnvpAscCst||||t�S(s\spawnvpe(mode, file, args, env) -> integer

Execute file (which is looked for along $PATH) with arguments from
args in a subprocess with the supplied environment.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it. (R�RJ(R%RBRCRF((s/usr/lib64/python2.7/os.pytspawnvpeKscGst|||�S(sspawnl(mode, file, *args) -> integer

Execute file with arguments from args in a subprocess.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it. (R~(R%RBRC((s/usr/lib64/python2.7/os.pytspawnlYscGs!|d}t|||d |�S(s:spawnle(mode, file, *args, env) -> integer

Execute file with arguments from args in a subprocess with the
supplied environment.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it. i����(R�(R%RBRCRF((s/usr/lib64/python2.7/os.pytspawnlebs
R�R�R�R�cGst|||�S(sWspawnlp(mode, file, *args) -> integer

Execute file (which is looked for along $PATH) with arguments from
args in a subprocess with the supplied environment.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it. (R�(R%RBRC((s/usr/lib64/python2.7/os.pytspawnlptscGs!|d}t|||d |�S(s]spawnlpe(mode, file, *args, env) -> integer

Execute file (which is looked for along $PATH) with arguments from
args in a subprocess with the supplied environment.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it. i����(R�(R%RBRCRF((s/usr/lib64/python2.7/os.pytspawnlpe~s
R�R�R�tpopen2ttcCs�ddl}d}|j|tdd�ddl}|j}|j|dt|t�d|d|d	|d
t�}|j	|j
fS(s�Execute the shell command 'cmd' in a sub-process.  On UNIX, 'cmd'
            may be a sequence, in which case arguments will be passed directly to
            the program without shell intervention (as with os.spawnv()).  If 'cmd'
            is a string it will be passed to the shell (as with os.system()). If
            'bufsize' is specified, it sets the buffer size for the I/O pipes.  The
            file objects (child_stdin, child_stdout) are returned.i����Ns4os.popen2 is deprecated.  Use the subprocess module.t
stacklevelitshelltbufsizetstdintstdoutt	close_fds(twarningstwarntDeprecationWarningt
subprocesstPIPEtPopent
isinstancet
basestringtTrueR�R�(tcmdR%R�R�tmsgR�R�tp((s/usr/lib64/python2.7/os.pyR��s		tpopen3cCs�ddl}d}|j|tdd�ddl}|j}|j|dt|t�d|d|d	|d
|dt�}|j	|j
|jfS(s�Execute the shell command 'cmd' in a sub-process.  On UNIX, 'cmd'
            may be a sequence, in which case arguments will be passed directly to
            the program without shell intervention (as with os.spawnv()).  If 'cmd'
            is a string it will be passed to the shell (as with os.system()). If
            'bufsize' is specified, it sets the buffer size for the I/O pipes.  The
            file objects (child_stdin, child_stdout, child_stderr) are returned.i����Ns4os.popen3 is deprecated.  Use the subprocess module.R�iR�R�R�R�tstderrR�(R�R�R�R�R�R�R�R�R�R�R�R�(R�R%R�R�R�R�R�R�((s/usr/lib64/python2.7/os.pyR��s	tpopen4cCs�ddl}d}|j|tdd�ddl}|j}|j|dt|t�d|d|d	|d
|jdt	�}|j
|jfS(s�Execute the shell command 'cmd' in a sub-process.  On UNIX, 'cmd'
            may be a sequence, in which case arguments will be passed directly to
            the program without shell intervention (as with os.spawnv()).  If 'cmd'
            is a string it will be passed to the shell (as with os.system()). If
            'bufsize' is specified, it sets the buffer size for the I/O pipes.  The
            file objects (child_stdin, child_stdout_stderr) are returned.i����Ns4os.popen4 is deprecated.  Use the subprocess module.R�iR�R�R�R�R�R�(R�R�R�R�R�R�R�R�tSTDOUTR�R�R�(R�R%R�R�R�R�R�R�((s/usr/lib64/python2.7/os.pyR��s	cCs
t||�S(N(tstat_result(ttupRs((s/usr/lib64/python2.7/os.pyt_make_stat_result�scCs|j�\}}t|fS(N(t
__reduce__R�(tsrttypeRC((s/usr/lib64/python2.7/os.pyt_pickle_stat_result�scCs
t||�S(N(tstatvfs_result(R�Rs((s/usr/lib64/python2.7/os.pyt_make_statvfs_result�scCs|j�\}}t|fS(N(R�R�(R�R�RC((s/usr/lib64/python2.7/os.pyt_pickle_statvfs_result�s(sos2snt(sos2snt(Xt__doc__ROR"tbuiltin_module_namest_namesRRRRRRtImportErrort	posixpathR	textendRtntpathRtversiontfindt
os2emxpatht	_emx_linkRRRt
riscospathtmodulestos.pathRRRRRRRR
RRR
R R+R/R�R4tFalseR6R5RNRxRDRGRIRKRHRJRLR[R_R]t
riscosenvironR^tIterableUserDictRzR|tP_WAITRt	P_NOWAITOR�R~R�R�R�R�R�R�R�R�R�R�tcopy_regt	_copy_regR�R�tpickleR�R�R�R�(((s/usr/lib64/python2.7/os.pyt<module>s,		









	
:		Z


								#
5*
	%