
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
3

  \  ã               @   sº   d Z ddlZddlZddlZdddgZddœdd„Zddœd	d„Zd
d„ Zdd„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ ZejdƒZejdƒZdd„ Zdd„ Zd d!„ Zd"d„ ZdS )#zFilename globbing utility.é    NÚglobÚiglobÚescapeF)Ú	recursivec            C   s   t t| |d�ƒS )ay  Return a list of paths matching a pathname pattern.

    The pattern may contain simple shell-style wildcards a la
    fnmatch. However, unlike fnmatch, filenames starting with a
    dot are special cases that are not matched by '*' and '?'
    patterns.

    If recursive is true, the pattern '**' will match any files and
    zero or more directories and subdirectories.
    )r   )Úlistr   )Úpathnamer   © r   ú/usr/lib64/python3.6/glob.pyr   	   s    c            C   s.   t | |dƒ}|r*t| ƒr*t|ƒ}| s*t‚|S )aŒ  Return an iterator which yields the paths matching a pathname pattern.

    The pattern may contain simple shell-style wildcards a la
    fnmatch. However, unlike fnmatch, filenames starting with a
    dot are special cases that are not matched by '*' and '?'
    patterns.

    If recursive is true, the pattern '**' will match any files and
    zero or more directories and subdirectories.
    F)Ú_iglobÚ_isrecursiveÚnextÚAssertionError)r   r   ÚitÚsr   r   r	   r      s
    
c             c   s
  t jj| ƒ\}}t| ƒsP| s"t‚|r:t jj| ƒrL| V  nt jj|ƒrL| V  d S |sŠ|rtt|ƒrtt|||ƒE d H  nt	|||ƒE d H  d S || kr¨t|ƒr¨t
||dƒ}n|g}t|ƒrÎ|rÈt|ƒrÈt}qÒt	}nt}x2|D ]*}x$||||ƒD ]}t jj||ƒV  qêW qØW d S )NT)ÚosÚpathÚsplitÚ	has_magicr   ÚlexistsÚisdirr   Ú_glob2Ú_glob1r
   Ú_glob0Újoin)r   r   ÚdironlyÚdirnameÚbasenameÚdirsZglob_in_dirÚnamer   r   r	   r
   '   s2    

r
   c             C   s0   t t| |ƒƒ}t|ƒs$dd„ |D ƒ}tj||ƒS )Nc             s   s   | ]}t |ƒs|V  qd S )N)Ú	_ishidden)Ú.0Úxr   r   r	   ú	<genexpr>R   s    z_glob1.<locals>.<genexpr>)r   Ú_iterdirr   ÚfnmatchÚfilter)r   Úpatternr   Únamesr   r   r	   r   O   s    r   c             C   s8   |st jj| ƒr4|gS nt jjt jj| |ƒƒr4|gS g S )N)r   r   r   r   r   )r   r   r   r   r   r	   r   U   s    r   c             C   s   t | |dƒS )NF)r   )r   r&   r   r   r	   Úglob0b   s    r(   c             C   s   t | |dƒS )NF)r   )r   r&   r   r   r	   Úglob1e   s    r)   c             c   s.   t |ƒst‚|d d… V  t| |ƒE d H  d S )Nr   )r   r   Ú	_rlistdir)r   r&   r   r   r   r	   r   k   s    r   c             c   s”   | s"t | tƒrttjdƒ} ntj} yXtj| ƒ�D}x<|D ]4}y| sJ|jƒ rR|jV  W q6 tk
rh   Y q6X q6W W d Q R X W n tk
rŽ   d S X d S )NÚASCII)Ú
isinstanceÚbytesr   ÚcurdirÚscandirÚis_dirr   ÚOSError)r   r   r   Úentryr   r   r	   r#   r   s    

r#   c             c   sh   t t| |ƒƒ}xT|D ]L}t|ƒs|V  | r8tjj| |ƒn|}x"t||ƒD ]}tjj||ƒV  qHW qW d S )N)r   r#   r   r   r   r   r*   )r   r   r'   r!   r   Úyr   r   r	   r*   „   s    
r*   z([*?[])s   ([*?[])c             C   s(   t | tƒrtj| ƒ}n
tj| ƒ}|d k	S )N)r,   r-   Úmagic_check_bytesÚsearchÚmagic_check)r   Úmatchr   r   r	   r   ‘   s    

r   c             C   s   | d dkS )Nr   Ú.ó   .é.   )r8   r:   r   )r   r   r   r	   r   ˜   s    r   c             C   s   t | tƒr| dkS | dkS d S )Ns   **z**)r,   r-   )r&   r   r   r	   r   ›   s    
r   c             C   s<   t jj| ƒ\}} t| tƒr(tjd| ƒ} ntjd| ƒ} ||  S )z#Escape all special characters.
    s   [\1]z[\1])r   r   Ú
splitdriver,   r-   r4   Úsubr6   )r   Zdriver   r   r	   r   ¡   s
    
)Ú__doc__r   Úrer$   Ú__all__r   r   r
   r   r   r(   r)   r   r#   r*   Úcompiler6   r4   r   r   r   r   r   r   r   r	   Ú<module>   s(   
(


