o
    øüƒ\û`  ã                   @   sr  d Z ddlmZ ddlmZ ddlmZmZmZm	Z	 ddl
mZmZ ddlmZmZmZ ddlZddlZzddlZW n eyE   dZY nw zddlZW n eyW   dZY nw edu riedu riddlZe d¡ d	Zd
dg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(dZ)ej*dkZ+e+rše,Z-G dd„ de.ƒZ/e-d ƒfd!d"„Z0e+r¾ej1d#kr¾e-d ƒfd$d%„Z2e0j e2_ ne0Z2dZ3dZ4ej1d#k�roedu�rKdd&lm5Z5 e 6d'¡j7Z8dZ9d(Z:d)Z;d*Z<ej=j>Z>e>j?Z@e5jAe Be5jC¡ge@_De5jEe@_Fe>jGZHe5jEe Be5jC¡geH_De5jIeH_Fe>jJZJe5jEgeJ_De5jIeJ_Fe Kd+g d,¢¡ZLd-d.„ ZMd/d0„ ZNG d1d2„ d2e.ƒZOd3d4„ ZPe-d ƒfd5d6„ZQe+�rIe-d ƒfd7d8„Z4eQj e4_ neQZ4edu�rVejRZ3ejSZTedu�r`e3ZReTZSn¼edu�rje4ZReOZSn²e2ZRe/ZSn­ej1 Ud9¡�s|d:ej1v �rej1d;kZVedu�rñeV�rñddlWZej6ZXG d<d=„ d=ejYƒZZdZ[dZ\d>Z]d?Z^e BeZ¡Z_e Be_¡Z`ejaejb cd@¡dAdB�ZdedjeZeejfgee_DeXee_FedjgZgeXe_e`geg_Dejheg_FedjiZieXgei_Dejhei_Fe j¡ ZkG dCdD„ dDe.ƒZldEdF„ Zme-d ƒfdGd8„Z4edu�rüejRZ3ejSZTedu�re3ZReTZSnedu�reV�re4ZRelZSn	e2ZRe/ZSne2ZRe/ZSdLdIdJ„Zne+�s*ej1d#k�r.enZodS e j¡ ZkdLdKd„ZodS )MaÄ  scandir, a better directory iterator and faster os.walk(), now in the Python 3.5 stdlib

scandir() is a generator version of os.listdir() that returns an
iterator over files in a directory, and also exposes the extra
information most OSes provide while iterating files in a directory
(such as type and stat information).

This module also includes a version of os.walk() that uses scandir()
to speed it up significantly.

See README.md or https://github.com/benhoyt/scandir for rationale and
docs, or read PEP 471 (https://www.python.org/dev/peps/pep-0471/) for
more details on its inclusion into Python 3.5

scandir is released under the new BSD 3-clause license. See
LICENSE.txt for the full license text.
é    )Údivision)ÚENOENT)ÚlistdirÚlstatÚstatÚstrerror)ÚjoinÚislink)ÚS_IFDIRÚS_IFLNKÚS_IFREGNzXscandir can't find the compiled _scandir C module or ctypes, using slow generic fallbackz1.10.0ÚscandirÚwalké    i   é@   é   i @  é   i €  é€   i    i   i   é   i   i   é   é   i   )é   r   c                   @   ó^   e Zd ZdZdd„ Zedd„ ƒZddd„Zdd	d
„Zddd„Z	dd„ Z
dd„ Zdd„ ZeZdS )ÚGenericDirEntry)ÚnameÚ_statÚ_lstatÚ_scandir_pathÚ_pathc                 C   s"   || _ || _d | _d | _d | _d S ©N)r   r   r   r   r   )ÚselfÚscandir_pathr   © r"   ú9/var/www/html/env/lib/python3.10/site-packages/scandir.pyÚ__init__K   s
   
zGenericDirEntry.__init__c                 C   ó    | j d u rt| j| jƒ| _ | j S r   ©r   r   r   r   ©r    r"   r"   r#   ÚpathR   ó   
zGenericDirEntry.pathTc                 C   s<   |r| j d u rt| jƒ| _ | j S | jd u rt| jƒ| _| jS r   )r   r   r(   r   r   ©r    Úfollow_symlinksr"   r"   r#   r   X   s   

zGenericDirEntry.statc              
   C   óR   z| j |d�}W n ty! } z|jtkr‚ W Y d }~dS d }~ww |jd@ tkS ©N©r+   Fé ð  )r   ÚOSErrorÚerrnor   Úst_moder
   ©r    r+   ÚstÚer"   r"   r#   Úis_dirf   ó   
€ýzGenericDirEntry.is_dirc              
   C   r,   r-   )r   r0   r1   r   r2   r   r3   r"   r"   r#   Úis_fileo   r7   zGenericDirEntry.is_filec              
   C   sR   z| j dd�}W n ty! } z|jtkr‚ W Y d }~dS d }~ww |jd@ tkS ©NFr.   r/   )r   r0   r1   r   r2   r   ©r    r4   r5   r"   r"   r#   Ú
is_symlinkx   r7   zGenericDirEntry.is_symlinkc                 C   s   | j dd�}|jS )NFr.   )r   Úst_ino)r    r4   r"   r"   r#   Úinode�   s   zGenericDirEntry.inodec                 C   ó   d  | jj| j¡S ©Nz<{0}: {1!r}>©ÚformatÚ	__class__Ú__name__r   r'   r"   r"   r#   Ú__str__…   ó   zGenericDirEntry.__str__N©T©rC   Ú
__module__Ú__qualname__Ú	__slots__r$   Úpropertyr(   r   r6   r8   r;   r=   rD   Ú__repr__r"   r"   r"   r#   r   H   s    



			r   Ú.c                 c   s    � t | ƒD ]}t| |ƒV  qdS )z\Like os.listdir(), but yield DirEntry objects instead of returning
    a list of names.
    N)r   r   )r(   r   r"   r"   r#   Ú_scandir_generic‹   s   €ÿrN   Úwin32c                 C   ó   t | tƒr	tdƒ‚t| ƒS ©NzGos.scandir() doesn't support bytes path on Windows, use Unicode instead)Ú
isinstanceÚbytesÚ	TypeErrorrN   ©r(   r"   r"   r#   Úscandir_generic”   ó   
rV   )Úwintypeséÿÿÿÿé   l     @ l    !l
 ÚWin32StatResult)r2   r<   Úst_devÚst_nlinkÚst_uidÚst_gidÚst_sizeÚst_atimeÚst_mtimeÚst_ctimeÚst_atime_nsÚst_mtime_nsÚst_ctime_nsÚst_file_attributesc                 C   s   | j d> | jB }|d t S )z;Convert Win32 FILETIME to time since Unix epoch in seconds.r   i€–˜ )ÚdwHighDateTimeÚdwLowDateTimeÚSECONDS_BETWEEN_EPOCHS)ÚfiletimeÚtotalr"   r"   r#   Úfiletime_to_timeÕ   s   rm   c                 C   sÐ   | j }d}|t@ r|tdB O }n|tO }|t@ r|dO }n|dO }|t@ r4| jtkr4||d@ N }|tO }| j	d> | j
B }t| jƒ}t| jƒ}t| jƒ}t|ddddd||||t|d ƒt|d ƒt|d ƒ|ƒS )z.Convert Win32 FIND_DATA struct to stat_result.r   éI   i$  i¶  r/   r   i Êš;)ÚdwFileAttributesÚFILE_ATTRIBUTE_DIRECTORYr
   r   ÚFILE_ATTRIBUTE_READONLYÚFILE_ATTRIBUTE_REPARSE_POINTÚdwReserved0ÚIO_REPARSE_TAG_SYMLINKr   ÚnFileSizeHighÚnFileSizeLowrm   ÚftLastAccessTimeÚftLastWriteTimeÚftCreationTimer[   Úint)ÚdataÚ
attributesr2   r`   ra   rb   rc   r"   r"   r#   Úfind_data_to_statÚ   s.   







ûr}   c                   @   r   )ÚWin32DirEntryPython)r   r   r   Ú
_find_datar   r   Ú_inodec                 C   s.   || _ || _d | _d | _|| _d | _d | _d S r   )r   r   r   r   r   r   r€   )r    r!   r   Ú	find_datar"   r"   r#   r$   ý   ó   
zWin32DirEntryPython.__init__c                 C   r%   r   r&   r'   r"   r"   r#   r(     r)   zWin32DirEntryPython.pathTc                 C   sh   |r&| j d u r#|  ¡ rt| jƒ| _ | j S | jd u rt| jƒ| _| j| _ | j S | jd u r1t| jƒ| _| jS r   )r   r;   r   r(   r   r}   r   r*   r"   r"   r#   r     s   

ý
zWin32DirEntryPython.statc              
   C   sp   |   ¡ }|r,|r,z
|  ¡ jd@ tkW S  ty+ } z|jtkr ‚ W Y d }~dS d }~ww |r0dS | jjt	@ dkS ©Nr/   Fr   )
r;   r   r2   r
   r0   r1   r   r   ro   rp   ©r    r+   r;   r5   r"   r"   r#   r6     ó"   
€ýÿÿzWin32DirEntryPython.is_dirc              
   C   sp   |   ¡ }|r,|r,z
|  ¡ jd@ tkW S  ty+ } z|jtkr ‚ W Y d }~dS d }~ww |r0dS | jjt	@ dkS rƒ   )
r;   r   r2   r   r0   r1   r   r   ro   rp   r„   r"   r"   r#   r8   .  r…   zWin32DirEntryPython.is_filec                 C   s   | j jt@ dko| j jtkS )Nr   )r   ro   rr   rs   rt   r'   r"   r"   r#   r;   =  s   ÿÿ
þzWin32DirEntryPython.is_symlinkc                 C   s   | j d u rt| jƒj| _ | j S r   )r€   r   r(   r<   r'   r"   r"   r#   r=   B  s   
zWin32DirEntryPython.inodec                 C   r>   r?   r@   r'   r"   r"   r#   rD   G  rE   zWin32DirEntryPython.__str__NrF   rG   r"   r"   r"   r#   r~   ú   s    	



r~   c                 C   s   t | t | ¡ƒ}||_|S r   )ÚWindowsErrorÚctypesÚFormatErrorÚfilename)Úerrorr‰   Úexcr"   r"   r#   Ú	win_errorL  s   rŒ   c           	   	   c   s  � t | tƒrd}t|  dd¡dƒ}nd}t| dƒ}t ¡ }t |¡}t||ƒ}|t	kr:t 
¡ }|tkr5dS t|| ƒ‚zD	 |j}|dvrR|rK| dd¡}t| ||ƒV  t ¡ }t |¡}t||ƒ}|spt 
¡ }|tkrknt|| ƒ‚q<W t|ƒs}tt 
¡ | ƒ‚dS t|ƒsŠtt 
¡ | ƒ‚w )	úlLike os.listdir(), but yield DirEntry objects instead of returning
            a list of names.
            TÚmbcsÚstrictz*.*FN)rM   z..Úreplace)rR   rS   r   ÚdecoderX   ÚWIN32_FIND_DATAWr‡   ÚbyrefÚFindFirstFileÚINVALID_HANDLE_VALUEÚGetLastErrorÚERROR_FILE_NOT_FOUNDrŒ   Ú	cFileNameÚencoder~   ÚFindNextFileÚERROR_NO_MORE_FILESÚ	FindClose)	r(   Úis_bytesr‰   r{   Údata_pÚhandlerŠ   r   Úsuccessr"   r"   r#   Ú_scandir_pythonQ  sF   €







ðÿr¡   c                 C   rP   rQ   )rR   rS   rT   r¡   rU   r"   r"   r#   Úscandir_python~  rW   r¢   )ÚlinuxÚdarwinÚsunos5Úbsdr¥   c                	   @   sÎ   e Zd Zej d¡r$dejfdejfdej	fdej
fdejd ffZdS dejv rMdejfdejfdejfdejfd	ejfd
ejd fdejd ffZdS dejfdej	fdej
fd	ej
fdejd ffZdS )ÚDirentr£   Úd_inoÚd_offÚd_reclenÚd_typeÚd_namer   ÚopenbsdÚd_namlenÚ__d_paddingr   N)rC   rH   rI   ÚsysÚplatformÚ
startswithr‡   Úc_ulongÚc_longÚc_ushortÚc_byteÚc_charÚ_fields_Úc_uint64Úc_uint16Úc_uint8Úc_uint32r"   r"   r"   r#   r§      s.    û
ùûr§   é   é
   ÚcT)Ú	use_errnoc                   @   r   )ÚPosixDirEntry)r   Ú_d_typer   r   r   r   r€   c                 C   s.   || _ || _|| _|| _d | _d | _d | _d S r   )r   r   rÂ   r€   r   r   r   )r    r!   r   r«   r=   r"   r"   r#   r$   Ö  r‚   zPosixDirEntry.__init__c                 C   r%   r   r&   r'   r"   r"   r#   r(   ß  r)   zPosixDirEntry.pathTc                 C   sh   |r&| j d u r#|  ¡ rt| jƒ| _ | j S | jd u rt| jƒ| _| j| _ | j S | jd u r1t| jƒ| _| jS r   )r   r;   r   r(   r   r   r*   r"   r"   r#   r   å  s   

ý
zPosixDirEntry.statc              
   C   ór   | j tks|r4|  ¡ r4z| j|d�}W n ty, } z|jtkr!‚ W Y d }~dS d }~ww |jd@ tkS | j t	kS r-   )
rÂ   Ú
DT_UNKNOWNr;   r   r0   r1   r   r2   r
   ÚDT_DIRr3   r"   r"   r#   r6   ô  ó   
ÿÿ
€ý
zPosixDirEntry.is_dirc              
   C   rÃ   r-   )
rÂ   rÄ   r;   r   r0   r1   r   r2   r   ÚDT_REGr3   r"   r"   r#   r8     rÆ   zPosixDirEntry.is_filec              
   C   sf   | j tkr.z| jdd�}W n ty& } z|jtkr‚ W Y d }~dS d }~ww |jd@ tkS | j tkS r9   )	rÂ   rÄ   r   r0   r1   r   r2   r   ÚDT_LNKr:   r"   r"   r#   r;     s   

€ý
zPosixDirEntry.is_symlinkc                 C   s   | j S r   )r€   r'   r"   r"   r#   r=     s   zPosixDirEntry.inodec                 C   r>   r?   r@   r'   r"   r"   r#   rD     rE   zPosixDirEntry.__str__NrF   rG   r"   r"   r"   r#   rÁ   Ó  s    	



rÁ   c                 C   s    t  ¡ }t|t|ƒƒ}| |_|S r   )r‡   Ú	get_errnor0   r   r‰   )r‰   r1   r‹   r"   r"   r#   Úposix_error"  s   rÊ   c                 c   s¼   � t | tƒr| }d}n|  t¡}d}t|ƒ}|st| ƒ‚z8tƒ }	 tƒ }t|||ƒr.t| ƒ‚|s1n|j	}|dvrI|s?| 
t¡}t| ||j|jƒV  q!W t|ƒrSt| ƒ‚dS t|ƒr]t| ƒ‚w )r�   TF)ó   .s   ..N)rR   rS   r™   Úfile_system_encodingÚopendirrÊ   ÚDirent_pr§   Ú	readdir_rr¬   r‘   rÁ   r«   r¨   Úclosedir)r(   Úopendir_pathr�   Údir_pÚresultÚentryr   r"   r"   r#   r¢   (  s8   €


öÿ
Fc              
   c   s¬  � g }g }zt | ƒ}W n ty& } z|dur||ƒ W Y d}~dS d}~ww 	 zzt|ƒ}W n
 ty9   Y W nnw W n tyV } z|durK||ƒ W Y d}~dS d}~ww z| ¡ }	W n tyh   d}	Y nw |	rr| |j¡ n| |j¡ |s¦|	r¦|r�d}
nz| ¡ }W n ty’   d}Y nw | }
|
r¦t|j	|||ƒD ]}|V  q q(|rÎ| ||fV  |D ]}t
| |ƒ}|s¾t|ƒsËt||||ƒD ]}|V  qÅq±dS | ||fV  dS )z�Like Python 3.5's implementation of os.walk() -- faster than
    the pre-Python 3.5 version as it uses scandir() internally.
    NTF)r   r0   ÚnextÚStopIterationr6   Úappendr   r;   r   r(   r   r	   )ÚtopÚtopdownÚonerrorÚfollowlinksÚdirsÚnondirsÚ
scandir_itrŠ   rÔ   r6   Ú	walk_intor;   r   Únew_pathr"   r"   r#   Ú_walk[  sp   €€ýÿÿ€ýýüØ+
€ørá   c                 C   s"   t | tƒr
|  t¡} t| |||ƒS r   )rR   rS   r‘   rÌ   rá   )rØ   rÙ   rÚ   rÛ   r"   r"   r#   r   ²  s   

)TNF)pÚ__doc__Ú
__future__r   r1   r   Úosr   r   r   r   Úos.pathr   r	   r
   r   r   Úcollectionsr°   Ú_scandirÚImportErrorr‡   ÚwarningsÚwarnÚ__version__Ú__all__ÚFILE_ATTRIBUTE_ARCHIVEÚFILE_ATTRIBUTE_COMPRESSEDÚFILE_ATTRIBUTE_DEVICErp   ÚFILE_ATTRIBUTE_ENCRYPTEDÚFILE_ATTRIBUTE_HIDDENÚFILE_ATTRIBUTE_INTEGRITY_STREAMÚFILE_ATTRIBUTE_NORMALÚ"FILE_ATTRIBUTE_NOT_CONTENT_INDEXEDÚFILE_ATTRIBUTE_NO_SCRUB_DATAÚFILE_ATTRIBUTE_OFFLINErq   rr   ÚFILE_ATTRIBUTE_SPARSE_FILEÚFILE_ATTRIBUTE_SYSTEMÚFILE_ATTRIBUTE_TEMPORARYÚFILE_ATTRIBUTE_VIRTUALÚversion_infoÚIS_PY3ÚstrÚunicodeÚobjectr   rN   r±   rV   Ú	scandir_cr¢   rX   Úc_void_pÚvaluer•   r—   r›   rt   rj   ÚwindllÚkernel32ÚFindFirstFileWr”   ÚLPCWSTRÚPOINTERr’   ÚargtypesÚHANDLEÚrestypeÚFindNextFileWrš   ÚBOOLrœ   Ú
namedtupler[   rm   r}   r~   rŒ   r¡   r   ÚDirEntryÚ
DirEntry_cr²   Úhave_dirent_d_typeÚctypes.utilÚDIR_pÚ	Structurer§   rÄ   rÅ   rÇ   rÈ   rÎ   Ú	Dirent_ppÚCDLLÚutilÚfind_libraryÚlibcrÍ   Úc_char_prÏ   Úc_intrÐ   ÚgetfilesystemencodingrÌ   rÁ   rÊ   rá   r   r"   r"   r"   r#   Ú<module>   s   ÿÿ

C


þ
þ
 R,







O


P