�
lMgB � �N � d dl Z d dlZddlmZ ddlmZ ddlmZ G d� de� Zy) � N� )�AbstractFileSystem��infer_storage_options� )�
MemoryFilec �� � � e Zd ZdZdZdZdZdZ d� fd� Ze d� � Z
edd�� Ze d � � Z
e d
� � Ze d� � Zdd�Zdd
�Ze� fd�� Zed� � Z dd�Zdd�Z� xZS )�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}�github)�<