import{s as oe,n as re,o as pe}from"../chunks/scheduler.d6170356.js";import{S as ue,i as ce,g as s,s as i,r as x,A as me,h as o,f as a,c as l,j as ie,u as y,x as M,k as le,y as he,a as n,v as H,d as J,t as C,w as E}from"../chunks/index.fcd4cc08.js";import{C as se}from"../chunks/CodeBlock.7b16bdef.js";import{H as z,E as fe}from"../chunks/EditOnGithub.da2b595c.js";function de(Y){let r,I,k,P,p,q,u,Q='In order to access private or gated datasets, you need to authenticate first. Authentication works by providing an access token which will be used to authenticate and authorize your access to gated and private datasets. The first step is to create an access token for your account. This can be done by visiting <a href="https://huggingface.co/settings/tokens" rel="nofollow">Hugging Face Settings - Tokens</a>.',F,c,W="There are three ways to provide the token: setting an environment variable, passing a parameter to the reader or using the Hugging Face CLI.",N,m,U,h,D="If you set the environment variable <code>HF_TOKEN</code>, Polars will automatically use it when requesting datasets from Hugging Face.",Z,f,G,d,j,g,ee='You can also explicitly provide the access token to the reader (e.g. <code>read_parquet</code>) through the <code>storage_options</code> parameter. For a full overview of all the parameters, check out the <a href="https://docs.pola.rs/api/python/stable/reference/api/polars.read_parquet.html" rel="nofollow">API reference guide</a>.',A,$,S,v,V,T,te='Alternatively, you can you use the <a href="/docs/huggingface_hub/en/guides/cli">Hugging Face CLI</a> to  authenticate. After successfully logging in with <code>huggingface-cli login</code> an access token will be stored in the <code>HF_HOME</code> directory which defaults to <code>~/.cache/huggingface</code>. Polars will then use this token for authentication.',B,w,ae="If multiple methods are specified, they are prioritized in the following order:",K,_,ne="<li>Parameters (<code>storage_options</code>)</li> <li>Environment variable (<code>HF_TOKEN</code>)</li> <li>CLI</li>",O,b,R,L,X;return p=new z({props:{title:"Authentication",local:"authentication",headingTag:"h1"}}),m=new z({props:{title:"Environment variable",local:"environment-variable",headingTag:"h2"}}),f=new se({props:{code:"ZXhwb3J0JTIwSEZfVE9LRU4lM0QlMjJoZl94eHh4eHh4eHh4eHh4JTIy",highlighted:'<span class="hljs-built_in">export</span> HF_TOKEN=<span class="hljs-string">&quot;hf_xxxxxxxxxxxxx&quot;</span>',wrap:!1}}),d=new z({props:{title:"Parameters",local:"parameters",headingTag:"h2"}}),$=new se({props:{code:"cGwucmVhZF9wYXJxdWV0KCUwQSUyMCUyMCUyMCUyMCUyMmhmJTNBJTJGJTJGZGF0YXNldHMlMkZyb25lbmVsZGFuJTJGVGlueVN0b3JpZXMlMkZkYXRhJTJGdHJhaW4tKi5wYXJxdWV0JTIyJTJDJTBBJTIwJTIwJTIwJTIwc3RvcmFnZV9vcHRpb25zJTNEJTdCJTIydG9rZW4lMjIlM0ElMjBBQ0NFU1NfVE9LRU4lN0QlMkMlMEEp",highlighted:`pl.read_parquet(
    <span class="hljs-string">&quot;hf://datasets/roneneldan/TinyStories/data/train-*.parquet&quot;</span>,
    storage_options={<span class="hljs-string">&quot;token&quot;</span>: ACCESS_TOKEN},
)`,wrap:!1}}),v=new z({props:{title:"CLI",local:"cli",headingTag:"h2"}}),b=new fe({props:{source:"https://github.com/huggingface/hub-docs/blob/main/docs/hub/datasets-polars-auth.md"}}),{c(){r=s("meta"),I=i(),k=s("p"),P=i(),x(p.$$.fragment),q=i(),u=s("p"),u.innerHTML=Q,F=i(),c=s("p"),c.textContent=W,N=i(),x(m.$$.fragment),U=i(),h=s("p"),h.innerHTML=D,Z=i(),x(f.$$.fragment),G=i(),x(d.$$.fragment),j=i(),g=s("p"),g.innerHTML=ee,A=i(),x($.$$.fragment),S=i(),x(v.$$.fragment),V=i(),T=s("p"),T.innerHTML=te,B=i(),w=s("p"),w.textContent=ae,K=i(),_=s("ul"),_.innerHTML=ne,O=i(),x(b.$$.fragment),R=i(),L=s("p"),this.h()},l(e){const t=me("svelte-u9bgzb",document.head);r=o(t,"META",{name:!0,content:!0}),t.forEach(a),I=l(e),k=o(e,"P",{}),ie(k).forEach(a),P=l(e),y(p.$$.fragment,e),q=l(e),u=o(e,"P",{"data-svelte-h":!0}),M(u)!=="svelte-1u170q8"&&(u.innerHTML=Q),F=l(e),c=o(e,"P",{"data-svelte-h":!0}),M(c)!=="svelte-87799q"&&(c.textContent=W),N=l(e),y(m.$$.fragment,e),U=l(e),h=o(e,"P",{"data-svelte-h":!0}),M(h)!=="svelte-txw22r"&&(h.innerHTML=D),Z=l(e),y(f.$$.fragment,e),G=l(e),y(d.$$.fragment,e),j=l(e),g=o(e,"P",{"data-svelte-h":!0}),M(g)!=="svelte-3gdhjo"&&(g.innerHTML=ee),A=l(e),y($.$$.fragment,e),S=l(e),y(v.$$.fragment,e),V=l(e),T=o(e,"P",{"data-svelte-h":!0}),M(T)!=="svelte-4es4pz"&&(T.innerHTML=te),B=l(e),w=o(e,"P",{"data-svelte-h":!0}),M(w)!=="svelte-l6pbb3"&&(w.textContent=ae),K=l(e),_=o(e,"UL",{"data-svelte-h":!0}),M(_)!=="svelte-e5vavs"&&(_.innerHTML=ne),O=l(e),y(b.$$.fragment,e),R=l(e),L=o(e,"P",{}),ie(L).forEach(a),this.h()},h(){le(r,"name","hf:doc:metadata"),le(r,"content",ge)},m(e,t){he(document.head,r),n(e,I,t),n(e,k,t),n(e,P,t),H(p,e,t),n(e,q,t),n(e,u,t),n(e,F,t),n(e,c,t),n(e,N,t),H(m,e,t),n(e,U,t),n(e,h,t),n(e,Z,t),H(f,e,t),n(e,G,t),H(d,e,t),n(e,j,t),n(e,g,t),n(e,A,t),H($,e,t),n(e,S,t),H(v,e,t),n(e,V,t),n(e,T,t),n(e,B,t),n(e,w,t),n(e,K,t),n(e,_,t),n(e,O,t),H(b,e,t),n(e,R,t),n(e,L,t),X=!0},p:re,i(e){X||(J(p.$$.fragment,e),J(m.$$.fragment,e),J(f.$$.fragment,e),J(d.$$.fragment,e),J($.$$.fragment,e),J(v.$$.fragment,e),J(b.$$.fragment,e),X=!0)},o(e){C(p.$$.fragment,e),C(m.$$.fragment,e),C(f.$$.fragment,e),C(d.$$.fragment,e),C($.$$.fragment,e),C(v.$$.fragment,e),C(b.$$.fragment,e),X=!1},d(e){e&&(a(I),a(k),a(P),a(q),a(u),a(F),a(c),a(N),a(U),a(h),a(Z),a(G),a(j),a(g),a(A),a(S),a(V),a(T),a(B),a(w),a(K),a(_),a(O),a(R),a(L)),a(r),E(p,e),E(m,e),E(f,e),E(d,e),E($,e),E(v,e),E(b,e)}}}const ge='{"title":"Authentication","local":"authentication","sections":[{"title":"Environment variable","local":"environment-variable","sections":[],"depth":2},{"title":"Parameters","local":"parameters","sections":[],"depth":2},{"title":"CLI","local":"cli","sections":[],"depth":2}],"depth":1}';function $e(Y){return pe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class be extends ue{constructor(r){super(),ce(this,r,$e,de,oe,{})}}export{be as component};
