Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
zip.cpython-313.pyc51 linesDownload Raw Back to __pycache__
1�

2�jw��>�SSKrSSKrSSKrSSKJr "SS\5rg)�N)�AbstractArchiveFileSystemc�^�\rSrSrSrSrSrSrSSSS\RSS4U4S	jjr3\U4S4j5rSr
SrS
rSrSSjrSSjrSrU=r$)�
ZipFileSystem�z�Read/Write contents of ZIP archive as a file-system5 6Keeps file object open while instance lives.7 8This class is pickleable, but not necessarily thread-safe9��zipF�rNTc�>�[T10U]"U40UD6 U[S5;a[SUS35eX l[U[[R45(a0US:XaSn	OUS-n	[R"U4X�S.U=(d 0D6nX`lXlUR5Ul[R "URUUUUS9UlS	Ulg	)11a+12Parameters13----------14fo: str or file-like15    Contains ZIP, and must exist. If a str, will fetch file using16    :meth:`~fsspec.open_files`, which must return one file exactly.17mode: str18    Accept: "r", "w", "a"19target_protocol: str (optional)20    If ``fo`` is a string, this value can be used to override the21    FS protocol inferred from a URL22target_options: dict (optional)23    Kwargs passed when instantiating the target FS, if ``fo`` is24    a string.25compression, allowZip64, compresslevel: passed to ZipFile26    Only relevant when creating a ZIP27�rwazmode 'z' no understood�azr+b�b)�mode�protocol)r�compression�28allowZip64�
compresslevelN)�super�__init__�set�29ValueErrorr�30isinstance�str�os�PathLike�fsspec�open�force_zip_64�of�	__enter__�fo�zipfile�ZipFiler�	dir_cache)�selfr r�target_protocol�target_optionsrrr�kwargs�m�	__class__s          ��`D:\code\apps\devtools\python\user_packages\Python313\site-packages\fsspec/implementations/zip.pyr�ZipFileSystem.__init__s����8	����(��(��s�5�z�!��v�d�V�?�;�<�<��	��b�3����,�-�-��s�{����3�J���������9G�9M�2��B�'�����,�,�.����?�?��G�G��#�!�'�31������c�@>�[TU]U5RS5$)N�/)r�_strip_protocol�lstrip)�cls�pathr)s  �r*r/�ZipFileSystem._strip_protocolHs ����w�&�t�,�3�3�C�8�8r,c���[US5(aUR5 U?[US5(a:[URS5(aURR	SSS5 ggg)Nrr�__exit__)�hasattr�closerrr5�r$s r*�__del__�ZipFileSystem.__del__MsY���4�����J�J�L����4����7�4�7�7�J�#?�#?��G�G���T�4��.�$@�r,c�8�URR5 g)z;Commits any write changes to the file. Done on ``del`` too.N)rr7r8s r*r7�ZipFileSystem.closeTs�������r,c32��URbUR[S5;GaURR	5nURURR
55Vs0sH(nURS5URS5SSS._M* snUlUH�n[RRVs0sHoD[X4S5_M nnURURRS5URUR5(aSOSS.5 XPRUS'M� ggs snfs snf)N�war.r�	directory)�name�size�type�filer@)r#rrr�infolist�
_all_dirnames�namelist�rstripr!�ZipInfo�	__slots__�getattr�update�filename�	file_size�is_dir)r$�files�dirname�z�s�fs      r*�	_get_dirs�ZipFileSystem._get_dirsXs$���>�>�!�T�Y�Y�#�d�)�%;��H�H�%�%�'�E� $�1�1�$�(�(�2C�2C�2E�F�
� G�G����s�#�#�N�N�3�/��'�&��33 G�
�D�N���5<�_�_�5N�5N�O�5N����d�+�+�5N��O���� !�34�35� 1� 1�#� 6� !���01���36�37�����-.���q��y�)��&<����Ps�-/E�Ec�>�URR"X40UD6 g�N)r�writestr)r$r2�valuer's    r*�	pipe_file�ZipFileSystem.pipe_fileps�������$�0��0r,c��URU5nSU;aEUR[S5;a,URU5(a[	S5e[U5eSUR;aSU;a[	S5eURRXRS5URS9nSU;a%URU5nUSUlUSUlU$)	Nr	r>z7ZipFS can only be open for reading or writing, not both�wr
)�force_zip64rAr@)
r/rr�exists�OSError�FileNotFoundErrorrr�stripr�inforAr@)	r$r2r�38block_size�39autocommit�
cache_optionsr'�outrcs	         r*�_open�ZipFileSystem._opents����#�#�D�)���$�;�4�9�9��D�	�1��{�{�4� � ��W�X�X�#�D�)�)��$�)�)���t���S�T�T��h�h�m�m�D�*�*�S�/�t�?P�?P�m�Q���$�;��9�9�T�?�D��F�|�C�H��F�|�C�H��40r,c�`�UbUS:a[S5eS[4Sjn[U[5(d[U5nURS5nU"U5n[	U5nUR5 0n	XR;a3URUSS:XaURUX�'U(aU	$U/$URR5H|up�[	U"U415=n5U:d [S[X|555(aM>USS	:Xa!U(aX�;aX�U42RS5'MhX�;dMoU(aUOSX�'M~ U(a=U	R5V
Vs0sH up�U
RS5X(-:dMX�_M" n	n
nU(aU	$[U	5$s snn
f)43N�zmaxdepth must be at least 1�_pathc	�j�[[SURSS5RS555$)N�\r.)�list�filter�replace�split)rls r*�to_parts�$ZipFileSystem.find.<locals>.to_parts�s*����t�U�]�]�4��%=�%C�%C�C�%H�I�J�Jr,r.rBrCc3�.# �UHupX:gv� M
 g7frW�)�.0rr
s   r*�	<genexpr>�%ZipFileSystem.find.<locals>.<genexpr>�s���J�#>�4�1���#>�s�r?)
rrrr0�lenrTr#�items�anyrrb�count�sorted)r$r2�maxdepth�withdirs�detailr'rs�44path_parts�45path_depth�result�	file_path�	file_info�46file_parts�k�vs               r*�find�ZipFileSystem.find�s�����H�q�L��:�;�;�	K�C�	K��$��$�$��t�9�D��{�{�3����d�^�47���_�48��������>�>�!�d�n�n�T�&:�6�&B�f�&L��>�>�$�/�F�L�#�6�/�$��/�$(�N�N�$8�$8�$:� �I���)�!4�4�:�5�49�B�c�J�#&�z�#>�J�G�G���� �K�/��	� 7�3<�9�?�?�3�/�0���&�17�I�T��!�%;��!'�����!/���1�7�7�3�<�(�BW�3W�����
�� �v�3�V�F�^�3��s�,F*�
F*)r#r rrrr)�rbNTN)NFF)�__name__�50__module__�__qualname__�__firstlineno__�__doc__�root_markerr�cachabler!�51ZIP_STOREDr�classmethodr/r9r7rTrZrhr��__static_attributes__�
__classcell__)r)s@r*rrs������K��H��H��
����&�&���2�h�9��9�/��.�01�����
�.,4�,4r,r)rr!r�fsspec.archiverrrvr,r*�<module>r�s ��	��
�4�o4�-�o4r,
codekingpro/portable-devtools · Team Ai