import{s as ve,o as we,n as fe}from"../chunks/scheduler.6062bdaf.js";import{S as xe,i as Me,g,s as r,r as _,A as He,h,f as n,c as l,j as R,u as $,x as H,k as A,y as c,a as m,v,d as w,t as x,w as M}from"../chunks/index.4bca734e.js";import{T as _e}from"../chunks/Tip.b9ac1f03.js";import{D as te}from"../chunks/Docstring.81ba5e3c.js";import{C as Fe}from"../chunks/CodeBlock.fa01571c.js";import{E as Se}from"../chunks/ExampleCodeBlock.30e7542f.js";import{H as $e,E as Ue}from"../chunks/EditOnGithub.74ab2baa.js";function ke(F){let t,d=`<a href="/docs/huggingface_hub/main/ko/package_reference/hf_file_system#huggingface_hub.HfFileSystem">HfFileSystem</a> provides fsspec compatibility, which is useful for libraries that require it (e.g., reading
Hugging Face datasets directly with <code>pandas</code>). However, it introduces additional overhead due to this compatibility
layer. For better performance and reliability, it’s recommended to use <code>HfApi</code> methods when possible.`;return{c(){t=g("p"),t.innerHTML=d},l(a){t=h(a,"P",{"data-svelte-h":!0}),H(t)!=="svelte-1aq70hv"&&(t.innerHTML=d)},m(a,f){m(a,t,f)},p:fe,d(a){a&&n(t)}}}function Te(F){let t,d="Usage:",a,f,u;return f=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(){t=g("p"),t.textContent=d,a=r(),_(f.$$.fragment)},l(o){t=h(o,"P",{"data-svelte-h":!0}),H(t)!=="svelte-5wyjqd"&&(t.textContent=d),a=l(o),$(f.$$.fragment,o)},m(o,b){m(o,t,b),m(o,a,b),v(f,o,b),u=!0},p:fe,i(o){u||(w(f.$$.fragment,o),u=!0)},o(o){x(f.$$.fragment,o),u=!1},d(o){o&&(n(t),n(a)),M(f,o)}}}function je(F){let t,d="Note: When possible, use <code>HfApi.list_repo_tree()</code> for better performance.";return{c(){t=g("p"),t.innerHTML=d},l(a){t=h(a,"P",{"data-svelte-h":!0}),H(t)!=="svelte-se5rid"&&(t.innerHTML=d)},m(a,f){m(a,t,f)},p:fe,d(a){a&&n(t)}}}function Ce(F){let t,d,a,f,u,o,b,ge='<a href="/docs/huggingface_hub/main/ko/package_reference/hf_file_system#huggingface_hub.HfFileSystem">HfFileSystem</a> 클래스는 <a href="https://filesystem-spec.readthedocs.io/en/latest/" rel="nofollow"><code>fsspec</code></a>을 기반으로 Hugging Face Hub에 Python 파일 인터페이스를 제공합니다.',Y,C,z,E,he='<a href="/docs/huggingface_hub/main/ko/package_reference/hf_file_system#huggingface_hub.HfFileSystem">HfFileSystem</a>은 <a href="https://filesystem-spec.readthedocs.io/en/latest/" rel="nofollow"><code>fsspec</code></a>을 기반으로 하므로 제공되는 대부분의 API와 호환됩니다. 자세한 내용은 <a href="../guides/hf_file_system">가이드</a> 및 fsspec의 <a href="https://filesystem-spec.readthedocs.io/en/latest/api.html#fsspec.spec.AbstractFileSystem" rel="nofollow">API 레퍼런스</a>를 확인하세요.',B,i,G,se,q,de="Access a remote Hugging Face Hub repository as if were a local file system.",ne,S,ae,U,oe,D,J,ie,k,L,re,X,ue="Resolve a Hugging Face file system path into its components.",le,y,Z,ce,W,ye="List the contents of a directory.",pe,N,be='For more details, refer to <a href="https://filesystem-spec.readthedocs.io/en/latest/api.html#fsspec.spec.AbstractFileSystem.ls" rel="nofollow">fsspec documentation</a>.',me,T,K,I,O,V,ee;return u=new $e({props:{title:"파일 시스템 API",local:"filesystem-api",headingTag:"h1"}}),C=new $e({props:{title:"HfFileSystem",local:"huggingface_hub.HfFileSystem",headingTag:"h2"}}),G=new te({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> or <code>bool</code>, <em>optional</em>) &#x2014;
A valid user access token (string). Defaults to the locally saved
token, which is the recommended method for authentication (see
<a href="https://huggingface.co/docs/huggingface_hub/quick-start#authentication" rel="nofollow">https://huggingface.co/docs/huggingface_hub/quick-start#authentication</a>).
To disable authentication, pass <code>False</code>.`,name:"token"},{anchor:"huggingface_hub.HfFileSystem.endpoint",description:`<strong>endpoint</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Endpoint of the Hub. Defaults to <a href="https://huggingface.co" rel="nofollow">https://huggingface.co</a>.`,name:"endpoint"}],source:"https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/hf_file_system.py#L58"}}),S=new _e({props:{warning:!0,$$slots:{default:[ke]},$$scope:{ctx:F}}}),U=new Se({props:{anchor:"huggingface_hub.HfFileSystem.example",$$slots:{default:[Te]},$$scope:{ctx:F}}}),J=new te({props:{name:"__init__",anchor:"huggingface_hub.HfFileSystem.__init__",parameters:[{name:"*args",val:""},{name:"endpoint",val:": typing.Optional[str] = None"},{name:"token",val:": typing.Union[bool, str, NoneType] = None"},{name:"**storage_options",val:""}],source:"https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/hf_file_system.py#L102"}}),L=new te({props:{name:"resolve_path",anchor:"huggingface_hub.HfFileSystem.resolve_path",parameters:[{name:"path",val:": str"},{name:"revision",val:": typing.Optional[str] = None"}],parametersDescription:[{anchor:"huggingface_hub.HfFileSystem.resolve_path.path",description:`<strong>path</strong> (<code>str</code>) &#x2014;
Path to resolve.`,name:"path"},{anchor:"huggingface_hub.HfFileSystem.resolve_path.revision",description:`<strong>revision</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The revision of the repo to resolve. Defaults to the revision specified in the path.`,name:"revision"}],source:"https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/hf_file_system.py#L139",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>Resolved path information containing <code>repo_type</code>, <code>repo_id</code>, <code>revision</code> and <code>path_in_repo</code>.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>HfFileSystemResolvedPath</code></p>
`,raiseDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<ul>
<li><code>ValueError</code> —
If path contains conflicting revision information.</li>
<li><code>NotImplementedError</code> —
If trying to list repositories.</li>
</ul>
`,raiseType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>ValueError</code> or <code>NotImplementedError</code></p>
`}}),Z=new te({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:""}],parametersDescription:[{anchor:"huggingface_hub.HfFileSystem.ls.path",description:`<strong>path</strong> (<code>str</code>) &#x2014;
Path to the directory.`,name:"path"},{anchor:"huggingface_hub.HfFileSystem.ls.detail",description:`<strong>detail</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If True, returns a list of dictionaries containing file information. If False,
returns a list of file paths. Defaults to True.`,name:"detail"},{anchor:"huggingface_hub.HfFileSystem.ls.refresh",description:`<strong>refresh</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If True, bypass the cache and fetch the latest data. Defaults to False.`,name:"refresh"},{anchor:"huggingface_hub.HfFileSystem.ls.revision",description:`<strong>revision</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The git revision to list from.`,name:"revision"}],source:"https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/hf_file_system.py#L339",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>List of file paths (if detail=False) or list of file information
dictionaries (if detail=True).</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>List[Union[str, Dict[str, Any]]]</code></p>
`}}),T=new _e({props:{warning:!0,$$slots:{default:[je]},$$scope:{ctx:F}}}),I=new Ue({props:{source:"https://github.com/huggingface/huggingface_hub/blob/main/docs/source/ko/package_reference/hf_file_system.md"}}),{c(){t=g("meta"),d=r(),a=g("p"),f=r(),_(u.$$.fragment),o=r(),b=g("p"),b.innerHTML=ge,Y=r(),_(C.$$.fragment),z=r(),E=g("p"),E.innerHTML=he,B=r(),i=g("div"),_(G.$$.fragment),se=r(),q=g("p"),q.textContent=de,ne=r(),_(S.$$.fragment),ae=r(),_(U.$$.fragment),oe=r(),D=g("div"),_(J.$$.fragment),ie=r(),k=g("div"),_(L.$$.fragment),re=r(),X=g("p"),X.textContent=ue,le=r(),y=g("div"),_(Z.$$.fragment),ce=r(),W=g("p"),W.textContent=ye,pe=r(),N=g("p"),N.innerHTML=be,me=r(),_(T.$$.fragment),K=r(),_(I.$$.fragment),O=r(),V=g("p"),this.h()},l(e){const s=He("svelte-u9bgzb",document.head);t=h(s,"META",{name:!0,content:!0}),s.forEach(n),d=l(e),a=h(e,"P",{}),R(a).forEach(n),f=l(e),$(u.$$.fragment,e),o=l(e),b=h(e,"P",{"data-svelte-h":!0}),H(b)!=="svelte-149qtx7"&&(b.innerHTML=ge),Y=l(e),$(C.$$.fragment,e),z=l(e),E=h(e,"P",{"data-svelte-h":!0}),H(E)!=="svelte-cnlis"&&(E.innerHTML=he),B=l(e),i=h(e,"DIV",{class:!0});var p=R(i);$(G.$$.fragment,p),se=l(p),q=h(p,"P",{"data-svelte-h":!0}),H(q)!=="svelte-xq4u8v"&&(q.textContent=de),ne=l(p),$(S.$$.fragment,p),ae=l(p),$(U.$$.fragment,p),oe=l(p),D=h(p,"DIV",{class:!0});var Q=R(D);$(J.$$.fragment,Q),Q.forEach(n),ie=l(p),k=h(p,"DIV",{class:!0});var P=R(k);$(L.$$.fragment,P),re=l(P),X=h(P,"P",{"data-svelte-h":!0}),H(X)!=="svelte-vfdh7r"&&(X.textContent=ue),P.forEach(n),le=l(p),y=h(p,"DIV",{class:!0});var j=R(y);$(Z.$$.fragment,j),ce=l(j),W=h(j,"P",{"data-svelte-h":!0}),H(W)!=="svelte-f8hcny"&&(W.textContent=ye),pe=l(j),N=h(j,"P",{"data-svelte-h":!0}),H(N)!=="svelte-17yp07o"&&(N.innerHTML=be),me=l(j),$(T.$$.fragment,j),j.forEach(n),p.forEach(n),K=l(e),$(I.$$.fragment,e),O=l(e),V=h(e,"P",{}),R(V).forEach(n),this.h()},h(){A(t,"name","hf:doc:metadata"),A(t,"content",Ee),A(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),A(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),A(y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),A(i,"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){c(document.head,t),m(e,d,s),m(e,a,s),m(e,f,s),v(u,e,s),m(e,o,s),m(e,b,s),m(e,Y,s),v(C,e,s),m(e,z,s),m(e,E,s),m(e,B,s),m(e,i,s),v(G,i,null),c(i,se),c(i,q),c(i,ne),v(S,i,null),c(i,ae),v(U,i,null),c(i,oe),c(i,D),v(J,D,null),c(i,ie),c(i,k),v(L,k,null),c(k,re),c(k,X),c(i,le),c(i,y),v(Z,y,null),c(y,ce),c(y,W),c(y,pe),c(y,N),c(y,me),v(T,y,null),m(e,K,s),v(I,e,s),m(e,O,s),m(e,V,s),ee=!0},p(e,[s]){const p={};s&2&&(p.$$scope={dirty:s,ctx:e}),S.$set(p);const Q={};s&2&&(Q.$$scope={dirty:s,ctx:e}),U.$set(Q);const P={};s&2&&(P.$$scope={dirty:s,ctx:e}),T.$set(P)},i(e){ee||(w(u.$$.fragment,e),w(C.$$.fragment,e),w(G.$$.fragment,e),w(S.$$.fragment,e),w(U.$$.fragment,e),w(J.$$.fragment,e),w(L.$$.fragment,e),w(Z.$$.fragment,e),w(T.$$.fragment,e),w(I.$$.fragment,e),ee=!0)},o(e){x(u.$$.fragment,e),x(C.$$.fragment,e),x(G.$$.fragment,e),x(S.$$.fragment,e),x(U.$$.fragment,e),x(J.$$.fragment,e),x(L.$$.fragment,e),x(Z.$$.fragment,e),x(T.$$.fragment,e),x(I.$$.fragment,e),ee=!1},d(e){e&&(n(d),n(a),n(f),n(o),n(b),n(Y),n(z),n(E),n(B),n(i),n(K),n(O),n(V)),n(t),M(u,e),M(C,e),M(G),M(S),M(U),M(J),M(L),M(Z),M(T),M(I,e)}}}const Ee='{"title":"파일 시스템 API","local":"filesystem-api","sections":[{"title":"HfFileSystem","local":"huggingface_hub.HfFileSystem","sections":[],"depth":2}],"depth":1}';function Ge(F){return we(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Xe extends xe{constructor(t){super(),Me(this,t,Ge,Ce,ve,{})}}export{Xe as component};
