/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__/mapping.cpython-36.pyc (8208B)
3 8%Eg]@sFddlZddlmZddlmZGdddeZddZd d d ZdS) N)MutableMapping) url_to_fsc@seZdZdZd#ddZddZd$d d Zd d Zd dZddZ ddZ d%ddZ d&ddZ ddZ ddZddZddZdd Zd!d"ZdS)'FSMapaWrap a FileSystem instance as a mutable wrapping. The keys of the mapping become files under the given root, and the values (which must be bytes) the contents of those files. Parameters ---------- root: string prefix for all the files fs: FileSystem instance check: bool (=True) performs a touch at the location, to check for write access. Examples -------- >>> fs = FileSystem(**parameters) # doctest: +SKIP >>> d = FSMap('my-data/path/', fs) # doctest: +SKIP or, more likely >>> d = fs.get_mapper('my-data/path/') >>> d['loc1'] = b'Hello World' # doctest: +SKIP >>> list(d.keys()) # doctest: +SKIP ['loc1'] >>> d['loc1'] # doctest: +SKIP b'Hello World' FNcCs||_|j|jd|_|dkr*tttf}||_|rL|jj|sL|jj ||r|jj|sht d||jj |d|jj |ddS)N/z@Path %s does not exist. Create with the ``create=True`` keywordz/a) fs_strip_protocolrstriprootFileNotFoundErrorIsADirectoryErrorNotADirectoryErrormissing_exceptionsexistsmkdir ValueErrortouchrm)selfr rcheckcreaterr8/usr/local/lib/python3.6/site-packages/fsspec/mapping.py__init__#s$    zFSMap.__init__c Cs4y"|jj|jd|jj|jWn YnXdS)z0Remove all keys below root - empties out mappingTN)rrr r)rrrrclear;s z FSMap.clearraisecsfdd|D}dkrnd}y*jj||dttrJ|diWn*jk rv}z t|WYdd}~XnXfdd jDfd d t||DS) aFetch multiple items from the store If the backend is async-able, this might proceed concurrently Parameters ---------- keys: list(str) They keys to be fetched on_error : "raise", "omit", "return" If raise, an underlying exception will be raised (converted to KeyError if the type is in self.missing_exceptions); if omit, keys with exception will simply not be included in the output; if "return", all keys are included in the output, but the value will be bytes or an exception instance. Returns ------- dict(key, bytes|exception) csg|]}j|qSr) _key_to_str).0k)rrr Wsz"FSMap.getitems..rreturn)on_errorrNcs(i|] \}}t|jrtn||qSr) isinstancerKeyError)rrv)rrr _sz"FSMap.getitems..cs2i|]*\}}dks$t|t r||qS)r )r" BaseException)rkeyZk2)r!outrrr%cs)rcatr"bytesrr#itemszip)rkeysr!keys2Zoeer)r!r(rrgetitemsCs    zFSMap.getitemscs&fdd|jD}jj|dS)zSet the values of multiple items in the store Parameters ---------- values_dict: dict(str, bytes) cs i|]\}}t|j|qSr) maybe_convertr)rrr$)rrrr%psz"FSMap.setitems..N)r+rpipe)rZ values_dictvaluesr)rrsetitemsiszFSMap.setitemscsjjfdd|DdS)z#Remove multiple keys from the storecsg|]}j|qSr)r)rr)rrrrusz"FSMap.delitems..N)rr)rr-r)rrdelitemssszFSMap.delitemscCsFt|ttfrtt|}nt|}|jj|jr@dj|j|gn|S)zGenerate full path for the keyr)r"tupleliststrrrr join)rr'rrrrwszFSMap._key_to_strcCs|t|jdjdS)zStrip path of to leave key nameNr)lenr lstrip)rsrrr _str_to_keyszFSMap._str_to_keyc CsJ|j|}y|jj|}Wn*|jk rD|dk r8|St|YnX|S)z Retrieve dataN)rrr)rr#)rr'defaultrresultrrr __getitem__s zFSMap.__getitem__c Cs0|j||}y ||=Wntk r*YnX|S)N)r@r#)rr'r>r?rrrpops   z FSMap.popcCs8|j|}|jj|jj|dd|jj|t|dS)zStore value in keyT)exist_okN)rrZmkdirs_parentZ pipe_filer1)rr'valuerrr __setitem__s zFSMap.__setitem__csfddjjjDS)Nc3s|]}j|VqdS)N)r=)rx)rrr sz!FSMap.__iter__..)rfindr )rr)rr__iter__szFSMap.__iter__cCst|jj|jS)N)r:rrHr )rrrr__len__sz FSMap.__len__c Cs,y|jj|j|WntYnXdS)z Remove keyN)rrrr#)rr'rrr __delitem__szFSMap.__delitem__cCs"|j|}|jj|o |jj|S)zDoes key exist in mapping?)rrrisfile)rr'pathrrr __contains__s zFSMap.__contains__cCst|j|jdd|jffS)NF)rr rr)rrrr __reduce__szFSMap.__reduce__)FFN)r)N)N)__name__ __module__ __qualname____doc__rrr0r4r5rr=r@rArErIrJrKrNrOrrrrrs   &  rcCsFt|tjst|drBt|dr6|jjdkr6|jd}tt|}|S)NZ __array__dtypeZMmZint64)r"arrayhasattrrTkindview bytearray memoryview)rDrrrr1s   r1Fc Ks2t|f|\}}|dk r|n|}t|||||dS)aCreate key-value interface for given URL and options The URL will be of the form "protocol://location" and point to the root of the mapper required. All keys will be file-names below this location, and their values the contents of each key. Also accepts compound URLs like zip::s3://bucket/file.zip , see ``fsspec.open``. Parameters ---------- url: str Root URL of mapping check: bool Whether to attempt to read from the location before instantiation, to check that the mapping does exist create: bool Whether to make the directory corresponding to the root before instantiating missing_exceptions: None or tuple If given, these exception types will be regarded as missing keys and return KeyError when trying to read data. By default, you get (FileNotFoundError, IsADirectoryError, NotADirectoryError) alternate_root: None or str In cases of complex URLs, the parser may fail to pick the correct part for the mapper root, so this arg can override Returns ------- ``FSMap`` instance, the dict-like key-value store. N)r)rr) urlrrrZalternate_rootkwargsrZurlpathr rrr get_mappers'r])FFNN)rUcollections.abcrcorerrr1r]rrrrs  ,