/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__/github.cpython-36.pyc (7404B)
3 8%Eg`@s@ddlZddlmZddlmZddlmZGdddeZdS) N)AbstractFileSystem)infer_storage_options) MemoryFilecseZdZdZdZdZdZdfdd Zedd Z e d d d Z ed dZ eddZ eddZd!ddZd"ddZe fddZeddZd#ddZZS)$GithubFileSystema&Interface to files in github An instance of this class provides the files residing within a remote github repository. You may specify a point in the repos history, by SHA, branch or tag (default is current master). Given that code files tend to be small, and that github does not support retrieving partial content, we always fetch whole files. When using fsspec.open, allows URIs of the form: - "github://path/file", in which case you must specify org, repo and may specify sha in the extra args - 'github://org:repo@/precip/catalog.yml', where the org and repo are part of the URI - 'github://org:repo@sha/precip/catalog.yml', where the sha is also included ``sha`` can be the full or abbreviated hex of the commit you want to fetch from, or a branch or tag name (so long as it doesn't contain special characters like "/", "?", which would have to be HTTP-encoded). For authorised access, you must provide username and token, which can be made at https://github.com/settings/tokens z9https://api.github.com/repos/{org}/{repo}/git/trees/{sha}z;https://raw.githubusercontent.com/{org}/{repo}/{sha}/{path}ZgithubNc  stjf|||_||_|dk|dkAr2td||_||_|dkrxd}tj|j ||df|j }|j |j d}||_ |jddS)Nz%Auth required both username and tokenz)https://api.github.com/repos/{org}/{repo})orgrepoZdefault_branch)super__init__rr ValueErrorusernametokenrequestsgetformatkwraise_for_statusjsonrootls) selfrr sharrkwargsur) __class__G/usr/local/lib/python3.6/site-packages/fsspec/implementations/github.pyr (s zGithubFileSystem.__init__cCs|jrd|j|jfiSiS)Nauth)rr)rrrrr:szGithubFileSystem.kwTcCs6tjdjddg||d}|jdd|jDS)avList repo names for given org or user This may become the top level of the FS Parameters ---------- org_or_user: str Name of the github org or user to query is_org: bool (default True) Whether the name is an organisation (True) or user (False) Returns ------- List of string z)https://api.github.com/{part}/{org}/reposZusersZorgs)partrcSsg|] }|dqS)namer).0r rrr Wsz*GithubFileSystem.repos..)rrrrr)clsZ org_or_userZis_orgrrrrrepos@s zGithubFileSystem.reposcCs8tjdj|j|jdf|j}|jdd|jDS)zNames of tags in the repoz.https://api.github.com/repos/{org}/{repo}/tags)rr cSsg|] }|dqS)r"r)r#trrrr$bsz)GithubFileSystem.tags..)rrrrr rrr)rrrrrtagsYs zGithubFileSystem.tagscCs8tjdj|j|jdf|j}|jdd|jDS)zNames of branches in the repoz2https://api.github.com/repos/{org}/{repo}/branches)rr cSsg|] }|dqS)r"r)r#r'rrrr$msz-GithubFileSystem.branches..)rrrrr rrr)rrrrrbranchesds zGithubFileSystem.branchescCs|j|jdS)z#Named references, tags and branches)r(r))r(r))rrrrrefsoszGithubFileSystem.refsFc  sv|jdkr|p|j}|dkrjdjd}d|p@|j}xz|D]r}|jd||d}rld|n|7fdd|D}|st|d}|d d kr|r|gSS|d }qHW|jks||jdgkrLtj|j j |j |j |d f|j } | jd krt| jfdd| jdD}||jdgkrV||j<n |j}|r`|Stdd|DSdS)a List files at given path Parameters ---------- path: str Location to list, relative to repo root detail: bool If True, returns list of dicts, one per file; if False, returns list of full filenames only sha: str (optional) List at the given point in the repo history, branch or tag name or commit SHA _sha: str (optional) List this specific tree object (used internally to descend into trees) r N/T)r_shacsg|]}|dkr|qS)r"r)r#o)so_farrrr$sz'GithubFileSystem.ls..rtypefiler)rr ricsRg|]J}rd|dn|d|dddd|d|jdd|d d qS) r+pathmoder0 directory)Zblobtreer/sizerr)r"r2r/r5r)r)r#f)r1rrr$sr4cSsg|] }|dqS)r"r)r#r6rrrr$s)_strip_protocolrrstripsplitrFileNotFoundErrordircacherrurlrrr r status_coderrsorted) rr1Zdetailrr,rpartsr!outrr)r1r.rrtsB          zGithubFileSystem.lscCs|jjdS)N)r;clear)rr1rrrinvalidate_cachesz!GithubFileSystem.invalidate_cachecs*t|}d|krtj|S|djdS)Nrr1r+)rr r7lstrip)r%r1opts)rrrr7s z GithubFileSystem._strip_protocolcCs>t|}d|kriS|d|dd}|dr:|d|d<|S)Nrpassword)rr hostr)r)r1rDr@rrr_get_kwargs_from_urlss z&GithubFileSystem._get_kwargs_from_urlsrbc Ksb|dkr t|jj|j|j||p$|jd}tj|f|j} | j dkrLt || j t dd| j S)NrH)rr r1ri)NotImplementedErrorrurlrrr rrrrr=r:rrcontent) rr1r2 block_sizeZ autocommitZ cache_optionsrrr<rrrr_opens  zGithubFileSystem._open)NNN)T)FNN)N)rHNTNN)__name__ __module__ __qualname____doc__r<rJprotocolr propertyr classmethodr&r(r)r*rrBr7 staticmethodrGrM __classcell__rr)rrr s(    >  r)rspecrutilsrZmemoryrrrrrrs