AlkantarClanX12

Your IP : 3.145.59.89


Current Path : /proc/self/root/opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python35/lib64/python3.5/__pycache__/os.cpython-35.opt-1.pyc



��Yf���0@s�	dZddlZddlZddlZejZddddddd	d
ddd
ddddddddgZdd�Zdd�Z	dekr<dZ
dZddlTy!ddlm
Z
ejd�Wnek
r�YnXddlZyddlmZWnek
rYnXddlZeje	e��[npd ekr�d Z
d!ZddlTy!ddlm
Z
ejd�Wnek
r�YnXddlZddlZeje	e��[yddlmZWq�ek
r�Yq�Xn�d"ekr�d"Z
d!ZddlTy!ddlm
Z
ejd�Wnek
rEYnXddlZddlZeje	e��[yddlmZWq�ek
r�Yq�Xned#��eejd$<dd%lmZmZmZmZmZmZmZm Z [ed&�r�e!�Z"d'd(�Z#e$�Z%e#d)d*�e#d+d,�e#d-d.�e#d/d0�e#d1d2�e#d3d4�e#d5d6�e#d7d8�e#d9d:�e#d;d<�e#d=d>�e#d?d@�e#dAdB�e#dCdD�e#dCdE�e#dFd2�e%Z&e$�Z%e#d)d*�e%Z'e$�Z%e#dGdH�e#dId,�e#dJd.�e#dKdL�e#dMdN�e%j(e�e#dOdP�e#dQd2�e#dRd2�e#dSdT�edU�r�edV�r�e#dWdU�e%Z)e$�Z%e#d)d*�e#d-d.�e#d/d0�e#dXdY�e#dZd,�ed[�r+e#d\d.�e#d3d4�e#d]d2�e#d^d0�e#d/d0�e#dFd2�e#d_d0�e%Z*[%[["[#dZ+d`Z,daZ-dbdcddde�Z.dfdg�Z/dhdi�Z0ejdedgdig�djddcdkdl�Z1Gdmdn�dn�Z2dodp�Z3ejdl�e4ehe&kr|e5ehe)kr|dqdjddrdcdsddtdu�Z6dvdw�Z7ejdu�ye8Wne9k
r�iZ8YnXdxdy�Z:dzd{�Z;d|d}�Z<d~d�Z=d�d��Z>d�d��Z?ejdyd{d}dd�d�g�dd�d��Z@dd�d�ZAdd�lBmCZCGd�d��d�eC�ZDy
eEZFWne9k
rtd�d��ZFYnXd�ekr�ejd��y
eGZHWne9k
r�d�d��ZHYnXd�ekr�ejd��d�d��ZIeI�Z8[Idd�d��ZJe
d kZKejd��eKrdd�d��ZLeDe8jMeLeNeLeNeFeH�ZO[Ldd�d��ZPejd��d�d��ZQeQ�\ZRZS[Qed��r"	ed��r"	ed��r"	dZTd`ZUZVejd�d�d�g�d�d��ZWd�d��ZXd�d��ZYd�d��ZZd�d��Z[ejd�d�d�d�g�ed��rY	d�d��Z\d�d��Z]ejd�d�g�ed��r�	d�d��Z^d�d��Z_ejd�d�g�d�d�d�d�Z`Gd�d��d��Zad�d�ZbdS)�aaOS routines for NT or Posix depending on what system we're on.

This exports:
  - all functions from posix, nt or ce, e.g. unlink, stat, etc.
  - os.path is either posixpath or ntpath
  - os.name is either 'posix', 'nt' or 'ce'.
  - 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 (always '.')
  - 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).
�N�altsep�curdir�pardir�sep�pathsep�linesep�defpath�name�path�devnull�SEEK_SET�SEEK_CUR�SEEK_END�fsencode�fsdecode�
get_exec_path�fdopen�popen�extsepcCs
|t�kS)N)�globals)r	�r�'/opt/alt/python35/lib64/python3.5/os.py�_exists%srcCsAyt|j�SWn)tk
r<dd�t|�D�SYnXdS)NcSs&g|]}|ddkr|�qS)r�_r)�.0�nrrr�
<listcomp>,s	z%_get_exports_list.<locals>.<listcomp>)�list�__all__�AttributeError�dir)�modulerrr�_get_exports_list(s
r"�posix�
)�*)�_exitr&)�_have_functions�ntz
�cezno os specific module foundzos.path)rrrrrrrrr'cCs-|tkr)|tkr)tjt|�dS)N)�_globalsr'�_set�add)�str�fnrrr�_addysr/�HAVE_FACCESSAT�access�
HAVE_FCHMODAT�chmod�
HAVE_FCHOWNAT�chown�HAVE_FSTATAT�stat�HAVE_FUTIMESAT�utime�HAVE_LINKAT�link�HAVE_MKDIRAT�mkdir�
HAVE_MKFIFOAT�mkfifo�HAVE_MKNODAT�mknod�HAVE_OPENAT�open�HAVE_READLINKAT�readlink�
HAVE_RENAMEAT�rename�HAVE_SYMLINKAT�symlink�
HAVE_UNLINKAT�unlink�rmdir�HAVE_UTIMENSAT�HAVE_FCHDIR�chdir�HAVE_FCHMOD�HAVE_FCHOWN�HAVE_FDOPENDIR�listdir�HAVE_FEXECVE�execve�HAVE_FTRUNCATE�truncate�
HAVE_FUTIMENS�HAVE_FUTIMES�HAVE_FPATHCONF�pathconf�statvfs�fstatvfs�
HAVE_FSTATVFS�
HAVE_LCHFLAGSZchflags�HAVE_LCHMOD�lchown�HAVE_LCHOWN�HAVE_LUTIMES�
HAVE_LSTATZ
MS_WINDOWS��i�FcCs�tj|�\}}|s0tj|�\}}|r�|r�tj|�r�yt|||�Wntk
rtYnXt}t|t�r�ttd�}||kr�dSyt||�Wn,t	k
r�|s�tj
|�r��YnXdS)a�makedirs(name [, mode=0o777][, exist_ok=False])

    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. If the target directory already
    exists, raise an OSError if exist_ok is False. Otherwise no exception is
    raised.  This is recursive.

    �ASCIIN)r
�split�exists�makedirs�FileExistsErrorr�
isinstance�bytesr=�OSError�isdir)r	�mode�exist_ok�head�tail�cdirrrrrj�s$


rjcCs�t|�tj|�\}}|s:tj|�\}}xI|r�|r�yt|�Wntk
rlPYnXtj|�\}}q=WdS)a�removedirs(name)

    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)rLr
rhrn)r	rrrsrrr�
removedirs�s

rucCs�tj|�\}}|r;|r;tj|�r;t|�t||�tj|�\}}|r�|r�yt|�Wntk
r�YnXdS)a<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 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
rhrirjrGrurn)�old�newrrrsrrr�renamess


rxTc$cs�g}g}yFtdkr9t|t�r9t|�}nt|�}t|�}Wn?tk
r�}z|dk	r}||�dSWYdd}~XnXx�|D]�}	y|	j�}
Wntk
r�d}
YnX|
r�|j|	j�n|j|	j�|r�|
r�|rd}n2y|	j	�}Wntk
r;d}YnX|}|r�t
|	j|||�EdHq�W|r�|||fVtjtj
}
}xY|D]@}|||�}|s�|
|�r�t
||||�EdHq�Wn|||fVdS)a�
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. No matter
    the value of topdown, the list of subdirectories is retrieved before the
    tuples for the directory and its subdirectories are generated.

    By default errors from the os.scandir() call are ignored.  If
    optional arg 'onerror' is specified, it should be a function; it
    will be called with one argument, an OSError 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", end="")
        print(sum([getsize(join(root, name)) for name in files]), end="")
        print("bytes in", len(files), "non-directory files")
        if 'CVS' in dirs:
            dirs.remove('CVS')  # don't visit CVS directories

    r(NFT)r	rlrm�_dummy_scandir�scandirrrn�is_dir�append�
is_symlink�walkr
�islink�join)�top�topdown�onerror�followlinks�dirs�nondirs�
scandir_it�entries�error�entryr{�	walk_intor}rr��dirname�new_pathrrrr~*sJ;



	

r~c@sLeZdZdZdd�Zdddd�Zdd	�Zd
d�ZdS)
�_DummyDirEntryz�Dummy implementation of DirEntry

    Only used internally by os.walk(bytes). Since os.walk() doesn't need the
    follow_symlinks parameter: don't implement it, always follow symbolic
    links.
    cCs]||_tj||�|_d|_d|_y|jdd�Wntk
rXYnXdS)N�follow_symlinksF)r	r
r��_stat�_lstatr7rn)�selfr r	rrr�__init__�s			
z_DummyDirEntry.__init__r�TcCs`|r.|jdkr't|j�|_|jS|jdkrUt|jdd�|_|jSdS)Nr�F)r�r7r
r�)r�r�rrrr7�sz_DummyDirEntry.statcCsZ|jdk	r>|j�r>|jdd�}tj|j�S|j�}tj|j�S)Nr�F)r�r}r7�st�S_ISDIR�st_mode)r�r7rrrr{�s
z_DummyDirEntry.is_dircCs"|jdd�}tj|j�S)Nr�F)r7r��S_ISLNKr�)r�r7rrrr}�sz_DummyDirEntry.is_symlinkN)�__name__�
__module__�__qualname__�__doc__r�r7r{r}rrrrr��s

	r�ccs)x"t|�D]}t||�Vq
WdS)N)rSr�)r r	rrrry�sry�.r��dir_fdccs�t|ddd|�}t|td|�}zO|s`tj|j�r{tj|t|��r{t|||||�EdHWdt	|�XdS)aDirectory tree generator.

        This behaves exactly like walk(), except that it yields a 4-tuple

            dirpath, dirnames, filenames, dirfd

        `dirpath`, `dirnames` and `filenames` are identical to walk() output,
        and `dirfd` is a file descriptor referring to the directory `dirpath`.

        The advantage of fwalk() over walk() is that it's safe against symlink
        races (when follow_symlinks is False).

        If dir_fd is not None, it should be a file descriptor open to a directory,
          and top should be relative; top will then be relative to that directory.
          (dir_fd is always supported for fwalk.)

        Caution:
        Since fwalk() yields file descriptors, those are only valid until the
        next iteration step, so you should dup() them if you want to keep them
        for a longer period.

        Example:

        import os
        for root, dirs, files, rootfd in os.fwalk('python/Lib/email'):
            print(root, "consumes", end="")
            print(sum([os.stat(name, dir_fd=rootfd).st_size for name in files]),
                  end="")
            print("bytes in", len(files), "non-directory files")
            if 'CVS' in dirs:
                dirs.remove('CVS')  # don't visit CVS directories
        r�Fr�N)
r7rC�O_RDONLYr�r�r�r
�samestat�_fwalk�close)r�r�r�r�r��orig_st�topfdrrr�fwalk�s#r�c
cs�t|�}gg}}x�|D]�}y?tjt|d|�j�rW|j|�n
|j|�Wq tk
r�y5tjt|d|dd�j�r�|j|�Wntk
r�w YnXYq Xq W|r�||||fVx�|D]�}y1t|d|d|�}	t|t	d|�}
Wn>tk
r`}z|dk	rK||�w�WYdd}~XnXzO|s�t
j|	t|
��r�t
j||�}t
|
||||�EdHWdt|
�Xq�W|s�||||fVdS)Nr�r�F)rSr�r�r7r�r|rnr�rCr�r
r�r�r�r�)
r��toppathr�r�r��namesr�r�r	r��dirfd�err�dirpathrrrr�s<


$


r�cGst||�dS)zpexecl(file, *args)

    Execute the executable file with argument list args, replacing the
    current process. N)�execv)�file�argsrrr�execlBsr�cGs(|d}t||dd�|�dS)z�execle(file, *args, env)

    Execute the executable file with argument list args and
    environment env, replacing the current process. reN���r�)rU)r�r��envrrr�execleIs
r�cGst||�dS)z�execlp(file, *args)

    Execute the executable file (which is searched for along $PATH)
    with argument list args, replacing the current process. N)�execvp)r�r�rrr�execlpQsr�cGs(|d}t||dd�|�dS)z�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. reNr�r�)�execvpe)r�r�r�rrr�execlpeXs
r�cCst||�dS)z�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)�_execvpe)r�r�rrrr�asr�cCst|||�dS)z�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)r�)r�r�r�rrrr�isr�cCs{|dk	r!t}||f}nt}|f}t}tj|�\}}|rb|||�dSd}}d}	t|�}
tdkr�t|�}tt|
�}
x�|
D]�}tj	||�}y|||�Wq�t
k
rN}
zW|
}tj�d}|
j
t
jkr<|
j
t
jkr<|dkr<|
}|}	WYdd}
~
Xq�Xq�W|rh|j|	��|j|��dS)Nr(rf)rUr��environr
rhrr	r�mapr�rn�sys�exc_info�errno�ENOENT�ENOTDIR�with_traceback)r�r�r��	exec_func�argrestrrrs�last_exc�	saved_exc�saved_tb�	path_listr �fullname�e�tbrrrr�ts<	


$r�cCsddl}|dkrt}|j���|jdt�y|jd�}Wntk
rhd}YnXtr�y|d}Wnttfk
r�YnX|dk	r�t	d��|}|dk	r�t
|t�r�t|�}WdQRX|dkr�t
}|jt�S)z�Returns the sequence of directories that will be searched for the
    named executable (similar to a shell) when launching a process.

    *env* must be an environment variable dict or None.  If *env* is None,
    os.environ will be used.
    rN�ignore�PATHsPATHz*env cannot contain 'PATH' and b'PATH' keys)�warningsr��catch_warnings�simplefilter�BytesWarning�get�	TypeError�supports_bytes_environ�KeyError�
ValueErrorrlrmrrrhr)r�r�r��
path_listbrrrr�s.


	)�MutableMappingc@s|eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)�_EnvironcCsC||_||_||_||_||_||_||_dS)N)�	encodekey�	decodekey�encodevalue�decodevalue�putenv�unsetenv�_data)r��datar�r�r�r�r�r�rrrr��s						z_Environ.__init__cCsKy|j|j|�}Wn!tk
r=t|�d�YnX|j|�S)N)r�r�r�r�)r��key�valuerrr�__getitem__�s

z_Environ.__getitem__cCs?|j|�}|j|�}|j||�||j|<dS)N)r�r�r�r�)r�r�r�rrr�__setitem__�sz_Environ.__setitem__cCsR|j|�}|j|�y|j|=Wn!tk
rMt|�d�YnXdS)N)r�r�r�r�)r�r��
encodedkeyrrr�__delitem__�s

z_Environ.__delitem__ccs2t|j�}x|D]}|j|�VqWdS)N)rr�r�)r��keysr�rrr�__iter__�s
z_Environ.__iter__cCs
t|j�S)N)�lenr�)r�rrr�__len__�sz_Environ.__len__cs2djdj�fdd��jj�D���S)Nzenviron({{{}}})z, c3s9|]/\}}dj�j|��j|��VqdS)z
{!r}: {!r}N)�formatr�r�)rr�r�)r�rr�	<genexpr>�sz$_Environ.__repr__.<locals>.<genexpr>)r�r�r��items)r�r)r�r�__repr__�sz_Environ.__repr__cCs
t|�S)N)�dict)r�rrr�copy�sz
_Environ.copycCs||kr|||<||S)Nr)r�r�r�rrr�
setdefault�s
z_Environ.setdefaultN)r�r�r�r�r�r�r�r�r�r�r�r�rrrrr��s		r�cCsdS)Nr)r�r�rrr�<lambda>sr�r�cCs
t|d�S)N�)�_putenv)r�rrrr�sr�cs�tdkrldd�}|�t}�fdd�}i}xitj�D]\}}||||�<qIWn<tj���fdd���fdd	�}�}t}t|||�|tt�S)
Nr(cSs,t|t�s(tdt|�j��|S)Nzstr expected, not %s)rlr-r��typer�)r�rrr�	check_strsz!_createenviron.<locals>.check_strcs�|�j�S)N)�upper)r�)�encoderrr�sz!_createenviron.<locals>.encodekeycs8t|t�s(tdt|�j��|j�d�S)Nzstr expected, not %s�surrogateescape)rlr-r�r�r�r�)r�)�encodingrrr�sz_createenviron.<locals>.encodecs|j�d�S)Nr�)�decode)r�)r�rrr�"sz_createenviron.<locals>.decode)	r	r-r�r�r��getfilesystemencodingr�r��	_unsetenv)r�r�r�r�r�r�r)r�r�r�_createenviron
s"r�cCstj||�S)z�Get an environment variable, return None if it doesn't exist.
    The optional second argument can specify an alternate default.
    key, default and the result are str.)r�r�)r��defaultrrr�getenv0sr�r�cCs,t|t�s(tdt|�j��|S)Nzbytes expected, not %s)rlrmr�r�r�)r�rrr�_check_bytes:sr�cCstj||�S)z�Get an environment variable, return None if it doesn't exist.
        The optional second argument can specify an alternate default.
        key, default and the result are bytes.)�environbr�)r�r�rrr�getenvbFsr�r�cs[tj���dkr!d�nd���fdd�}��fdd�}||fS)N�mbcs�strictr�csOt|t�r|St|t�r2|j���Stdt|�j��dS)z�
        Encode filename to the filesystem encoding with 'surrogateescape' error
        handler, return bytes unchanged. On Windows, use 'strict' error handler if
        the file system encoding is 'mbcs' (which is the default encoding).
        zexpect bytes or str, not %sN)rlrmr-r�r�r�r�)�filename)r��errorsrrrUs
z_fscodec.<locals>.fsencodecsOt|t�r|St|t�r2|j���Stdt|�j��dS)z�
        Decode filename from the filesystem encoding with 'surrogateescape' error
        handler, return str unchanged. On Windows, use 'strict' error handler if
        the file system encoding is 'mbcs' (which is the default encoding).
        zexpect bytes or str, not %sN)rlr-rmr�r�r�r�)r)r�rrrrbs
z_fscodec.<locals>.fsdecode)r�r�)rrr)r�rr�_fscodecNs	

r�fork�spawnvr��P_WAIT�P_NOWAIT�	P_NOWAITOc
Cs�t�}|sWy0|dkr.|||�n||||�Wq�td�Yq�Xnw|tkrg|Sxdt|d�\}}t|�r�qjqjt|�r�t|�St|�r�t|�St	d��qjWdS)N�rz"Not stopped, signaled or exited???)
rr&r�waitpid�
WIFSTOPPED�WIFSIGNALED�WTERMSIG�	WIFEXITED�WEXITSTATUSrn)rpr�r�r��func�pid�wpid�stsrrr�	_spawnvef�s&	
rcCst|||dt�S)aspawnv(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)rr�)rpr�r�rrrr�scCst||||t�S)a: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. )rrU)rpr�r�r�rrr�spawnve�srcCst|||dt�S)a8spawnvp(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)rr�)rpr�r�rrr�spawnvp�srcCst||||t�S)a\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. )rr�)rpr�r�r�rrr�spawnvpe�srcGst|||�S)aspawnl(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)rpr�r�rrr�spawnl�srcGs'|d}t|||dd�|�S)a: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. reNr�r�)r)rpr�r�r�rrr�spawnle�s
rcGst|||�S)aWspawnlp(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)rpr�r�rrr�spawnlp�srcGs'|d}t|||dd�|�S)a]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. reNr�r�)r)rpr�r�r�rrr�spawnlpe�s
r�rcCst|t�s%tdt|���|dkrAtd|��|dksY|dkretd��ddl}ddl}|dkr�|j|ddd	|jd
|�}t	|j
|j�|�S|j|ddd|jd
|�}t	|j
|j�|�SdS)
Nz&invalid cmd type (%s, expected string)r�wzinvalid mode %rrz+popen() does not support unbuffered streams�shellT�stdout�bufsize�stdin)rr)
rlr-r�r�r��
subprocess�io�Popen�PIPE�_wrap_close�
TextIOWrapperr r")�cmdrp�	bufferingr#r$�procrrrrs$				c@sXeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)r'cCs||_||_dS)N)�_stream�_proc)r��streamr+rrrr�s	z_wrap_close.__init__cCsH|jj�|jj�}|dkr,dStdkr<|S|d>SdS)Nrr(�)r,r�r-�waitr	)r��
returncoderrrr�s
z_wrap_close.closecCs|S)Nr)r�rrr�	__enter__$sz_wrap_close.__enter__cGs|j�dS)N)r�)r�r�rrr�__exit__&sz_wrap_close.__exit__cCst|j|�S)N)�getattrr,)r�r	rrr�__getattr__(sz_wrap_close.__getattr__cCs
t|j�S)N)�iterr,)r�rrrr�*sz_wrap_close.__iter__N)	r�r�r�r�r�r2r3r5r�rrrrr's	r'cOsDt|t�s%tdt|���ddl}|j|||�S)Nz&invalid fd type (%s, expected integer)r)rl�intr�r�r$rC)�fdr��kwargsr$rrrr.s)r�r�)r�r�r�)cr�r�r�r7r��builtin_module_namesZ_namesrrr"r	rr#r&r|�ImportError�	posixpathr
r'�extendr(Zntpathr)�modulesZos.pathrrrrrrrrrr*r/�setr+�supports_dir_fd�supports_effective_idsr,�supports_fd�supports_follow_symlinksrr
rrjrurxr~r�ryrCrSr�r�r��	NameErrorr�r�r�r�r�r�r�r�_collections_abcr�r�r�r�r�r�r�r�r�r�r�rmr�r�rrrrrr	rrrrrrrrrrr'rrrrr�<module>s�	









:		















	
	










	











 �+
$!,/

		#-7





	
	
#%