import{s as pe,n as me,o as ue}from"../chunks/scheduler.9cda857a.js";import{S as fe,i as ce,e as s,s as i,c as p,h as he,a as r,d as a,b as l,f as se,g as m,j as L,k as re,l as de,m as n,n as u,t as f,o as c,p as h}from"../chunks/index.f47f3121.js";import{C as ge}from"../chunks/CopyLLMTxtMenu.676ed699.js";import{C as oe}from"../chunks/CodeBlock.24d62f98.js";import{H as Q,E as $e}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.64d112fc.js";function ve(W){let o,P,k,q,d,F,g,N,$,D='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>.',U,v,ee="There are three ways to provide the token: setting an environment variable, passing a parameter to the reader or using the Hugging Face CLI.",Z,T,G,w,te="If you set the environment variable <code>HF_TOKEN</code>, Polars will automatically use it when requesting datasets from Hugging Face.",S,x,j,_,V,b,ae='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,y,B,M,K,C,ne='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>hf auth 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.',O,H,ie="If multiple methods are specified, they are prioritized in the following order:",R,J,le="<li>Parameters (<code>storage_options</code>)</li> <li>Environment variable (<code>HF_TOKEN</code>)</li> <li>CLI</li>",X,E,z,I,Y;return d=new ge({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),g=new Q({props:{title:"Authentication",local:"authentication",headingTag:"h1"}}),T=new Q({props:{title:"Environment variable",local:"environment-variable",headingTag:"h2"}}),x=new oe({props:{code:"ZXhwb3J0JTIwSEZfVE9LRU4lM0QlMjJoZl94eHh4eHh4eHh4eHh4JTIy",highlighted:'<span class="hljs-built_in">export</span> HF_TOKEN=<span class="hljs-string">&quot;hf_xxxxxxxxxxxxx&quot;</span>',wrap:!1}}),_=new Q({props:{title:"Parameters",local:"parameters",headingTag:"h2"}}),y=new oe({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}}),M=new Q({props:{title:"CLI",local:"cli",headingTag:"h2"}}),E=new $e({props:{source:"https://github.com/huggingface/hub-docs/blob/main/docs/hub/datasets-polars-auth.md"}}),{c(){o=s("meta"),P=i(),k=s("p"),q=i(),p(d.$$.fragment),F=i(),p(g.$$.fragment),N=i(),$=s("p"),$.innerHTML=D,U=i(),v=s("p"),v.textContent=ee,Z=i(),p(T.$$.fragment),G=i(),w=s("p"),w.innerHTML=te,S=i(),p(x.$$.fragment),j=i(),p(_.$$.fragment),V=i(),b=s("p"),b.innerHTML=ae,A=i(),p(y.$$.fragment),B=i(),p(M.$$.fragment),K=i(),C=s("p"),C.innerHTML=ne,O=i(),H=s("p"),H.textContent=ie,R=i(),J=s("ul"),J.innerHTML=le,X=i(),p(E.$$.fragment),z=i(),I=s("p"),this.h()},l(e){const t=he("svelte-u9bgzb",document.head);o=r(t,"META",{name:!0,content:!0}),t.forEach(a),P=l(e),k=r(e,"P",{}),se(k).forEach(a),q=l(e),m(d.$$.fragment,e),F=l(e),m(g.$$.fragment,e),N=l(e),$=r(e,"P",{"data-svelte-h":!0}),L($)!=="svelte-1u170q8"&&($.innerHTML=D),U=l(e),v=r(e,"P",{"data-svelte-h":!0}),L(v)!=="svelte-87799q"&&(v.textContent=ee),Z=l(e),m(T.$$.fragment,e),G=l(e),w=r(e,"P",{"data-svelte-h":!0}),L(w)!=="svelte-txw22r"&&(w.innerHTML=te),S=l(e),m(x.$$.fragment,e),j=l(e),m(_.$$.fragment,e),V=l(e),b=r(e,"P",{"data-svelte-h":!0}),L(b)!=="svelte-3gdhjo"&&(b.innerHTML=ae),A=l(e),m(y.$$.fragment,e),B=l(e),m(M.$$.fragment,e),K=l(e),C=r(e,"P",{"data-svelte-h":!0}),L(C)!=="svelte-14v7536"&&(C.innerHTML=ne),O=l(e),H=r(e,"P",{"data-svelte-h":!0}),L(H)!=="svelte-l6pbb3"&&(H.textContent=ie),R=l(e),J=r(e,"UL",{"data-svelte-h":!0}),L(J)!=="svelte-e5vavs"&&(J.innerHTML=le),X=l(e),m(E.$$.fragment,e),z=l(e),I=r(e,"P",{}),se(I).forEach(a),this.h()},h(){re(o,"name","hf:doc:metadata"),re(o,"content",Te)},m(e,t){de(document.head,o),n(e,P,t),n(e,k,t),n(e,q,t),u(d,e,t),n(e,F,t),u(g,e,t),n(e,N,t),n(e,$,t),n(e,U,t),n(e,v,t),n(e,Z,t),u(T,e,t),n(e,G,t),n(e,w,t),n(e,S,t),u(x,e,t),n(e,j,t),u(_,e,t),n(e,V,t),n(e,b,t),n(e,A,t),u(y,e,t),n(e,B,t),u(M,e,t),n(e,K,t),n(e,C,t),n(e,O,t),n(e,H,t),n(e,R,t),n(e,J,t),n(e,X,t),u(E,e,t),n(e,z,t),n(e,I,t),Y=!0},p:me,i(e){Y||(f(d.$$.fragment,e),f(g.$$.fragment,e),f(T.$$.fragment,e),f(x.$$.fragment,e),f(_.$$.fragment,e),f(y.$$.fragment,e),f(M.$$.fragment,e),f(E.$$.fragment,e),Y=!0)},o(e){c(d.$$.fragment,e),c(g.$$.fragment,e),c(T.$$.fragment,e),c(x.$$.fragment,e),c(_.$$.fragment,e),c(y.$$.fragment,e),c(M.$$.fragment,e),c(E.$$.fragment,e),Y=!1},d(e){e&&(a(P),a(k),a(q),a(F),a(N),a($),a(U),a(v),a(Z),a(G),a(w),a(S),a(j),a(V),a(b),a(A),a(B),a(K),a(C),a(O),a(H),a(R),a(J),a(X),a(z),a(I)),a(o),h(d,e),h(g,e),h(T,e),h(x,e),h(_,e),h(y,e),h(M,e),h(E,e)}}}const Te='{"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 we(W){return ue(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ce extends fe{constructor(o){super(),ce(this,o,we,ve,pe,{})}}export{Ce as component};
