CoolFace
Apppublic

Aluode/PerceptionLabPortable

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
dask.cpython-310.pyc44 linesDownload Raw Back to __pycache__
1o

2��Yir�@s�ddlZddlmZmZddlmZddlmZddlm	Z	m3Z4ddlmZdd�Z
d	d5�ZGdd�de6�ZGd
d�de	�ZdS)�N)�Client�_get_global_client)�Worker)�7filesystem)�AbstractBufferedFile�AbstractFileSystem��infer_storage_optionscCs$|durt�St|t�r|St|�S�N)r�8isinstancer)�client�r
��E:\DocsHouse\542 percep lab latest\PerceptionLab\PerceptionLab_Portable\python_embed\Lib\site-packages\fsspec/implementations/dask.py�_get_client9s1011rcCs12ttj�Sr13)�boolrZ14_instancesr
r
r
r�15_in_workers16rcszeZdZdZ	d�fdd�	Zedd��Zdd�Zd	d17�Zdd�Z	d
d�Z18dd�Zdd�Z				ddd�Z
dd�Z�ZS)�DaskWorkerFileSystema)View files accessible to a worker as any other remote file-system19 20    When instances are run on the worker, uses the real filesystem. When21    run on the client, they call the worker to provide information or data.22 23    **Warning** this implementation is experimental, and read-only for now.24    NcsTt�jdi|��|du|duAstd��||_||_d|_||_||_|��dS)NzKPlease provide one of filesystem instance (fs) or target_protocol, not bothr
)	�super�__init__�25ValueError�target_protocol�target_options�workerr�fs�_determine_worker)�selfrrrr�kwargs��	__class__r
rr!s�zDaskWorkerFileSystem.__init__cCs6t|�}d|vrd|vrd|d�d|d��iSiS)N�host�portr�:r)�path�sor
r
r�_get_kwargs_from_urls1sz*DaskWorkerFileSystem._get_kwargs_from_urlscCsZt�rd|_|jdurt|jfi|jpi��|_dSdSd|_t|j�|_t�	|�|_26dS)NTF)rrrrrrrr�daskZdelayed�rfs�rr
r
rr9s27���z&DaskWorkerFileSystem._determine_workercO�6|jr|jj|i|��dS|jj|i|����dSr28)rr�mkdirr&�compute�r�argsrr
r
rr)E�zDaskWorkerFileSystem.mkdircOr(r29)rr�rmr&r*r+r
r
rr.Kr-zDaskWorkerFileSystem.rmcOr(r30)rr�copyr&r*r+r
r
rr/Qr-zDaskWorkerFileSystem.copycOr(r31)rr�mvr&r*r+r
r
rr0Wr-zDaskWorkerFileSystem.mvcOs.|jr|jj|i|��S|jj|i|����Sr32)rr�lsr&r*r+r
r
rr1]szDaskWorkerFileSystem.ls�rbTc	Ks@|jr|jj|f||||d�|��Std||||||d�|��S)N)�mode�33block_size�34autocommit�
cache_options)rr"r3r4r5r6r
)rr�_open�DaskFile)rr"r3r4r5r6rr
r
rr7cs*	���	��zDaskWorkerFileSystem._opencCsd|jr'|�||��}|�|�|�||�Wd�S1s wYdS|j�||||���Sr35)rr7�seek�readr&�fetch_ranger*)rr"r3�start�end�fr
r
rr;�s36$�z DaskWorkerFileSystem.fetch_range)NNNN)r2NTN)�__name__�37__module__�__qualname__�__doc__r�staticmethodr$rr)r.r/r0r1r7r;�
__classcell__r
r
rrrs$	�38	39�rcs8eZdZd�fdd�	Zddd�Zdd�Zd	d40�Z�ZS)
r8r2cs&|dkrtd��t�jdi|��dS)Nr2z1Remote dask files can only be opened in "rb" moder
)rrr)rr3rrr
rr�szDaskFile.__init__FcCsdSr41r
)r�finalr
r
r�
_upload_chunk�szDaskFile._upload_chunkcCsdS)zCreate remote file/uploadNr
r'r
r
r�_initiate_upload�szDaskFile._initiate_uploadcCs|j�|j|j||�S)z*Get the specified set of bytes from remote)rr;r"r3)rr<r=r
r
r�_fetch_range�szDaskFile._fetch_range)r2)F)r?r@rArrFrGrHrDr
r
rrr8�s4243r8)r%Zdistributed.clientrrZdistributed.workerrZfsspecrZfsspec.specrrZfsspec.utilsr	rrrr8r
r
r
r�<module>s44q
Aluode/PerceptionLabPortable · CoolFace