Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
asyn.cpython-313.pyc353 linesDownload Raw Back to __pycache__
1�

2�jђ���SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK	J3r4 SSKJr SSK
Jr SSKJr SSKJr SSKJrJrJr SS	KJrJr SS5KJrJrJr \R<"S5rS/r S/r!Sq"\RFr#Sr$S
r%S(Sjr&SS.Sjr'S(Sjr(Sr)Sr*\+"\S5(a\RX"\*S9 \(aSSK-r-\-R\r/OSSK-r-\0"\-S\15r/Sr3Sr4S)Sjr5S\64Sjr7S\SSS4Sjr8/SQr9"SS \5r:S!r;"S"S#\<5r=S$S$\=S4S%jr>"S&S'\5r?g!\2a Sr-\1r/NXf=f)*�N)�Iterable)�	has_magic)�
TYPE_CHECKING�)�DEFAULT_CALLBACK)�FSTimeoutError)�LocalFileSystem�make_path_posix�trailing_sep)�AbstractBufferedFile�AbstractFileSystem)�glob_translate�is_exception�other_pathsz_[^_]c�N�[(d[R"5q[$)zwAllocate or return a threading lock.6 7The lock is allocated on first use to allow setting one lock per forked process.8)�_lock�	threading�Lock���QD:\code\apps\devtools\python\user_packages\Python313\site-packages\fsspec/asyn.py�get_lockrs���5���� ���Lrc�,�S[S'S[S'Sqg)z�Reset the global lock.9 10This should be called only on the init of a forked process to reset the lock to11None, enabling the new forked process to get a new lock.12Nr)�iothread�looprrrr�13reset_lockr&s���H�Q�K��D��G��Erc���# �U(aUOSnUb[R"XS9nUIShv�NUS'UR5 gN![anXBS'SnAN&SnAff=f!UR5 f=f7f)N��timeoutr)�asyncio�wait_for�	Exception�set)�event�coro�resultr�exs     r�_runnerr(3sf��� �g�d�G�������6����J��q�	�	�	�	��	�����q�	����	�	�	��sI�#A6�A�A�A�A6�A�14A�A�A!�A�A!�!A3�3A6rc�V�U(aUOSnUbUR5(a[S5e[RR	5nXPLa[S5eU"U0UD6nS/n[R"5n[R"[X�Xr5U5 URS5(aOUbUS-nUS:a[eM-USn	[U	[R5(a[U	e[U	[5(aU	eU	$![15a e[a N�f=f)z�16Make loop run coroutine until it returns. Runs in other thread17 18Examples19--------20>>> fsspec.asyn.sync(fsspec.asyn.get_loop(), func, *args,21                     timeout=timeout, **kwargs)22NzLoop is not runningz)Calling sync() from within a running looprr)�	is_closed�RuntimeErrorr �events�get_running_loop�NotImplementedErrorr�Event�run_coroutine_threadsafer(�waitr�23isinstance�TimeoutError�
BaseException)24r�funcr�args�kwargs�loop0r%r&r$�
return_results25          r�syncr:?s&��!�g�d�G��|�t�~�~�'�'��0�1�1�
����/�/�1���=�%�&Q�R�R���� �� �D��V�F��O�O��E��$�$�W�U�&�%J�D�Q�26��:�:�a�=�=�����q�L�G���{�$�$���1�I�M��-��!5�!5�6�6��-�/�	�M�=�	1�	1������1��
��
��
�s�-D�D(�'D(c�J^^�[R"T5UU4Sj5nU$)z�Given a function, make so can be called in blocking contexts27 28Leave obj=None if defining within a class. Pass the instance if attaching29as an attribute of the instance.30c�T>�T=(d USn[URT/UQ70UD6$�Nr)r:r)r6r7�selfr5�objs   ��r�wrapper�sync_wrapper.<locals>.wrapperss+����~�d�1�g���D�I�I�t�5�d�5�f�5�5r)�	functools�wraps)r5r?r@s`` r�sync_wrapperrDls'����_�_�T��6��6��Nrc�j�[Sc�[5 [Scb[R"5[S'[R31"[SRSS9nSUlUR5 U[S'SSS5 [S$[S$!,(df   [S$=f)z\Create or return the default fsspec IO loop32 33The loop will be running on a separate thread.34rN�fsspecIO)�target�nameT)35rrr �new_event_loopr�Thread�run_forever�daemon�startr)�ths r�get_looprO{s���36�A�w��
�Z��A�w��!�0�0�2��Q���%�%�T�!�W�-@�-@�z�R�� ��	����37� �������7�N�4��7�N��Z���7�N�s�A-B�38B2c�,�S[S'S[S'Sqgr=)rr�lockrrr�reset_after_forkrR�s���D��G��H�Q�K��Dr�register_at_fork)�after_in_child�error�iFc�B�SSKJn U(aSU;aUS$OSU;aUS$U(a[$[c[$[R39"[R5up#U[R:XagUS-$![[[4a	 [s$f=f)Nr)�conf�nofiles_gather_batch_size�gather_batch_size������)�
fsspec.configrX�_NOFILES_DEFAULT_BATCH_SIZE�resource�_DEFAULT_BATCH_SIZE�	getrlimit�
RLIMIT_NOFILE�ImportError�40ValueError�
ResourceError�
RLIM_INFINITY)�nofilesrX�41soft_limit�_s    r�_get_batch_sizerj�s���"��&�$�.��3�4�4�/��$�&��+�,�,��*�*���"�"�#� �*�*�8�+A�+A�B�
�42��X�+�+�+���Q����

��]�3�#�"�"�#�s�&B�B�B�returnc�P�[R"5 g![a gf=f)z Being executed by an event loop?TF)r r-r+rrr�
running_asyncrm�s(���� � �"�������s��43%�%c��>^^^# �Uc	[US9nUS:Xa[U5nUS:�deUUU4SjnSn[U5nS/U-n	[5n44U45(dXx:Ga[U465U:aNXx:aIU47R[R48"U"XU555 US-
n[U495U:aXx:aMIU50(dU	$[R"U51[RS9IShv�Nup�SnU(a*UR5n
U
IShv�Nup�X�U'U(aM*Ub@U52Hn
U
R5 M U53(a[R"U54SS	06IShv�N UeU55(aGMXx:aGMU	$N�Nl![anUcUnSnANxSnAff=fN:7f)56aRun the given coroutines in  chunks.57 58Parameters59----------60coros: list of coroutines to run61batch_size: int or None62    Number of coroutines to submit/wait on simultaneously.63    If -1, then it will not be any throttling. If64    None, it will be inferred from _get_batch_size()65callback: fsspec.callbacks.Callback instance66    Gets a relative_update when each coroutine completes67timeout: number or None68    If given, each coroutine times out after this time. Note that, since69    there are multiple batches, the total run time of this function will in70    general be longer71return_exceptions: bool72    Same meaning as in asyncio.gather73nofiles: bool74    If inferring the batch_size, does this operation involve local files?75    If yes, you normally expect smaller batches.76N)rgr[rc��># �[R"UTS9IShv�NU4TRS5 $N![a&nT(deX!4sSnATRS5 $SnAff=f!TRS5 f=f7f)Nrr)r r!�relative_updater")r%�i�e�callback�return_exceptionsrs   ���r�	_run_coro�'_run_coros_in_chunks.<locals>._run_coro�st����	(� �)�)�$��@�@�!�C�
�$�$�Q�'�
A���	�$���4�K��$�$�Q�'��	��77
�$�$�Q�'�sO�B�7�5�7�B�7�78A'�79A"�A'�A*�B�"A'�'A*�*A=�=Br)�return_whenrtT)rj�lenr#�addr �
ensure_futurer1�FIRST_COMPLETED�popr"�cancel�gather)�coros�80batch_sizersrrtrgrurq�n�results�pending�done�	first_exc�taskr&�k�excs  ```            r�_run_coros_in_chunksr��s�����<��$�W�5�81��R����Z�82���>��>�(�	83�A��E�84�A��f�q�j�G��e�G�85�Q�U��'�l�Z�'�A�E��K�K��-�-�i���!�.D�E�F�
��F�A��'�l�Z�'�A�E���(�N�%&�l�l�7��@W�@W�X�X�
���	���8�8�:�D�
$�"&�J�	��#��86�	�d�� ������
� ���n�n�g�F��F�F�F��O�1�'�Q�U�4�N�%Y�87'���
$��$� #�I���
$��G�sr�B3F�:0F�*E;�+F�E?�E=�88E?�F�$<F� F�!
F�1F�9F�=E?�?89F�	F�F�F�F)�_ls�	_cat_file�	_get_file�	_put_file�_rm_file�_cp_file�90_pipe_file�_expand_path�_info�_isfile�_isdir�_exists�_walk�_glob�_find�_du�_size�_mkdir�	_makedirsc�v^�\rSrSrSrSrSrSrSSSS.U4Sjjr\	S5r91S	rS(S92jrSr
SrS)S
jrS*SjrS+SjrSrS+SjrS,SjrS-SjrS*SjrS\SS4SjrSrS\S4SjrSrSrSrS.SjrSrSr S/Sjr!S0Sjr"S.S jr#S1S!jr$S2S"jr%S(S#jr&S/S$jr'S3S%jr(S4S&jr)S'r*U=r+$)5�AsyncFileSystemi6aWAsync file operations, default implementations93 94Passes bulk operations to asyncio.gather for concurrent operation.95 96Implementations that have concurrent batch operations and/or async methods97should inherit from this class instead of AbstractFileSystem. Docstrings are98copied from the un-underscored method in AbstractFileSystem, if not given.99TFN)�asynchronousrr�c��>�Xl[R"5UlU(dU=(d100 [	5UlOSUlX0l[TU] "U0UD6 g�N)	r��os�getpid�_pidrO�_loopr��super�__init__)r>r�rr�r6r7�	__class__s      �rr��AsyncFileSystem.__init__GsE���(���I�I�K��	���+���D�J��D�J�$��
���$�)�&�)rc�v�UR[R"5:wa[S5eUR$)NzThis class is not fork-safe)r�r�r�r+r��r>s rr�AsyncFileSystem.loopQs*���9�9��	�	��#��<�=�=��z�z�rc���# �[R"UR5(aD[U5R[RLaUR"U4SSS.UD6IShv�N$[101eN1027f)NFr)�	recursiver�)�inspect�iscoroutinefunction�_rm�typer�r.�r>�pathr7s   rr��AsyncFileSystem._rm_fileWsZ����'�'����1�1��T�103���o�&9�&9�9����$�P�%�A�P��P�P�P�!�!�Q�s�A%A4�'A2�(A4c104���# �U=(d URnURXS9IShv�Nn[[U5Vs/sHoPR"U40UD6PM snUSS9IShv�N$NAs snfN7f)N�r�T�r�rg)r�r�r��reversedr�)r>r�r�r�r7�ps      rr��AsyncFileSystem._rm_sq����2�4�?�?�105��&�&�t�&�A�A��)�19�$��@��A�]�]�1�
'��
'��@�!��106�107�	108�B��@�109�s-�(A5�A,�A5�A.�110A5�'A3�(A5�.A5c��# �[e7fr��r.)r>�path1�path2r7s    rr��AsyncFileSystem._cp_filei����!�!���	c��x# �URX5IShv�N URU5IShv�N gNN7fr�)r�r�)r>r�r�s   r�_mv_file�AsyncFileSystem._mv_filels1����m�m�E�)�)�)��m�m�E�"�"�"�	*�"�s�:�6�:�8�:�:c	��N# �Uc111U(aSnOUcSn[U[5(a[U[5(aUnUn	GO:[U[5n112URXUS9IShv�NnU113(aVU(aUbLUVs/sH7n[	U5(aMURU5IShv�N(aM5UPM9 nnU(dg[
U5S:Hn[U[5=(a+ [	U5=(d URU5IShv�Nn
U114=(aK [U5=(a U=(d0 [U5(+=(a U
=(a [	U5(+n[UUUU115(+S9n	U=(d URn[X�5VVs/sHunnUR"UU40UD6PM nnn[UUSSS9IShv�Nn[[U5H nUS:Xa[U[5(aM Ue gGN�GNds snfGNs snnfNM7f)N�ignore�raise)�maxdepthr�r��exists�flattenT)r�rtrg)r2�list�strr�rr�rxrrr��zipr�r��filterr�FileNotFoundError)r>r�r�r��on_errorr�r�r7�paths1�paths2�
source_is_strr��source_is_file�dest_is_dirr��p1�p2rr&r's                    r�_copy�AsyncFileSystem._copyps������	��H�
�
��H��e�T�"�"�z�%��'>�'>��F��F�&�u�c�2�M��,�,��I�-���F��i�8�3G� &��%�!�l�1�o�A�t�{�{�ST�~�AU�AU�A�v����� ��[�A�-�N�$�U�C�0���U�#�?�T�[�[��-?�'?�
�#���5�!�4�n�V�!�%�(�(�T�[�T��e�AT�=T�
�!����)�)�	�F� �2�4�?�?�116�?B�6�?R�S�?R�V�R�����r�2�0��0�?R��S�+��j�D�$�117�118����v�.�B��8�#�119�2�7H�(I�(I���H�/�C�BV���(@��T�120�sn�A&H%�(H�)H%�H�H�.H121�/H�:H�AH%�H�BH%�"!H�H%�H#�:H%�H�H%�H%c��# �[e7fr�r�)r>r��value�moder7s     rr��AsyncFileSystem._pipe_file�r�r�c��# �[U[5(aX0nU=(d URn[UR	5VVs/sHupVUR122"XV40UD6PM snnUSS9IShv�N$s snnfN1237f)NTr�)r2r�r�r��itemsr�)r>r�r�r�r7r��vs       r�_pipe�AsyncFileSystem._pipe�so����d�C� � ��=�D��2�4�?�?�124�)�9=����F����T�_�_�Q�
,�V�
,��F�!��125�126�	127��F�128�s�AA?�A7129�'A?�2A=�3A?c��|# �SnSnUb;US:a5UcU*nSnSnO/U=(d URU5IShv�NSnXB-nOUcSnU(d_Ub3US:a-Ub)U=(d URU5IShv�NSnXC-nOUcSn[U[R5(aUS-nSUS	U3$NN?7f)130z"Helper for "Range"-based _cat_fileNFr�T�sizerzbytes=�-)r�r2�numbers�Integral)r>�urlrM�endr��suffs      r�_process_limits�AsyncFileSystem._process_limits�s��������������{��f�������>�d�j�j��o� 5�v�>�����
�]��E����3��7��$��B�$�*�*�S�/�$9�6�#B�D��*�C�������#�w�/�/�0�0��q�����w�a��u�%�%�!6�%:�s"�6B<�B8�AB<�:B:�;>B<�:B<c��# �[e7fr�r�)r>r�rMr�r7s     rr��AsyncFileSystem._cat_file�r�r�c��.# �URXS9IShv�NnUVs/sHoR"U40UD6PM nnU=(d URn[XtSSS9IShv�NnUS:Xa#[	[[U5S5n	U	(aU	e[U5S:�d-[W[5(dUSURU5:wa8[Xh5V131Vs0sHup�US:wd[
U5(aMX�_M! snn132$US$N�s snfN�s snn133f7f)	Nr�T�r�rgrtr�Frr�omit)r�r�r�r��nextr�rrxr2r��_strip_protocolr�)r>r�r�r�r�r7�pathsr�outr'r�r�s            r�_cat�AsyncFileSystem._cat�s
����'�'��'�B�B��<A�B�E�D����/��/�E��B��2�4�?�?�134�(��$�$�135�136���w���f�\�3�/��7�B������J��N��$��%�%��Q�x�4�/�/��5�5� ��O��+�D�A��v�%�\�!�_����+��
��q�6�M�+C��B�137���sD�D�D�D�D�%D�D
� A7D�D�7D�=138D�D�Dc��# �Ub[e[U[5(d[e[U[5(dU/[U5-n[U[5(dU/[U5-n[U5[U5:wd[U5[U5:wa[e[XU5VV	V139s/sHup�n140UR"U4X�S.UD6PM nn	nn141U=(d URn[X�SSS9IShv�N$s sn142n	nfN7f)aGet the contents of byte ranges from one or more files143 144Parameters145----------146paths: list147    A list of of filepaths on this filesystems148starts, ends: int or list149    Bytes limits of the read. If using a single int, the same value will be150    used to read all the specified files.151N)rMr�Tr�)r.r2r��	TypeErrorrrxrdr�r�r�r�)r>r��starts�ends�max_gapr�r�r7r��srrrs            r�_cat_ranges�AsyncFileSystem._cat_ranges�s����*��%�%��%��&�&��O��&�(�+�+��X��E�152�*�F��$��)�)��6�C��J�&�D��v�;�#�e�*�$��D�	�S��Z�(?����u�d�3�153�3���a�
�N�N�1�7�A�7��7�3�	�154� �2�4�?�?�155�)��$�$�156�157�	158��159�160161�s�B3D�5"D�'D�>D162�?Dc��# �[e7fr�r�)r>�lpath�rpathr�r7s     rr��AsyncFileSystem._put_filer�r�c163���# �[U[5(a[U[5(aUnUn	GOW[U[5n164U165(a[U5n[	5nURXUS9n	U166(aNU(aUbDU	Vs/sH/n[
U5(aMURU5(aM-UPM1 n	nU	(dg[U	5S:Hn
[U[5=(a+ [
U5=(d URU5IShv�NnURU5nU167=(aK [U5=(a U
=(d0 [U5(+=(a U=(a [
U5(+n[U	UUU168(+S9nU	Vs0sH#nU[RRU5_M% nn[X�5VVs/sHunnUU(dMUPM nnn[X�5VVs/sHunnUU(aMUU4PM nnn[ R""UVs/sHnUR%USS9PM sn6IShv�N U=(d UR&n/nUR)[U55 UH:unnUR+UR,5nUR/U"UU40UD65 M< [1UXTS9IShv�N$s snfGN�s snfs snnfs snnfs snfN�N$7f)avCopy file(s) from local.169 170Copies a specific file or tree of files (if recursive=True). If rpath171ends with a "/", it will be assumed to be a directory, and target files172will go within.173 174The put_file method will be called concurrently on a batch of files. The175batch_size option can configure the amount of futures that can be executed176at the same time. If it is -1, then all the files will be uploaded concurrently.177The default can be set for this instance by passing "batch_size" in the178constructor, or for all instances by setting the "gather_batch_size" key179in ``fsspec.config.conf``, falling back to 1/8th of the system limit .180�r�r�Nrr�T��exist_ok�r�rs)r2r�r�r181r	�expand_pathr�isdirrxr�r�rrr�r�r�r r~r�r��set_size�branch_coror��appendr�)r>rrr�rsr�r�r7�rpaths�lpathsr��fsr�r�r�r��l�is_dir�r�rdirs�182file_pairs�dr�lfile�rfile�put_files                          r�_put�AsyncFileSystem._puts|���.�e�T�"�"�z�%��'>�'>��F��F�&�u�c�2�M��'��.�� �"�B��^�^�E��^�R�F��i�8�3G�%+�T�V��L��O�!�r�x�x�PQ�{�!�V��T��� ��[�A�-�N�$�U�C�0���U�#�?�T�[�[��-?�'?�
��(�(��/�E�"���5�!�4�n�V�!�%�(�(�T�[�T��e�AT�=T�
�!����)�)�	�F�06�6�v�!�!�R�W�W�]�]�1�%�%�v��6�"�6�2�@�2�t�q�!�f�Q�i��2��@�),�V�)<�N�)<���A�F�1�I�f�q�!�f�)<�183�N��n�n��O��A�t�~�~�a�$�~�?��O�P�P�P��2�4�?�?�184������#�j�/�*�&�L�E�5��+�+�D�N�N�;�H��L�L��%��9�&�9�:�'�*��j�185�186�	187��EU�(@��7��@��N��O�P�188�s��BK3�K�K�4K�:AK3�K�A>K3�*K�8K3�K�K�#K3�4K$�	K$�K3�(K*�K3�	K/�189BK3�K1�
190K3�K3�1K3c��# �[e7fr�r�)r>rrr7s    rr��AsyncFileSystem._get_filefr�r�c���# �[U[5(a[U[5(aUnUnGOa[U[5n	U	=(a [U5(+n191UR	U5nURXUS9IShv�NnU	(aVU(aUbLUVs/sH7n[U5(aMUR
U5IShv�N(aM5UPM9 nnU(dg[U5n[U5S:Hn[U[5=(a+ [U5=(d [5RU5n
U	=(a= [U5=(a U=(d" [U5(+=(a U
=(a U192n[UUUU	(+S9nUVs/sH5n[R"[RR!U5SS9PM7  nUR#SUR$5n/nUR'[U55 [)X�5H8up!UR+UR,5nUR/U"X40UD65 M: [1UUUS9IShv�N$GN�GN�s snfs snfN7f)	a�Copy file(s) to local.193 194Copies a specific file or tree of files (if recursive=True). If lpath195ends with a "/", it will be assumed to be a directory, and target files196will go within. Can submit a list of paths, which may be glob-patterns197and will be expanded.198 199The get_file method will be called concurrently on a batch of files. The200batch_size option can configure the amount of futures that can be executed201at the same time. If it is -1, then all the files will be uploaded concurrently.202The default can be set for this instance by passing "batch_size" in the203constructor, or for all instances by setting the "gather_batch_size" key204in ``fsspec.config.conf``, falling back to 1/8th of the system limit .205rNrr�Tr	r�r)r2r�r�rr�r�r�r206rxr	r
rrr��makedirsr��dirnamer|r�rr�rr�rr�)r>rrr�rsr�r7rrr��source_not_trailing_sepr�r�r�r��lpr�r�get_files                   r�_get�AsyncFileSystem._getis+���.�e�T�"�"�z�%��'>�'>��F��F�&�u�c�2�M�&3�&O�L��<O�8O�#��(�(��/�E��,�,��X�-���F��i�8�3G� &��%�!�l�1�o�A�t�{�{�ST�~�AU�AU�A�v�����#�E�*�E� ��[�A�-�N�$�U�C�0���U�#�E��'8�'>�'>�u�'E�
�#���5�!�4�n�V�!�%�(�(�T�[�T�=T�
�!����)�)�	�F�DJ�J�6�R����R�W�W�_�_�R�(�4�	8�6�J��Z�Z��d�o�o�>�207������#�f�+�&���/�L�E��+�+�D�N�N�;�H��L�L��%�9�&�9�:�0�*��j�8�208�209�	210�I�BV����.	K�211�s\�A>I:�I(�I:�I.�2I.�I+212�I.�I.�CI:�<I3�BI:�#I8�$I:�+I.�.I:c��\# �URU5IShv�NSS:H$N213! g=f7f)Nr��fileF)r��r>r�s  rr��AsyncFileSystem._isfile�s2���	��*�*�T�*�*�F�3�v�=�=�*��	��s �,�%�#�	%�,�%�)�,c��n# �URU5IShv�NSS:H$N214![a gf=f7f)Nr��	directoryF)r��OSErrorr+s  rr��AsyncFileSystem._isdir�s:���	��*�*�T�*�*�F�3�{�B�B�*���	��	�s(�5�%�#�	%�5�%�2152�5�2�5c��`# �URU5IShv�NRSS5$N7f)Nr�)r��getr+s  rr��AsyncFileSystem._size�s'����j�j��&�&�+�+�F�D�9�9�&�s�.�,�.c��# �U=(d URn[UVs/sHo0RU5PM snUS9IShv�N$s snfN	7f)N)r�)r�r�r�)r>r�r�r�s    r�_sizes�AsyncFileSystem._sizes�sG����2�4�?�?�216�)�$)�*�E�q�Z�Z��]�E�*�z�217�218�	219��*�220�s�A�A	�	A�A�221Ac��h# �UR"U40UD6IShv�N gN![a gf=f7f)NTF)r�r�r�s   rr��AsyncFileSystem._exists�s:���	��*�*�T�,�V�,�,�,��
-�� �	��	�s(�2�"� �"�2�"�222/�2�/�2c��# �[e7fr�r�r�s   rr��AsyncFileSystem._info�r�r�c��# �[e7fr�r�)r>r��detailr7s    rr��AsyncFileSystem._ls�r�r�c��# �UbUS:a[S5eURU5n0n0n0nURSS5nUR"U4SS0UD6IShv�Nn	U	HSnUSRS5nURSS5S	n
US223S:XaX�:wa224X�U
'X�U
'MDX�:XaX�S'MOX�U
'MU U(aXU47v� OU[U5[U547v� UbUS-nUS:agUH(nUR"X^4X(S
.UD6Shv�NnU7v� M gN�![[2254aAn226US:Xae[
U5(aU"U2275 U(a	U0047v� OU//47v� Sn228A229gSn230A231ff=fNd232M�7f)Nr�maxdepth must be at least 1r<FTr�rH�/r[r�r.r�)r�r<)rdr�r|r�r�r/�callable�rstrip�rsplitr�r�)r>r�r�r�r7�	full_dirs�dirs�filesr<�listingrr�info�pathnamerHrris                rr��AsyncFileSystem._walk�s������H�q�L��:�;�;��#�#�D�)���	��������H�e�,��	� �H�H�T�A�$�A�&�A�A�G��D��F�|�*�*�3�/�H��?�?�3��*�2�.�D��F�|�{�*�x�/?�"*�$��!�T�233��!� �b�	�"�d�����e�#�#���T�234�D��K�/�/�����M�H��!�|���A��:�:����'/��BH��
�a���	�KB��!�7�+�		��7�"���(�#�#������B��l�"��B��l�"���		��J
��sf�>E9�D �D�D �B-E9�E6�E4�E6�E9�D � E1�07E,�'E9�,E1�1E9�4E6�6E9c���# �UbUS:a[S5eSSKn[RR(a4[RR235[RR4O[RR2364nUR
U5nURU5nU=(d! UR
[SU555nURS5S:�aURS5O237[U5nURS5S:�aURS5O238[U5n	URS5S:�aURS5O239[U5n240[X�U2415nURSS	5nURS242S5n
[U5(dQUR"U40UD6IShv�N(a&U(dU/$XR"U40UD6IShv�N0$U(d/$0$SUSU;a@UnUSUR!S5nUSUS-nUUS-UnXS-SR#S5S-nO S
nUSUnXS-SR#S5S-nSU;a6Ub1URS5nUUSR#S5S-nUU-243U-nOSnU(aUUS'UR$"U4UU
SS.UD6IShv�Nn['X(aSOS
-5nUR("U5n[+UR-55VVs0sH6unnUR/U(aUSS:XaUS-OU5(dM3UU_M8 nnnU(aU$[1U5$GN�GN|N�s snnf7f)Nrr?rc3�*# �UH	oS-v� M g7f)�**Nr)�.0�seps  r�	<genexpr>�(AsyncFileSystem._glob.<locals>.<genexpr>s���-����*��s��*�?�[r<F�withdirsTr@r�rM�prefix)r�rUr<r�r.)rd�rer�r��altseprO�endswithr��tuple�findrx�minr|rr�r��rindex�countr�r�compile�sortedr��matchr�)r>r�r�r7rW�seps�
ends_with_sep�append_slash_to_dirname�idx_star�	idx_qmark�	idx_brace�min_idxr<rU�first_wildcard_idx�rootrV�depth�idx_double_stars�depth_double_stars�allpaths�patternr�rHr�s                         rr��AsyncFileSystem._glob244sL�����H�q�L��:�;�;��02����������R�W�W�^�^�,�R�W�W�[�[�N���
�
�d�+�
��#�#�D�)��"/�#245�4�=�=��-��-�-�4246��&*�Y�Y�s�^�q�%8�4�9�9�S�>�c�$�i��&*�i�i��n��&9�D�I�I�c�N�s�4�y�	�&*�i�i��n��&9�D�I�I�c�N�s�4�y�	��h�9�5�����H�e�,���:�:�j�$�/�������\�\�$�1�&�1�1�1�� �6�M� �247�248�4�(B�6�(B�"B�C�C���I��I�
�D��'�N�
"�!(���8�G�n�+�+�C�0�G���'�A�+��D���!��0��F��1���'�-�-�c�2�Q�6�E��D��(�7�^�F��1���'�-�-�c�2�Q�6�E��4�<��#�#'�9�9�T�?� �%)�*:�*;�%<�%B�%B�3�%G�!�%K�"�� 2�2�X�=�����%�F�8������249� �8�D�250�DJ�251�252��!��
��2�!F�G���*�*�W�%��"�(�.�.�"2�3�253�3���4��}�}�*�t�F�|�{�/J��C����
�A�t�G�3�	�254���J���9��s2�#C�B255��256�sP�F<M/�>M!�?)M/�(M$�)CM/�M'�AM/�
2M)�M)�257M/�$M/�'M/�)M/c���# �0nUR"U4SU0UD6IShv�NH&nURU5IShv�NnUSXWS'M( U(a[UR55$U$NPN67f)Nr�r�rH)r�r��sum�values)r>r��totalr�r7�sizes�frHs        rr��AsyncFileSystem._du[sr������z�z�$�D��D�V�D�D�D�A����A��&�D�"&�v�,�E�v�,��E���u�|�|�~�&�&��L�
E�&�s�A2�A.�A2�A0�5A2�0A2c	��# �URU5n0nURSS5nU(a?US:wa9URU5IShv�N(aURU5IShv�NXQ'UR"X4SS0UD6Shv�Nupxn	U(aU	RU5 URU	R
5V258Vs0sHup�USU_M
 snn2595 M^N�N{N]s snn260f261U(d#URU5IShv�N(a0XQ'[U5nU(dU$UV262s0sHo�XZ_M	 sn263$s sn264f7f)Nr<Fr�TrH)	r�r|r�r�r��updater�r�r`)
r>r�r�rUr7r�r<rirErFrHrH�namess
             rr��AsyncFileSystem._findfs����#�#�D�)�������H�e�,�����265�T�[�[��->�'>�'>�"�j�j��.�.�C�I�%)�J�J�t�$U�d�$U�f�$U�	M�.�!�5�����T�"��J�J�U�[�[�]�K�]�z�t��V��d�*�]�K�L�(?�.�	M��L�%V��d�l�l�4�0�0�0��C�I��s�����L�05�6���#�)�O��6�6��6�sl�AE�	C!�266E�'C#�(E�C-�C%�C-�:E�C'�E�#E�%C-�'"E�	D�267&E�0E�>Ec268��$# �UbUS:a[S5e[U[5(aURU/X#5IShv�NnGO[	5nUVs/sHoPRU5PM nnUH�n[
U5(an[	URXSS9IShv�N5nXF-nU(aAUbUS::aMIU[	UR[U5UUbUS-269OSS9IShv�N5-nM�U(a%[	URXSSS9IShv�N5nXG-nXT;dM�USLd URU5IShv�N(dM�URU5 M� U(d[U5e[U5$GN>s snfN�N�NvNK7f)Nrr?)r�rT)r�rUF)rdr2r�r�r#r�rr�r�r�r�ryr�r`)r>r�r�r�r�r��bit�recs        rr��AsyncFileSystem._expand_pathsv�����H�q�L��:�;�;��d�C� � ��)�)�4�&�)�F�F�C��%�C�59�:�T��(�(��+�T�D�:����Q�<�<��D�J�J�q�J�$D�D�E�C��J�C� �$�/�H��M�$��s�"&�"3�"3� $�S�	�*3�9A�9M��A��SW�#4�#�� ������D�J�J�q�d�J�$S�S�T�C��J�C��<�Y�%�%7�$�,�,�q�/�<Q�<Q��G�G�A�J�/�0�#�D�)�)��c�{��=G��;�E��T�<Q�ss�AF�F�F�F�1.F�F270� A	F�)F271�*+F�F272�F�)F�F�F�3F�F�273F�F�Fc��# �g7fr�r)r>r��create_parentsr7s    rr��AsyncFileSystem._mkdir��������c��# �g7fr�r)r>r�r274s   rr��AsyncFileSystem._makedirs�r�r�c��Z# �SU;dURS5(a[e[e7f)N�b�compression)r2rdr.)r>r�r�r7s    r�275open_async�AsyncFileSystem.open_async�s&����d�?�f�j�j��7�7���!�!�s�)+)r�r�r�r�)FN)FNNN)�	overwrite)NN)Fr�N)NNrkr�)T)Nr�)TN)NF�F)�rb),�__name__�276__module__�__qualname__�__firstlineno__�__doc__�277async_impl�mirror_sync_methods�disable_throttlingr��propertyrr�r�r�r�r�r�r�r�r�r�rr�rrr�r'r�r�r�r5r�r�r�r�r�r�r�r�r�r�r��__static_attributes__�
__classcell__)r�s@rr�r�6s�����J�����+0�t��*�*�����278"�279�"�#�����:�x"�280�&�4"�CG��>���'281�R"��!���H282�T"��!��
G283�R��:�284��"�"�4�lO�b	�7�2#�J
�
�"�"rr�c��SSKJn [[[5-H�nURS5(dMUSSn[RU5(dM<[R"[XS55n[[XS5SS5nU[XS5LnU(dM�U(dM�[[X5US	9n[XU5 UR(aM�[[XS5S285S5Ul
M� g)aPopulate sync and async methods for obj286 287For each method will create a sync version if the name refers to an async method288(coroutine) and there is no override in the child class; will create an async289method for the corresponding sync method if there is no implementation.290 291Uses the methods specified in292- async_methods: the set that an implementation is expected to provide293- default_async_methods: that can be derived from their sync version in294  AbstractFileSystem295- AsyncFileSystem: async-specific default coroutines296r)r
rirNF�__func__r�)r?r�)�fsspecr
�
async_methods�dirr��297startswith�privaterar�r��getattrrD�setattrr�)r?r
�method�smethod�isco�unsync�298is_default�mths        rr�r��s���*��#�o�"6�6��� � ��%�%�����*���=�=�� � ��.�.�w�s�D�/I�J�D��W�S�5�9�:�t�L�F��7�+=��#K�K�J��t�299�300�"�7�3�#7�S�A����c�*��{�{�{�")�� 2�T�B�I�r�#�C�K�7rc��\rSrSrSrg)�FSSpecCoroutineCanceli�rN)r�r�r�r�r�rrrr�r��s��rr�Tc301�>�SSKn[RR[S5Vs/sHoUR5(aMUPM nnU(aUVs/sHowR
5PM  nUVs/sH�nURRRURRRRURRRRURRRURURR5U(aUOSS.PM� nnU(a�UH�nURn	UR!5 [R"R$R'XR5 [R"R$R!U5 U	V302s/sH
o�S"U5PM  n303URR)U5 M� U$s snfs snfs snfs sn304f!Ua M�f=f)Nr)�localsr*�	firstline�linelo�stackr�)�	tracebackr �tasks�	all_tasksrr��print_stack�_coro�cr_frame�f_locals�f_code�co_filename�co_firstlineno�f_lineno�format_stack�305_callbacksr}�futures�Future�
set_exception�throw)�printoutr}r��	with_taskr��tr�r�r��cbs�cbs           r�_dump_running_tasksr��s�����
�
�/�/��Q��8�I�8�1����Q�8�E�I��(-�.���	�	�	��.��306��D��j�j�)�)�2�2��J�J�'�'�.�.�:�:����,�,�3�3�B�B��j�j�)�)�2�2��+�+�D�J�J�,?�,?�@�%�D�4�
	307���308���A��,�,�C�
�H�H�J��O�O�"�"�0�0��8��O�O�"�"�)�)�!�,� #�$��"��U�1�X��$�
����
�
�c�"���J��3
J��.��309��"
%���
��
�s0�G>�	G>�H�;CH�H
�H�H�Hc�V�\rSrSrS
SjrSrSrSSjrSrSr	Sr310S	rSS311jrSr
g)�AbstractAsyncStreamedFilei�c��# �UcSO312[U5nURS:wa[S5eUS:aURUR-313nUR314(a[S5eUS:XagUR
URURU-5IShv�NnU=R[U5-
slU$N$7f)z�315Return data from cache, or fetch pieces as necessary316 317Parameters318----------319length: int (-1)320    Number of bytes to read; if <0, all remaining bytes.321Nr[r�zFile not in read moder�I/O operation on closed file.r)�intr�rdr��loc�closed�_fetch_rangerx)r>�lengthr�s   r�read�AbstractAsyncStreamedFile.read�s�����~��3�v�;���9�9����4�5�5��A�:��Y�Y����)�F��;�;��<�=�=��Q�;���%�%�d�h�h����6�0A�B�B�����C��H����322�C�s�BC�C�%Cc��# �URS;a[S5eUR(a[S5eUR(a[S5eURRU5nU=RU-
slURR5UR:�aUR5IShv�N U$N7f)z�323Write data to buffer.324 325Buffer only sent on flush() or if buffer is greater than326or equal to blocksize.327 328Parameters329----------330data: bytes331    Set of bytes to be written.332>�ab�wbzFile not in write moder�z0This file has been force-flushed, can only closeN)333r�rdr��forced�buffer�writer��tell�	blocksize�flush)r>�datar�s   rr��AbstractAsyncStreamedFile.writes�����9�9�L�(��5�6�6��;�;��<�=�=��;�;��O�P�P��k�k����%�����C����;�;�������/��*�*�,����334�
�s�B?C335�C�C336c���# �[USS5(agUR(agURS:XaSUlO�UR(dURSS9IShv�N URbcURRUR5 URRURRUR55 SUlgN|7f)z-Close file337 338Finalizes writes, discards cache339�_unclosableFNr�T)�force)340r�r�r��cacher�r�r�invalidate_cacher��_parentr�s r�close�AbstractAsyncStreamedFile.close(s����341�4���.�.���;�;���9�9����D�J��;�;��j�j�t�j�,�,�,��w�w�"����(�(����3����(�(���������)C�D����
-�s�A!C"�#C �$A=C"c��l# �UR(a[S5eU(aUR(a[S5eU(aSUlURS;agU(d)URR5UR:agURc SUlUR5IShv�N URUS9IShv�NSLaJU=RURRSS5-
sl[R"5UlggNi! SUle=fNa7f)	NzFlush on closed filez+Force flush cannot be called more than onceT>r�r�r)�finalF�)
r�rdr�r�r�r�r��offset�_initiate_upload�
_upload_chunk�seek�io�BytesIO)r>r�s  rr��AbstractAsyncStreamedFile.flush=s�����;�;��3�4�4��T�[�[��J�K�K���D�K��9�9�L�(������)�)�+�d�n�n�<���;�;���D�K�
��+�+�-�-�-�342�#�#�%�#�0�0��=��K�K�4�;�;�+�+�A�q�1�1�K��*�*�,�D�K�>�.��
�"�����0�s=�B#D4�&D%�9D#�:D%�>D4�D2�AD4�#D%�%343D/�/D4c��# �U$7fr�rr�s r�344__aenter__�$AbstractAsyncStreamedFile.__aenter__Zs345�����s�c��@# �UR5IShv�N gN7fr�)r�)r>�exc_type�exc_val�exc_tbs    r�	__aexit__�#AbstractAsyncStreamedFile.__aexit__]s����j�j�l���s���c��# �[e7fr�r�)r>rMr�s   rr��&AbstractAsyncStreamedFile._fetch_range`r�r�c��# �g7fr�rr�s rr��*AbstractAsyncStreamedFile._initiate_uploadcr�r�c��# �[e7fr�r�)r>r�s  rr��'AbstractAsyncStreamedFile._upload_chunkfr�r�)r�r�r�r�r�N)r[r�)r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr�r��s/���.�0�*'�:��"�
�"rr�r�r�)@r �asyncio.eventsrBr�r�r�r�rWr�collections.abcr�globr�typingr�	callbacksr�346exceptionsr�implementations.localr	r347r�specrr
�utilsrrrr_r�rrrr-rrr(r:rDrOrR�hasattrrSr_rUrer�r/rcr`r^rj�boolrmr�r�r�r�r"r�r�r�rrr�<module>r	sw������	��	�	��$�� �'�&�Q�Q�:�<�<�348�*�*�W�349���6���v�����+�+���350�	�%)�*�Z��$��2�!�"�"����'7�8����N�N�M�<��351 ��'�7�;�
���"���2�t���
����
O�f�
�.w	"�(�w	"�t�@	�I�	�352�$�$9�U��Br"� 4�r"��k� ����
� �s�D3�3353E�?E
codekingpro/portable-devtools · Team Ai