import{s as oe,o as ie,n as me}from"../chunks/scheduler.6062bdaf.js";import{S as pe,i as ce,g as f,s as o,r as $,A as ge,h,f as t,c as i,j as T,u as _,x as W,k as X,y as g,a as m,v,d as w,t as M,w as U}from"../chunks/index.4bca734e.js";import{D as V}from"../chunks/Docstring.ed07512f.js";import{C as fe}from"../chunks/CodeBlock.fa01571c.js";import{E as he}from"../chunks/ExampleCodeBlock.823fb173.js";import{H as re}from"../chunks/Heading.723dceba.js";function de(I){let n,j="Usage:",u,p,c;return p=new fe({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMEhmRmlsZVN5c3RlbSUwQSUwQWZzJTIwJTNEJTIwSGZGaWxlU3lzdGVtKCklMEElMEElMjMlMjBMaXN0JTIwZmlsZXMlMEFmcy5nbG9iKCUyMm15LXVzZXJuYW1lJTJGbXktbW9kZWwlMkYqLmJpbiUyMiklMEFmcy5scyglMjJkYXRhc2V0cyUyRm15LXVzZXJuYW1lJTJGbXktZGF0YXNldCUyMiUyQyUyMGRldGFpbCUzREZhbHNlKSUwQSUwQSUyMyUyMFJlYWQlMkZ3cml0ZSUyMGZpbGVzJTBBd2l0aCUyMGZzLm9wZW4oJTIybXktdXNlcm5hbWUlMkZteS1tb2RlbCUyRnB5dG9yY2hfbW9kZWwuYmluJTIyKSUyMGFzJTIwZiUzQSUwQSUyMCUyMCUyMCUyMGRhdGElMjAlM0QlMjBmLnJlYWQoKSUwQXdpdGglMjBmcy5vcGVuKCUyMm15LXVzZXJuYW1lJTJGbXktbW9kZWwlMkZweXRvcmNoX21vZGVsLmJpbiUyMiUyQyUyMCUyMndiJTIyKSUyMGFzJTIwZiUzQSUwQSUyMCUyMCUyMCUyMGYud3JpdGUoZGF0YSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> HfFileSystem

<span class="hljs-meta">&gt;&gt;&gt; </span>fs = HfFileSystem()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># List files</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>fs.glob(<span class="hljs-string">&quot;my-username/my-model/*.bin&quot;</span>)
[<span class="hljs-string">&#x27;my-username/my-model/pytorch_model.bin&#x27;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>fs.ls(<span class="hljs-string">&quot;datasets/my-username/my-dataset&quot;</span>, detail=<span class="hljs-literal">False</span>)
[<span class="hljs-string">&#x27;datasets/my-username/my-dataset/.gitattributes&#x27;</span>, <span class="hljs-string">&#x27;datasets/my-username/my-dataset/README.md&#x27;</span>, <span class="hljs-string">&#x27;datasets/my-username/my-dataset/data.json&#x27;</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Read/write files</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> fs.<span class="hljs-built_in">open</span>(<span class="hljs-string">&quot;my-username/my-model/pytorch_model.bin&quot;</span>) <span class="hljs-keyword">as</span> f:
<span class="hljs-meta">... </span>    data = f.read()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> fs.<span class="hljs-built_in">open</span>(<span class="hljs-string">&quot;my-username/my-model/pytorch_model.bin&quot;</span>, <span class="hljs-string">&quot;wb&quot;</span>) <span class="hljs-keyword">as</span> f:
<span class="hljs-meta">... </span>    f.write(data)`,wrap:!1}}),{c(){n=f("p"),n.textContent=j,u=o(),$(p.$$.fragment)},l(a){n=h(a,"P",{"data-svelte-h":!0}),W(n)!=="svelte-5wyjqd"&&(n.textContent=j),u=i(a),_(p.$$.fragment,a)},m(a,d){m(a,n,d),m(a,u,d),v(p,a,d),c=!0},p:me,i(a){c||(w(p.$$.fragment,a),c=!0)},o(a){M(p.$$.fragment,a),c=!1},d(a){a&&(t(n),t(u)),U(p,a)}}}function ue(I){let n,j,u,p,c,a,d,ee='The <code>HfFileSystem</code> class provides a pythonic file interface to the Hugging Face Hub based on <a href="https://filesystem-spec.readthedocs.io/en/latest/" rel="nofollow"><code>fsspec</code></a>.',P,k,q,S,te='<code>HfFileSystem</code> is based on <a href="https://filesystem-spec.readthedocs.io/en/latest/" rel="nofollow">fsspec</a>, so it is compatible with most of the APIs that it offers. For more details, check out <a href="../guides/hf_file_system">our guide</a> and fsspec’s <a href="https://filesystem-spec.readthedocs.io/en/latest/api.html#fsspec.spec.AbstractFileSystem" rel="nofollow">API Reference</a>.',Q,l,x,A,H,se="Access a remote Hugging Face Hub repository as if were a local file system.",N,y,B,J,F,D,Z,C,K,b,G,O,E,ae="List the contents of a directory.",R,L,Y;return c=new re({props:{title:"Filesystem API",local:"filesystem-api",headingTag:"h1"}}),k=new re({props:{title:"HfFileSystem",local:"huggingface_hub.HfFileSystem",headingTag:"h2"}}),x=new V({props:{name:"class huggingface_hub.HfFileSystem",anchor:"huggingface_hub.HfFileSystem",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"huggingface_hub.HfFileSystem.token",description:`<strong>token</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Authentication token, obtained with <code>HfApi.login</code> method. Will default to the stored token.`,name:"token"}],source:"https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/hf_file_system.py#L52"}}),y=new he({props:{anchor:"huggingface_hub.HfFileSystem.example",$$slots:{default:[de]},$$scope:{ctx:I}}}),F=new V({props:{name:"__init__",anchor:"huggingface_hub.HfFileSystem.__init__",parameters:[{name:"*args",val:""},{name:"endpoint",val:": typing.Optional[str] = None"},{name:"token",val:": typing.Optional[str] = None"},{name:"**storage_options",val:""}],source:"https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/hf_file_system.py#L84"}}),C=new V({props:{name:"resolve_path",anchor:"huggingface_hub.HfFileSystem.resolve_path",parameters:[{name:"path",val:": str"},{name:"revision",val:": typing.Optional[str] = None"}],source:"https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/hf_file_system.py#L119"}}),G=new V({props:{name:"ls",anchor:"huggingface_hub.HfFileSystem.ls",parameters:[{name:"path",val:": str"},{name:"detail",val:": bool = True"},{name:"refresh",val:": bool = False"},{name:"revision",val:": typing.Optional[str] = None"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/hf_file_system.py#L256"}}),{c(){n=f("meta"),j=o(),u=f("p"),p=o(),$(c.$$.fragment),a=o(),d=f("p"),d.innerHTML=ee,P=o(),$(k.$$.fragment),q=o(),S=f("p"),S.innerHTML=te,Q=o(),l=f("div"),$(x.$$.fragment),A=o(),H=f("p"),H.textContent=se,N=o(),$(y.$$.fragment),B=o(),J=f("div"),$(F.$$.fragment),D=o(),Z=f("div"),$(C.$$.fragment),K=o(),b=f("div"),$(G.$$.fragment),O=o(),E=f("p"),E.textContent=ae,R=o(),L=f("p"),this.h()},l(e){const s=ge("svelte-u9bgzb",document.head);n=h(s,"META",{name:!0,content:!0}),s.forEach(t),j=i(e),u=h(e,"P",{}),T(u).forEach(t),p=i(e),_(c.$$.fragment,e),a=i(e),d=h(e,"P",{"data-svelte-h":!0}),W(d)!=="svelte-em1lpf"&&(d.innerHTML=ee),P=i(e),_(k.$$.fragment,e),q=i(e),S=h(e,"P",{"data-svelte-h":!0}),W(S)!=="svelte-1c4o3of"&&(S.innerHTML=te),Q=i(e),l=h(e,"DIV",{class:!0});var r=T(l);_(x.$$.fragment,r),A=i(r),H=h(r,"P",{"data-svelte-h":!0}),W(H)!=="svelte-xq4u8v"&&(H.textContent=se),N=i(r),_(y.$$.fragment,r),B=i(r),J=h(r,"DIV",{class:!0});var ne=T(J);_(F.$$.fragment,ne),ne.forEach(t),D=i(r),Z=h(r,"DIV",{class:!0});var le=T(Z);_(C.$$.fragment,le),le.forEach(t),K=i(r),b=h(r,"DIV",{class:!0});var z=T(b);_(G.$$.fragment,z),O=i(z),E=h(z,"P",{"data-svelte-h":!0}),W(E)!=="svelte-f8hcny"&&(E.textContent=ae),z.forEach(t),r.forEach(t),R=i(e),L=h(e,"P",{}),T(L).forEach(t),this.h()},h(){X(n,"name","hf:doc:metadata"),X(n,"content",ye),X(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),X(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),X(b,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),X(l,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,s){g(document.head,n),m(e,j,s),m(e,u,s),m(e,p,s),v(c,e,s),m(e,a,s),m(e,d,s),m(e,P,s),v(k,e,s),m(e,q,s),m(e,S,s),m(e,Q,s),m(e,l,s),v(x,l,null),g(l,A),g(l,H),g(l,N),v(y,l,null),g(l,B),g(l,J),v(F,J,null),g(l,D),g(l,Z),v(C,Z,null),g(l,K),g(l,b),v(G,b,null),g(b,O),g(b,E),m(e,R,s),m(e,L,s),Y=!0},p(e,[s]){const r={};s&2&&(r.$$scope={dirty:s,ctx:e}),y.$set(r)},i(e){Y||(w(c.$$.fragment,e),w(k.$$.fragment,e),w(x.$$.fragment,e),w(y.$$.fragment,e),w(F.$$.fragment,e),w(C.$$.fragment,e),w(G.$$.fragment,e),Y=!0)},o(e){M(c.$$.fragment,e),M(k.$$.fragment,e),M(x.$$.fragment,e),M(y.$$.fragment,e),M(F.$$.fragment,e),M(C.$$.fragment,e),M(G.$$.fragment,e),Y=!1},d(e){e&&(t(j),t(u),t(p),t(a),t(d),t(P),t(q),t(S),t(Q),t(l),t(R),t(L)),t(n),U(c,e),U(k,e),U(x),U(y),U(F),U(C),U(G)}}}const ye='{"title":"Filesystem API","local":"filesystem-api","sections":[{"title":"HfFileSystem","local":"huggingface_hub.HfFileSystem","sections":[],"depth":2}],"depth":1}';function be(I){return ie(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class je extends pe{constructor(n){super(),ce(this,n,be,ue,oe,{})}}export{je as component};
