/usr/local/lib/python3.6/site-packages/fsspec/__pycache__
NameSizeModeActions
archive.cpython-36.pyc26790644editdlrm
asyn.cpython-36.pyc232500644editdlrm
caching.cpython-36.pyc133250644editdlrm
callbacks.cpython-36.pyc59270644editdlrm
compression.cpython-36.pyc46450644editdlrm
config.cpython-36.pyc27400644editdlrm
conftest.cpython-36.pyc13610644editdlrm
core.cpython-36.pyc202340644editdlrm
dircache.cpython-36.pyc32920644editdlrm
exceptions.cpython-36.pyc7330644editdlrm
fuse.cpython-36.pyc101100644editdlrm
gui.cpython-36.pyc142140644editdlrm
mapping.cpython-36.pyc82080644editdlrm
parquet.cpython-36.pyc111810644editdlrm
registry.cpython-36.pyc76210644editdlrm
spec.cpython-36.pyc522480644editdlrm
transaction.cpython-36.pyc31780644editdlrm
utils.cpython-36.pyc144030644editdlrm
_version.cpython-36.pyc4640644editdlrm
__init__.cpython-36.pyc13940644editdlrm
Edit: /usr/local/lib/python3.6/site-packages/fsspec/__pycache__/callbacks.cpython-36.pyc (5927B)
3 8%EgÛã@s8Gdd„dƒZGdd„deƒZGdd„deƒZeƒZdS)c@sleZdZdZddd„Zdd„Zdd „Zdd d „Zdd d„Zdd„Z dd„Z dd„Z dd„Z e ddd„ƒZdS)ÚCallbacka¨ Base class and interface for callback mechanism This class can be used directly for monitoring file transfers by providing ``callback=Callback(hooks=...)`` (see the ``hooks`` argument, below), or subclassed for more specialised behaviour. Parameters ---------- size: int (optional) Nominal quantity for the value that corresponds to a complete transfer, e.g., total number of tiles or total number of bytes value: int (0) Starting internal counter value hooks: dict or None A dict of named functions to be called on each update. The signature of these must be ``f(size, value, **kwargs)`` NécKs ||_||_|pi|_||_dS)N)ÚsizeÚvalueÚhooksÚkw)ÚselfrrrÚkwargs©r ú:/usr/local/lib/python3.6/site-packages/fsspec/callbacks.pyÚ__init__s zCallback.__init__cCs||_|jƒdS)zß Set the internal maximum size attribute Usually called if not initially set at instantiation. Note that this triggers a ``call()``. Parameters ---------- size: int N)rÚcall)rrr r r Úset_sizes zCallback.set_sizecCs||_|jƒdS)z… Set the internal value state Triggers ``call()`` Parameters ---------- value: int N)rr )rrr r r Úabsolute_update*s zCallback.absolute_updateécCs|j|7_|jƒdS)z‹ Delta increment the internal cuonter Triggers ``call()`` Parameters ---------- inc: int N)rr )rÚincr r r Úrelative_update7s zCallback.relative_updatecKsv|js dS|jjƒ}|j|ƒ|rH||jkr0dS|j||j|jf|ŽSx(|jjƒpVgD]}||j|jf|ŽqXWdS)a Execute hook(s) with current state Each function is passed the internal size and current value Parameters ---------- hook_name: str or None If given, execute on this hook kwargs: passed on to (all) hook(s) N)rrÚcopyÚupdaterrÚvalues)rÚ hook_namerrÚhookr r r r Ds    z Callback.callccs x|D]}|jƒ|VqWdS)z Wrap an iterable to call ``relative_update`` on each iterations Parameters ---------- iterable: Iterable The iterable that is being wrapped N)r)rÚiterableÚitemr r r Úwrap[s z Callback.wrapcCsdS)a; Set callbacks for child transfers If this callback is operating at a higher level, e.g., put, which may trigger transfers that can also be monitored. The passed kwargs are to be *mutated* to add ``callback=``, if this class supports branching to children. Parameters ---------- path_1: str Child's source path path_2: str Child's destination path kwargs: dict arguments passed to child method, e.g., put_file. Returns ------- Nr )rÚpath_1Úpath_2rr r r ÚbranchhszCallback.branchcOsdS)Nr )rÚ_Ú__r r r Úno_op€szCallback.no_opcCs|jS)zP If undefined methods are called on this class, nothing happens )r)rrr r r Ú __getattr__ƒszCallback.__getattr__cCs|dkr tS|S)aTransform callback=... into Callback instance For the special value of ``None``, return the global instance of ``NoOpCallback``. This is an alternative to including ``callback=_DEFAULT_CALLBACK`` directly in a method signature. N)Ú_DEFAULT_CALLBACK)ÚclsZmaybe_callbackr r r Ú as_callback‰szCallback.as_callback)NrN)r)N)N)Ú__name__Ú __module__Ú __qualname__Ú__doc__r r rrr rrrr Ú classmethodr#r r r r rs   rc@seZdZdZdd„ZdS)Ú NoOpCallbackz> This implementation of Callback does exactly nothing cOsdS)Nr )rÚargsrr r r r ›szNoOpCallback.callN)r$r%r&r'r r r r r r)–sr)cs2eZdZdZd ‡fdd„ Zdd„Zdd„Z‡ZS) ÚDotPrinterCallbackzÄ Simple example Callback implementation Almost identical to Callback with a hook that prints a char; here we demonstrate how the outer layer may print "#" and the inner layer "." ú#c s||_tƒjf|ŽdS)N)ÚchrÚsuperr )rZ chr_to_printr)Ú __class__r r r §szDotPrinterCallback.__init__cCstdƒ|d<dS)z;Mutate kwargs to add new instance with different print charÚ.ÚcallbackN)r+)rrrrr r r r«szDotPrinterCallback.branchcKst|jdddS)zJust outputs a characterÚ)ÚendN)Úprintr-)rrr r r r ¯szDotPrinterCallback.call)r,)r$r%r&r'r rr Ú __classcell__r r )r/r r+Ÿsr+N)rr)r+r!r r r r Ús