+
    &jP!                     H    ^ 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V 3R llt]	R 4       t
R tR t]R	 4       t]R
 4       tRR ltRR ltRR ltRtVtV ;t# )GistFileSystema  
Interface to files in a single GitHub Gist.

Provides read-only access to a gist's files. Gists do not contain
subdirectories, so file listing is straightforward.

Parameters
----------
gist_id: str
    The ID of the gist you want to access (the long hex value from the URL).
filenames: list[str] (optional)
    If provided, only make a file system representing these files, and do not fetch
    the list of all files for this gist.
sha: str (optional)
    If provided, fetch a particular revision of the gist. If omitted,
    the latest revision is used.
username: str (optional)
    GitHub username for authentication.
token: str (optional)
    GitHub personal access token (required if username is given), or.
timeout: (float, float) or float, optional
    Connect and read timeouts for requests (default 60s each).
kwargs: dict
    Stored on `self.request_kw` and passed to `requests.get` when fetching Gist
    metadata or reading ("opening") a file.
gistz&https://api.github.com/gists/{gist_id}z,https://api.github.com/gists/{gist_id}/{sha}c                   < \         SV `  4        Wn        W n        W0n        Ve   Vf   \        R4      hW@n        WPn        Wpn        Ve   TMRV n	        V P                  4       V P                  R&   R # )NzUser auth requires a token )<   r   )super__init__gist_id	filenamessha
ValueErrorusernametoken
request_kwtimeout_fetch_file_listdircache)	selfr   r   r   r   r   r   kwargs	__class__s	   &&&&&&&,s/Users/jameslopez/projects/CWCArchive/cwc-podcast/.venv/lib/python3.14/site-packages/fsspec/implementations/gist.pyr   GistFileSystem.__init__(   sk     	"EM9:: 
 ")"5w8 !113b    c                $   RRRRR//pVP                  V P                  4       V P                  '       d0   V P                  '       d   V P                  V P                  3VR&   V# V P                  '       d   RV P                   2VR,          R&   V# )	z?Auth parameters passed to 'requests' if we have username/token.headersAcceptzapplication/vnd.github+jsonzX-GitHub-Api-Versionz
2022-11-28authzBearer Authorization)updater   r   r   )r   kws   & r   r$   GistFileSystem.kwA   s     7&
 			$//"===TZZZ--4BvJ 	 ZZZ/6tzzl-CByM/*	r   c                   V P                   '       d3   V P                  P                  V P                  V P                   R7      pM&V P                  P                  V P                  R7      p\
        P                  ! V3RV P                  /V P                  B pVP                  R8X  d0   \        RV P                   RV P                   ;'       g    R 24      hVP                  4        VP                  4       # )zK
Fetch the JSON metadata for this gist (possibly for a specific revision).
)r   r   )r   r     zGist not found: @latest)r   gist_rev_urlformatr   gist_urlrequestsgetr   r$   status_codeFileNotFoundErrorraise_for_statusjson)r   urlrs   &  r   _fetch_gist_metadata#GistFileSystem._fetch_gist_metadataQ   s     888##**4<<TXX*NC--&&t||&<CLL>dll>dgg>==C#"4<<.$((2F2Fh1GH  	
vvxr   c                   V P                  4       pV P                  '       dD   VP                  R/ 4      p/ pV P                   F  pWB9  d   \        V4      hW$,          W4&   K   	  MVP                  R/ 4      p. pVP	                  4        FC  w  rgVf   K  VP                  RVRRRVP                  R^ 4      RVP                  R4      /4       KE  	  V# )zb
Returns a list of dicts describing each file in the gist. These get stored
in self.dircache[""].
filesnametypefilesizeraw_url)r5   r   r.   r0   itemsappend)r   metaavailable_filesr8   fnoutfnamefinfos   &       r   r   GistFileSystem._fetch_file_listb   s    
 ((*>>>"hhw3OEnn,+B//+/	 %
 HHWb)E!KKMLE}JJEFEIIfa0uyy3	 * 
r   c                Z    \        V4      P                  RV4      pVP                  R4      # )z-
Remove 'gist://' from the path, if present.
path/)r   r.   lstrip)clsrH   s   &&r   _strip_protocolGistFileSystem._strip_protocol   s*     %T*..vt<{{3r   c                   \        V 4      p/ pRV9   d   VR,          '       d   VR,          VR&   RV9   d   VR,          '       d   VR,          VR&   RV9   d   VR,          '       d   VR,          VR&   RV9   ds   VR,          '       dd   VR,          P                  R^4      RR p\        V4      ^8X  d8   V^ ,          '       d   V^ ,          VR	&   V^,          '       d   V^,          .VR
&   V# )z
Parse 'gist://' style URLs into GistFileSystem constructor kwargs.
For example:
  gist://:TOKEN@<gist_id>/file.txt
  gist://username:TOKEN@<gist_id>/file.txt
r   passwordr   hostr   rH   rI   Nr   r   )r   rsplitlen)rH   sorC   
path_partss   &   r   _get_kwargs_from_urls$GistFileSystem._get_kwargs_from_urls   s     #4(: nC
O:j>CLR<BvJJZC	N R<BvJJF**32237J:!#a==!+ACJa==(21C$
r   c                <   T P                  T;'       g    R4      pVR8X  d   V P                  R,          pMFV P                  R,          pV Uu. uF  qfR,          V8X  g   K  VNK  	  ppV'       g   \        V4      hV'       d   V# \        R V 4       4      # u upi )aI  
List files in the gist. Gists are single-level, so any 'path' is basically
the filename, or empty for all files.

Parameters
----------
path : str, optional
    The filename to list. If empty, returns all files in the gist.
detail : bool, default False
    If True, return a list of dicts; if False, return a list of filenames.
r
   r9   c              3   2   "   T F  qR ,          x  K  	  R# 5i)r9   N ).0fs   & r   	<genexpr>$GistFileSystem.ls.<locals>.<genexpr>   s     5WF))Ws   )rL   r   r0   sorted)r   rH   detailr   results	all_filesr\   s   &&&,   r   lsGistFileSystem.ls   s     ##DJJB/2:mmB'G b)I"+A)QyD/@qq)GA'--N5W555 Bs   B"Bc                   VR8w  d   \        R4      hV P                  V4      pV P                  R,           Uu. uF  qUR,          V8X  g   K  VNK  	  ppV'       g   \        V4      hV^ ,          pVP	                  R4      pV'       g   \        RV 24      h\
        P                  ! V3RV P                  /V P                  B p	V	P                  R8X  d   \        V4      hV	P                  4        \        VR	V	P                  4      # u upi )
z#
Read a single file from the gist.
rbz'GitHub Gist FS is read-only (no write).r
   r9   r=   zNo raw_url for file: r   r'   N)NotImplementedErrorrL   r   r0   r.   r-   r   r$   r/   r1   r   content)
r   rH   mode
block_sizer   r\   matchesrE   r=   r4   s
   &&&&,     r   _openGistFileSystem._open   s     4<%&OPP##D)"mmB/E/V93D11/E#D))
))I&#&;D6$BCCLLB$,,B$''B==C#D))	$aii00 Fs   DDc                   V P                  WR7      p/ pV F9  p V P                  VR4      ;_uu_ 4       pVP                  4       Wg&   RRR4       K;  	  \	        V4      ^8X  d   V^ ,          V8X  d	   Wa,          # V#   + '       g   i     Kv  ; i  \         d&   p	TR8X  d   T	hTR8X  d    Rp	?	K  YT&    Rp	?	K  Rp	?	ii ; i)z
Return {path: contents} for the given file or files. If 'recursive' is True,
and path is empty, returns all files in the gist.
)	recursiverf   Nraiseomit)expand_pathopenreadr0   rS   )
r   rH   ro   on_errorr   pathsrC   pr\   es
   &&&&,     r   catGistFileSystem.cat   s    
    ;A	YYq$''1VVXCF ('  u:?uQx4/9
 (''$ w&G'Fs:   BA<B<BBBC B;1B;;C )r   r   r   r   r   r   r   )NNNNN)r
   F)rf   N)Frp   )__name__
__module____qualname____firstlineno____doc__protocolr,   r*   r   propertyr$   r5   r   classmethodrL   staticmethodrV   rc   rl   ry   __static_attributes____classdictcell____classcell__)r   __classdict__s   @@r   r   r      s{     6 H7HAL42  "@      86610 r   r   )r-   specr   utilsr   memoryr   r   rZ   r   r   <module>r      s      % ) i' ir   