/usr/local/lib/python3.6/site-packages/fsspec/implementations/__pycache__
NameSizeModeActions
arrow.cpython-36.pyc73280644editdlrm
cached.cpython-36.pyc230300644editdlrm
dask.cpython-36.pyc46560644editdlrm
dbfs.cpython-36.pyc133510644editdlrm
dvc.cpython-36.pyc26220644editdlrm
ftp.cpython-36.pyc104440644editdlrm
git.cpython-36.pyc37500644editdlrm
github.cpython-36.pyc74040644editdlrm
hdfs.cpython-36.pyc70930644editdlrm
http.cpython-36.pyc207520644editdlrm
jupyter.cpython-36.pyc41310644editdlrm
libarchive.cpython-36.pyc60050644editdlrm
local.cpython-36.pyc119120644editdlrm
memory.cpython-36.pyc66970644editdlrm
reference.cpython-36.pyc161420644editdlrm
sftp.cpython-36.pyc61040644editdlrm
smb.cpython-36.pyc105910644editdlrm
tar.cpython-36.pyc45020644editdlrm
webhdfs.cpython-36.pyc147120644editdlrm
zip.cpython-36.pyc32760644editdlrm
__init__.cpython-36.pyc1560644editdlrm
Edit: /usr/local/lib/python3.6/site-packages/fsspec/implementations/__pycache__/smb.cpython-36.pyc (10591B)
3 8%Eg''@sdZddlZddlZddlmZmZddlZddlmZddl m Z GdddeZ d d Z d d Z d dZGdddeZdS)z This module contains SMBFileSystem class responsible for handling access to Windows Samba network shares by using package smbprotocol N)S_ISDIRS_ISLNK)AbstractFileSystem)infer_storage_optionscseZdZdZdZd'fdd ZddZed d Ze d d Z d(ddZ d)ddZ ddZ ddZddZddZd*ddZd,dd Zd!d"Zd#d$Zd%d&ZZS)- SMBFileSystemaaAllow reading and writing to Windows and Samba network shares. When using `fsspec.open()` for getting a file-like object the URI should be specified as this format: ``smb://workgroup;user:password@server:port/share/folder/file.csv``. Example:: >>> import fsspec >>> with fsspec.open( ... 'smb://myuser:mypassword@myserver.com/' 'share/folder/file.csv' ... ) as smbfile: ... df = pd.read_csv(smbfile, sep='|', header=None) Note that you need to pass in a valid hostname or IP address for the host component of the URL. Do not use the Windows/NetBIOS machine name for the host component. The first component of the path in the URL points to the name of the shared folder. Subsequent path components will point to the directory/folder/file. The URL components ``workgroup`` , ``user``, ``password`` and ``port`` may be optional. .. note:: For working this source require `smbprotocol`_ to be installed, e.g.:: $ pip install smbprotocol # or # pip install smbprotocol[kerberos] .. _smbprotocol: https://github.com/jborean93/smbprotocol#requirements Note: if using this with the ``open`` or ``open_files``, with full URLs, there is no way to tell if a path is relative, so all paths are assumed to be absolute. smbN<c  sVtt|jf|||_||_||_||_||_||_|j dd|_ ||_ |j dS)aa You can use _get_kwargs_from_urls to get some kwargs from a reasonable SMB url. Authentication will be anonymous or integrated if username/password are not given. Parameters ---------- host: str The remote server name/ip to connect to port: int Port to connect with. Usually 445, sometimes 139. username: str or None Username to connect with. Required if Kerberos auth is not being used. password: str or None User's password on the server, if using username timeout: int Connection timeout in seconds encrypt: bool Whether to force encryption or not, once this has been set to True the session cannot be changed back to False. share_access: str or None Specifies the default access applied to file open operations performed with this file system object. This affects whether other processes can concurrently open a handle to the same file. - None (the default): exclusively locks the file until closed. - 'r': Allow other handles to be opened with read access. - 'w': Allow other handles to be opened with write access. - 'd': Allow other handles to be opened with delete access. temppathN) superr__init__hostportusernamepasswordtimeoutencryptpopr share_access_connect) selfrrrrrrrkwargs) __class__D/usr/local/lib/python3.6/site-packages/fsspec/implementations/smb.pyr >s,zSMBFileSystem.__init__cCs4tj|j|j|j|jdkrdn|j|j|jddS)Ni)rrrrZconnection_timeout) smbclientZregister_sessionrrrrrr)rrrrruszSMBFileSystem._connectcCs t|dS)Npath)r)clsrrrr_strip_protocolszSMBFileSystem._strip_protocolcCs$t|}|jdd|jdd|S)Nrprotocol)rr)routrrr_get_kwargs_from_urlss  z#SMBFileSystem._get_kwargs_from_urlsTcKs:t|j|}|r(tj|fddi|ntj|f|dS)Nexist_okF) _as_unc_pathrrmakedirsmkdir)rrZcreate_parentsrwpathrrrr&s zSMBFileSystem.mkdirFcCs&t|r"t|j|}tj||ddS)N)r#)_share_has_pathr$rrr%)rrr#r'rrrr%s zSMBFileSystem.makedirscCs"t|rt|j|}tj|dS)N)r(r$rrrmdir)rrr'rrrr)s zSMBFileSystem.rmdircKspt|j|}tj|f|}t|jr*d}nt|jr:d}nd}|dkrN|dn||j||j|j |j |j d}|S)N directorylinkfile/)namesizetypeuidgidtimemtime) r$rrstatrst_moderst_sizest_uidst_gidst_atimest_mtime)rrrr'statsstyperesrrrinfos    zSMBFileSystem.infocCs$t|j|}tj|}tjj|jS)z=Return the created timestamp of a file as a datetime.datetime)r$rrr5datetimeutcfromtimestampst_ctime)rrr'r<rrrcreateds  zSMBFileSystem.createdcCs$t|j|}tj|}tjj|jS)z>Return the modified timestamp of a file as a datetime.datetime)r$rrr5r@rAr;)rrr'r<rrrmodifieds  zSMBFileSystem.modifiedc sFtj}tj|f|}fdd|D}|rBfdd|D}|S)Ncs g|]}djjd|gqS)r-)joinrstrip).0p)rrr sz$SMBFileSystem.ls..csg|]}j|qSr)r?)rGd)rrrrIs)r$rrlistdir)rrZdetailruncZlisteddirsr)rrrlss  zSMBFileSystem.lsrbc Ks|dk r|dkr|nd }t|j|}|jd|j} d|krj|dkrjt|j||j} t|| |fd|i|Stj||f|| d|S) a5 block_size: int or None If 0, no buffering, 1, line buffering, >1, buffer that many bytes Notes ----- By specifying 'share_access' in 'kwargs' it is possible to override the default shared access setting applied in the constructor of this object. NrrPrwF block_size) bufferingr) r$rrr _as_temp_pathr SMBFileOpenerr open_file) rrmoderRZ autocommitZ cache_optionsrZblsr'rtemprrr_opens zSMBFileSystem._opencKs,t|j|}t|j|}tj||f|dS)z0Copy within two locations in the same filesystemN)r$rrcopyfile)rpath1path2rwpath1wpath2rrrcopys  zSMBFileSystem.copycCsBt|r>t|j|}tj|}t|jr4tj|n tj|dS)N) r(r$rrr5rr6r)remove)rrr'r<rrr_rms     zSMBFileSystem._rmcKs,t|j|}t|j|}tj||f|dS)N)r$rrrename)rr\r]rr^r_rrrmvs  zSMBFileSystem.mv)NNNr NN)T)F)TrT)rOrTTN)__name__ __module__ __qualname____doc__r r r classmethodr staticmethodr"r&r%r)r?rCrDrNrZr`rbrd __classcell__rr)rrrs2&/       rcCs|jdd}dj||}|S)Nr-\z\\{}{})replaceformat)rrZrpathrLrrrr$s  r$cCs.|jdd}dj||tj}t||}|S)Nr-rPz/{}{}/{})splitrnuuiduuid4r$)rrr Zshare temp_filerLrrrrUs rUcCs$|jd}|jdr|dkS|dkS)Nr-rrP)countendswith)rpartsrrrr(s  r(c@sZeZdZdZdddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ dS)rVz/writes to remote temporary file, move on commitrPcKs6||_||_||_||_||_d|_d|_|jdS)NF)rrYrXrRrsmbfile _incontextrZ)rrrYrXrRrrrrr szSMBFileOpener.__init__cCs8|jdks|jjr4tj|j|jfd|ji|j|_dS)NrS)rvclosedrrWrYrXrRr)rrrrrZszSMBFileOpener._opencCstj|j|jdS)z(Move temp file to definitive on success.N)rrmrYr)rrrrcommitszSMBFileOpener.commitcCstj|jdS)z Remove the temp file on failure.N)rrarY)rrrrdiscard"szSMBFileOpener.discardcCs|jS)N)r)rrrr __fspath__&szSMBFileOpener.__fspath__cCs |jjS)N)rv__iter__)rrrrr|)szSMBFileOpener.__iter__cCs t|j|S)N)getattrrv)ritemrrr __getattr__,szSMBFileOpener.__getattr__cCsd|_|jjS)NT)rwrv __enter__)rrrrr/szSMBFileOpener.__enter__cCsd|_|jj|||dS)NF)rwrv__exit__)rexc_type exc_value tracebackrrrr3szSMBFileOpener.__exit__NrT)rT) rerfrgrhr rZryrzr{r|rrrrrrrrV s rV)rhr@rpr5rrrr rutilsrrr$rUr(objectrVrrrrs  d