+
    &j-                     X    ^ RI t ^ RIt^ RIt^RIHt ^RIHt ^RIHt  ! R R]4      t	R# )    N)AbstractFileSysteminfer_storage_options)
MemoryFilec                      a a ] tR t^t oRtRtRtRtRtRV 3R llt	]
R 4       t]RR l4       t]
R 4       t]
R	 4       t]
R
 4       tRR ltRR lt]V 3R l4       t]R 4       tRR ltRR ltRR ltR tRtVtV ;t# )GithubFileSystemaJ  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).

For files less than 1 MB in size, file content is returned directly in a
MemoryFile. For larger files, or for files tracked by git-lfs, file content
is returned as an HTTPFile wrapping the ``download_url`` provided by the
GitHub API.

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}zChttps://api.github.com/repos/{org}/{repo}/contents/{path}?ref={sha}githubc                  < \         SV `  ! R/ VB  Wn        W n        VR J VR J ,          '       d   \	        R4      hW@n        WPn        Ve   W`n        Vfg   Rp\        P                  ! VP                  WR7      3RV P                  /V P                  B p	V	P                  4        V	P                  4       R,          pY0n        V P                  R4        ^RIHp
 V
! R/ VB V n        R #   \&         d    R T n         R # i ; i)	Nz%Auth required both username and tokenz)https://api.github.com/repos/{org}/{repo})orgrepotimeoutdefault_branch )HTTPFileSystem )super__init__r   r   
ValueErrorusernametokenr   requestsgetformatkwraise_for_statusjsonrootlshttpr   http_fsImportError)selfr   r   shar   r   r   kwargsurr   	__class__s   &&&&&&&,   u/Users/jameslopez/projects/CWCArchive/cwc-podcast/.venv/lib/python3.14/site-packages/fsspec/implementations/github.pyr   GithubFileSystem.__init__,   s     	"6"	$//DEE 
"L;;AS,6:llFJggA  &&(+,C		 ,)3F3DL 	 DL	 s   C) )C?>C?c                ^    V P                   '       d   R V P                   V P                  3/# / # )auth)r   r   r"   s   &r(   r   GithubFileSystem.kwJ   s(    ===T]]DJJ788	    c                    \         P                  ! RRR.V,           RV R2V P                  R7      pVP                  4        VP	                  4        Uu. uF  qDR,          NK  	  up# u upi )a  List 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/usersorgs/z/repos)r   name)r   r   r   r   r   )clsorg_or_useris_orgr&   r   s   &&&  r(   reposGithubFileSystem.reposP   sf    " LL%w&7&?%@+fUKK
 	
)*2V222s   A)c                   \         P                  ! RV P                   RV P                   R23RV P                  /V P
                  B pVP                  4        VP                  4        Uu. uF  q"R,          NK  	  up# u upi )zNames of tags in the repohttps://api.github.com/repos/r2   z/tagsr   r3   r   r   r   r   r   r   r   r   r"   r&   ts   &  r(   tagsGithubFileSystem.tagsh   sv     LL+DHH:QtyykG
LL
 gg

 	
#$668,8a&		8,,,   +A?c                   \         P                  ! RV P                   RV P                   R23RV P                  /V P
                  B pVP                  4        VP                  4        Uu. uF  q"R,          NK  	  up# u upi )zNames of branches in the repor:   r2   z	/branchesr   r3   r;   r<   s   &  r(   branchesGithubFileSystem.branchess   sv     LL+DHH:QtyykK
LL
 gg

 	
#$668,8a&		8,,,r@   c                6    RV P                   RV P                  /# )z#Named references, tags and branchesr>   rB   )r>   rB   r,   s   &r(   refsGithubFileSystem.refs~   s     		:t}}==r.   c                l   V P                  V4      pVR8X  d   T;'       g    V P                  pVf   VP                  R4      P                  R4      pRpT;'       g    V P                  pV F  pV P	                  VRW4R7      p	Yw'       d
   RV,           MT,          pV	 U
u. uF  qR,          V8X  g   K  V
NK  	  p	p
V	'       g   \        V4      hV	^ ,          p	V	R,          R8X  d   V'       d   V	.u # Vu # V	R	,          pK  	  WP                  9  g   W0P                  R39  EdB   \        P                  ! V P                  P                  V P                  V P                  VR
7      3RV P                  /V P                  B pVP                  R8X  d   \        V4      hVP!                  4        RRRR/pVP#                  4       R,           Uu. uFp  pVR,          V9   g   K  RV'       d   VR,           VR,          ,           MVR,          RVR,          RWR,          ,          RVP                  R^ 4      R	VR	,          /NKr  	  p	pW0P                  R39   d   WP                  V&   MV P                  V,          p	V'       d   V	# \%        V	 Uu. uF  qR,          NK  	  up4      # u up
i u upi u upi )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   Nr2   T)r#   _shar3   typefiler#   )r   r   r#   r     blobtree	directorypathmodesize)_strip_protocolr   rstripsplitr   FileNotFoundErrordircacher   r   urlr   r   r   r   r   status_coder   r   sorted)r"   rO   detailr#   rH   r$   partsso_farpartoutor&   typesfs   &&&&&,        r(   r   GithubFileSystem.ls   si     ##D)2:##$))D<KK$**3/EF##$))Dggfdg?#*D8"%=#Q6f)<qq#=+D11!fv;&( #u#5z  }}$IIt3D(DDHH499$G ''A
 }}#'-- VV[9E &)
 *AV9%dD3J62&	AfIEF),AEE&!,1U8 *  
 yy$''&)d#--%CJc2cV99c233M >(
$ 3s%   !J'5J'J,%J,.AJ,J1c                :    V P                   P                  4        R # N)rV   clear)r"   rO   s   &&r(   invalidate_cache!GithubFileSystem.invalidate_cache   s    r.   c                v   < \        V4      pR V9  d   \        SV `	  V4      # VR,          P                  R4      # )r   rO   r2   )r   r   rR   lstrip)r4   rO   optsr'   s   && r(   rR    GithubFileSystem._strip_protocol   s:    $T*T!7*400F|""3''r.   c                    \        V 4      pR V9  d   / # RVR ,          RVR,          /pVR,          '       d   VR,          VR&   V# )r   r   r   passwordhostr#   r   )rO   rj   r^   s   &  r(   _get_kwargs_from_urls&GithubFileSystem._get_kwargs_from_urls   sL    $T*T!Id:&Z0@A<<fCJ
r.   c           	        VR 8w  d   \         hV P                  P                  V P                  V P                  Y;'       g    V P
                  R7      p\        P                  ! V3RV P                  /V P                  B pVP                  R8X  d   \        V4      hVP                  4        VP                  4       p	V	R,          '       dB   \        P                  ! V	R,          4      p
V
P!                  R4      '       g   \#        RRV
4      # V P$                  f   \'        R4      hV P$                  P(                  ! V	R,          3R	VR
VRV/VB # )rbr   r   rO   r#   r   rK   contents#   version https://git-lfs.github.com/NzRPlease install fsspec[http] to access github files >1 MB or git-lfs tracked files.download_urlrP   
block_sizecache_options)NotImplementedErrorcontent_urlr   r   r   r   r   r   r   r   rX   rU   r   r   base64	b64decode
startswithr   r    r!   open)r"   rO   rP   rv   rw   r#   r$   rW   r&   content_jsonrt   s   &&&&&&,    r(   _openGithubFileSystem._open   sC    4<%% %%tyyt9I9I		 & 

 LL>dll>dgg>==C#D))	vvx 	""&&|I'>?G %%&LMM!$g66
 <<,  ||  (

 "
 (	

 
 	
r.   c                t    V P                  WVR 7      p\        V4       F  pV P                  WTR7       K  	  R# ))	recursivemaxdepth)messageN)expand_pathreversedrm_file)r"   rO   r   r   r   ps   &&&&& r(   rmGithubFileSystem.rm  s3    HM$ALLL,  r.   c                   V P                   '       g   \        R4      hV P                  V4      pV P                  V4      pV'       g   V P                  P                  V P                  V P                  VP                  R4      V P                  R7      p\        P                  ! V3RV P                  /V P                  B pVP                  R8X  d   \        V4      hVP!                  4        VP#                  4       R,          pV P                  P                  V P                  V P                  WP                  R7      pV P                  pRT;'       g    RV 2RV/V'       d   R	V/M/ Cp	\        P$                  ! V3R
V	RV P                  /V P                  B pVP#                  4       P                  RR4      p
\&        P(                  ! RV
4      '       d   Rp\        V4      hVP!                  4        V P+                  V4       R# )a  
Remove a file from a specified branch using a given commit message.

Since Github DELETE operation requires a branch name, and we can't reliably
determine whether the provided SHA refers to a branch, tag, or commit, we
assume it's a branch. If it's not, the user will encounter an error when
attempting to retrieve the file SHA or delete the file.

Parameters
----------
path: str
    The file's location relative to the repository root.
message: str, optional
    The commit message for the deletion.
zAuthentication requiredr2   rs   r   rK   r#   r   zDelete branchr   r   zBranch .+ not foundzTRemove only works when the filesystem is initialised from a branch or default (None)N)r   r   rR   _get_sha_from_cachery   r   r   r   ri   r   r   r   r   r   rX   rU   r   r   deleteresearchrf   )r"   rO   r   r$   r#   rW   r&   
delete_urlr   dataerror_messageerrors   &&&,        r(   r   GithubFileSystem.rm_file  s   " }}}677##D) &&t,""))HH4994;;s3C * C SB$,,B$''BA}}#'-- &&(5/C %%,,tyyt - 

 w22GD6"23
 &,&!
 OOJSTS4<<S477SY399+];;jEU##	d#r.   c                    V P                   P                  4        FC  pV F:  pVP                  R 4      pV'       g   K  WA8X  g   K&  RV9   g   K/  VR,          u u # 	  KE  	  R# )r3   r#   N)rV   valuesr   )r"   rO   entriesentry
entry_paths   &&   r(   r   $GithubFileSystem._get_sha_from_cacheG  sP    }}++-G "YYv.
:*"4% <' ! .
 r.   )r    r   r   r   r   r   r   )<   r   )NNNN)T)FNNrd   )rr   NNN)__name__
__module____qualname____firstlineno____doc__rW   ry   protocolr   r   propertyr   classmethodr7   r>   rB   rE   r   rf   rR   staticmethodro   r   r   r   r   __static_attributes____classdictcell____classcell__)r'   __classdict__s   @@r(   r   r      s     6 FCWKHG <  
 3 3. - - - - > >@4D ( (  1
f-
4$l r.   r   )
rz   r   r   specr   utilsr   memoryr   r   r   r.   r(   <module>r      s&     	  % ) B) Br.   