import{s as Ue,o as Ae,n as Se}from"../chunks/scheduler.6062bdaf.js";import{S as Ne,i as Re,g,s as i,r as b,A as We,h as s,f as n,c as a,j as Y,u as $,x as d,k as Z,y as r,a as l,v,d as w,t as k,w as x}from"../chunks/index.4bca734e.js";import{T as Oe}from"../chunks/Tip.b9ac1f03.js";import{D as de}from"../chunks/Docstring.ed07512f.js";import{H as te}from"../chunks/Heading.723dceba.js";function Be(O){let o,T=`<a href="/docs/huggingface_hub/v0.19.0.rc0/en/package_reference/login#huggingface_hub.login">login()</a> is a drop-in replacement method for <a href="/docs/huggingface_hub/v0.19.0.rc0/en/package_reference/login#huggingface_hub.notebook_login">notebook_login()</a> as it wraps and
extends its capabilities.`;return{c(){o=g("p"),o.innerHTML=T},l(c){o=s(c,"P",{"data-svelte-h":!0}),d(o)!=="svelte-jf8tt4"&&(o.innerHTML=T)},m(c,y){l(c,o,y)},p:Se,d(c){c&&n(o)}}}function Ge(O){let o,T=`When the token is not passed, <a href="/docs/huggingface_hub/v0.19.0.rc0/en/package_reference/login#huggingface_hub.login">login()</a> will automatically detect if the script runs
in a notebook or not. However, this detection might not be accurate due to the
variety of notebooks that exists nowadays. If that is the case, you can always force
the UI by using <a href="/docs/huggingface_hub/v0.19.0.rc0/en/package_reference/login#huggingface_hub.notebook_login">notebook_login()</a> or <a href="/docs/huggingface_hub/v0.19.0.rc0/en/package_reference/login#huggingface_hub.interpreter_login">interpreter_login()</a>.`;return{c(){o=g("p"),o.innerHTML=T},l(c){o=s(c,"P",{"data-svelte-h":!0}),d(o)!=="svelte-178zqnv"&&(o.innerHTML=T)},m(c,y){l(c,o,y)},p:Se,d(c){c&&n(o)}}}function Je(O){let o,T,c,y,I,ne,M,He=`The <code>huggingface_hub</code> library allows users to programmatically login and logout the
machine to the Hub.`,oe,P,ie,u,E,fe,S,Ce="Login the machine to access the Hub.",pe,U,Ie=`The <code>token</code> is persisted in cache and set as a git credential. Once done, the machine
is logged in and the access token will be available across all <code>huggingface_hub</code>
components. If <code>token</code> is not provided, it will be prompted to the user either with
a widget (in a notebook) or via the terminal.`,me,A,Me=`To login from outside of a script, one can also use <code>huggingface-cli login</code> which is
a cli command that wraps <a href="/docs/huggingface_hub/v0.19.0.rc0/en/package_reference/login#huggingface_hub.login">login()</a>.`,_e,L,be,H,ae,q,re,f,D,$e,N,Pe="Displays a prompt to login to the HF website and store the token.",ve,R,Ee=`This is equivalent to <a href="/docs/huggingface_hub/v0.19.0.rc0/en/package_reference/login#huggingface_hub.login">login()</a> without passing a token when not run in a notebook.
<a href="/docs/huggingface_hub/v0.19.0.rc0/en/package_reference/login#huggingface_hub.interpreter_login">interpreter_login()</a> is useful if you want to force the use of the terminal prompt
instead of a notebook widget.`,we,W,qe='For more details, see <a href="/docs/huggingface_hub/v0.19.0.rc0/en/package_reference/login#huggingface_hub.login">login()</a>.',ge,F,se,p,V,ke,B,De="Displays a widget to login to the HF website and store the token.",xe,G,Fe=`This is equivalent to <a href="/docs/huggingface_hub/v0.19.0.rc0/en/package_reference/login#huggingface_hub.login">login()</a> without passing a token when run in a notebook.
<a href="/docs/huggingface_hub/v0.19.0.rc0/en/package_reference/login#huggingface_hub.notebook_login">notebook_login()</a> is useful if you want to force the use of the notebook widget
instead of a prompt in the terminal.`,Te,J,Ve='For more details, see <a href="/docs/huggingface_hub/v0.19.0.rc0/en/package_reference/login#huggingface_hub.login">login()</a>.',le,z,ce,m,j,ye,K,ze="Logout the machine from the Hub.",Le,Q,je="Token is deleted from the machine and removed from git credential.",ue,ee,he;return I=new te({props:{title:"Login and logout",local:"login-and-logout",headingTag:"h1"}}),P=new te({props:{title:"login",local:"huggingface_hub.login",headingTag:"h2"}}),E=new de({props:{name:"huggingface_hub.login",anchor:"huggingface_hub.login",parameters:[{name:"token",val:": typing.Optional[str] = None"},{name:"add_to_git_credential",val:": bool = False"},{name:"new_session",val:": bool = True"},{name:"write_permission",val:": bool = False"}],parametersDescription:[{anchor:"huggingface_hub.login.token",description:`<strong>token</strong> (<code>str</code>, <em>optional</em>) &#x2014;
User access token to generate from <a href="https://huggingface.co/settings/token" rel="nofollow">https://huggingface.co/settings/token</a>.`,name:"token"},{anchor:"huggingface_hub.login.add_to_git_credential",description:`<strong>add_to_git_credential</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
If <code>True</code>, token will be set as git credential. If no git credential helper
is configured, a warning will be displayed to the user. If <code>token</code> is <code>None</code>,
the value of <code>add_to_git_credential</code> is ignored and will be prompted again
to the end user.`,name:"add_to_git_credential"},{anchor:"huggingface_hub.login.new_session",description:`<strong>new_session</strong> (<code>bool</code>, defaults to <code>True</code>) &#x2014;
If <code>True</code>, will request a token even if one is already saved on the machine.`,name:"new_session"},{anchor:"huggingface_hub.login.write_permission",description:`<strong>write_permission</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
If <code>True</code>, requires a token with write permission.`,name:"write_permission"}],source:"https://github.com/huggingface/huggingface_hub/blob/v0.19.0.rc0/src/huggingface_hub/_login.py#L48",raiseDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<ul>
<li><a
  href="https://docs.python.org/3/library/exceptions.html#ValueError"
  rel="nofollow"
><code>ValueError</code></a> —
If an organization token is passed. Only personal account tokens are valid
to login.</li>
<li><a
  href="https://docs.python.org/3/library/exceptions.html#ValueError"
  rel="nofollow"
><code>ValueError</code></a> —
If token is invalid.</li>
<li><a
  href="https://docs.python.org/3/library/exceptions.html#ImportError"
  rel="nofollow"
><code>ImportError</code></a> —
If running in a notebook but <code>ipywidgets</code> is not installed.</li>
</ul>
`,raiseType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>ValueError</code> or <code>ImportError</code></p>
`}}),L=new Oe({props:{$$slots:{default:[Be]},$$scope:{ctx:O}}}),H=new Oe({props:{$$slots:{default:[Ge]},$$scope:{ctx:O}}}),q=new te({props:{title:"interpreter_login",local:"huggingface_hub.interpreter_login",headingTag:"h2"}}),D=new de({props:{name:"huggingface_hub.interpreter_login",anchor:"huggingface_hub.interpreter_login",parameters:[{name:"new_session",val:": bool = True"},{name:"write_permission",val:": bool = False"}],parametersDescription:[{anchor:"huggingface_hub.interpreter_login.new_session",description:`<strong>new_session</strong> (<code>bool</code>, defaults to <code>True</code>) &#x2014;
If <code>True</code>, will request a token even if one is already saved on the machine.`,name:"new_session"},{anchor:"huggingface_hub.interpreter_login.write_permission",description:`<strong>write_permission</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
If <code>True</code>, requires a token with write permission.`,name:"write_permission"}],source:"https://github.com/huggingface/huggingface_hub/blob/v0.19.0.rc0/src/huggingface_hub/_login.py#L134"}}),F=new te({props:{title:"notebook_login",local:"huggingface_hub.notebook_login",headingTag:"h2"}}),V=new de({props:{name:"huggingface_hub.notebook_login",anchor:"huggingface_hub.notebook_login",parameters:[{name:"new_session",val:": bool = True"},{name:"write_permission",val:": bool = False"}],parametersDescription:[{anchor:"huggingface_hub.notebook_login.new_session",description:`<strong>new_session</strong> (<code>bool</code>, defaults to <code>True</code>) &#x2014;
If <code>True</code>, will request a token even if one is already saved on the machine.`,name:"new_session"},{anchor:"huggingface_hub.notebook_login.write_permission",description:`<strong>write_permission</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
If <code>True</code>, requires a token with write permission.`,name:"write_permission"}],source:"https://github.com/huggingface/huggingface_hub/blob/v0.19.0.rc0/src/huggingface_hub/_login.py#L197"}}),z=new te({props:{title:"logout",local:"huggingface_hub.logout",headingTag:"h2"}}),j=new de({props:{name:"huggingface_hub.logout",anchor:"huggingface_hub.logout",parameters:[],source:"https://github.com/huggingface/huggingface_hub/blob/v0.19.0.rc0/src/huggingface_hub/_login.py#L115"}}),{c(){o=g("meta"),T=i(),c=g("p"),y=i(),b(I.$$.fragment),ne=i(),M=g("p"),M.innerHTML=He,oe=i(),b(P.$$.fragment),ie=i(),u=g("div"),b(E.$$.fragment),fe=i(),S=g("p"),S.textContent=Ce,pe=i(),U=g("p"),U.innerHTML=Ie,me=i(),A=g("p"),A.innerHTML=Me,_e=i(),b(L.$$.fragment),be=i(),b(H.$$.fragment),ae=i(),b(q.$$.fragment),re=i(),f=g("div"),b(D.$$.fragment),$e=i(),N=g("p"),N.textContent=Pe,ve=i(),R=g("p"),R.innerHTML=Ee,we=i(),W=g("p"),W.innerHTML=qe,ge=i(),b(F.$$.fragment),se=i(),p=g("div"),b(V.$$.fragment),ke=i(),B=g("p"),B.textContent=De,xe=i(),G=g("p"),G.innerHTML=Fe,Te=i(),J=g("p"),J.innerHTML=Ve,le=i(),b(z.$$.fragment),ce=i(),m=g("div"),b(j.$$.fragment),ye=i(),K=g("p"),K.textContent=ze,Le=i(),Q=g("p"),Q.textContent=je,ue=i(),ee=g("p"),this.h()},l(e){const t=We("svelte-u9bgzb",document.head);o=s(t,"META",{name:!0,content:!0}),t.forEach(n),T=a(e),c=s(e,"P",{}),Y(c).forEach(n),y=a(e),$(I.$$.fragment,e),ne=a(e),M=s(e,"P",{"data-svelte-h":!0}),d(M)!=="svelte-1gw6v2x"&&(M.innerHTML=He),oe=a(e),$(P.$$.fragment,e),ie=a(e),u=s(e,"DIV",{class:!0});var h=Y(u);$(E.$$.fragment,h),fe=a(h),S=s(h,"P",{"data-svelte-h":!0}),d(S)!=="svelte-h0rxjs"&&(S.textContent=Ce),pe=a(h),U=s(h,"P",{"data-svelte-h":!0}),d(U)!=="svelte-1m8kult"&&(U.innerHTML=Ie),me=a(h),A=s(h,"P",{"data-svelte-h":!0}),d(A)!=="svelte-147higp"&&(A.innerHTML=Me),_e=a(h),$(L.$$.fragment,h),be=a(h),$(H.$$.fragment,h),h.forEach(n),ae=a(e),$(q.$$.fragment,e),re=a(e),f=s(e,"DIV",{class:!0});var _=Y(f);$(D.$$.fragment,_),$e=a(_),N=s(_,"P",{"data-svelte-h":!0}),d(N)!=="svelte-17ujnkh"&&(N.textContent=Pe),ve=a(_),R=s(_,"P",{"data-svelte-h":!0}),d(R)!=="svelte-bznvgk"&&(R.innerHTML=Ee),we=a(_),W=s(_,"P",{"data-svelte-h":!0}),d(W)!=="svelte-1ipextq"&&(W.innerHTML=qe),_.forEach(n),ge=a(e),$(F.$$.fragment,e),se=a(e),p=s(e,"DIV",{class:!0});var C=Y(p);$(V.$$.fragment,C),ke=a(C),B=s(C,"P",{"data-svelte-h":!0}),d(B)!=="svelte-sme73"&&(B.textContent=De),xe=a(C),G=s(C,"P",{"data-svelte-h":!0}),d(G)!=="svelte-nxcy77"&&(G.innerHTML=Fe),Te=a(C),J=s(C,"P",{"data-svelte-h":!0}),d(J)!=="svelte-1ipextq"&&(J.innerHTML=Ve),C.forEach(n),le=a(e),$(z.$$.fragment,e),ce=a(e),m=s(e,"DIV",{class:!0});var X=Y(m);$(j.$$.fragment,X),ye=a(X),K=s(X,"P",{"data-svelte-h":!0}),d(K)!=="svelte-1462z46"&&(K.textContent=ze),Le=a(X),Q=s(X,"P",{"data-svelte-h":!0}),d(Q)!=="svelte-1x6nsdy"&&(Q.textContent=je),X.forEach(n),ue=a(e),ee=s(e,"P",{}),Y(ee).forEach(n),this.h()},h(){Z(o,"name","hf:doc:metadata"),Z(o,"content",Ke),Z(u,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(f,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(p,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(m,"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,t){r(document.head,o),l(e,T,t),l(e,c,t),l(e,y,t),v(I,e,t),l(e,ne,t),l(e,M,t),l(e,oe,t),v(P,e,t),l(e,ie,t),l(e,u,t),v(E,u,null),r(u,fe),r(u,S),r(u,pe),r(u,U),r(u,me),r(u,A),r(u,_e),v(L,u,null),r(u,be),v(H,u,null),l(e,ae,t),v(q,e,t),l(e,re,t),l(e,f,t),v(D,f,null),r(f,$e),r(f,N),r(f,ve),r(f,R),r(f,we),r(f,W),l(e,ge,t),v(F,e,t),l(e,se,t),l(e,p,t),v(V,p,null),r(p,ke),r(p,B),r(p,xe),r(p,G),r(p,Te),r(p,J),l(e,le,t),v(z,e,t),l(e,ce,t),l(e,m,t),v(j,m,null),r(m,ye),r(m,K),r(m,Le),r(m,Q),l(e,ue,t),l(e,ee,t),he=!0},p(e,[t]){const h={};t&2&&(h.$$scope={dirty:t,ctx:e}),L.$set(h);const _={};t&2&&(_.$$scope={dirty:t,ctx:e}),H.$set(_)},i(e){he||(w(I.$$.fragment,e),w(P.$$.fragment,e),w(E.$$.fragment,e),w(L.$$.fragment,e),w(H.$$.fragment,e),w(q.$$.fragment,e),w(D.$$.fragment,e),w(F.$$.fragment,e),w(V.$$.fragment,e),w(z.$$.fragment,e),w(j.$$.fragment,e),he=!0)},o(e){k(I.$$.fragment,e),k(P.$$.fragment,e),k(E.$$.fragment,e),k(L.$$.fragment,e),k(H.$$.fragment,e),k(q.$$.fragment,e),k(D.$$.fragment,e),k(F.$$.fragment,e),k(V.$$.fragment,e),k(z.$$.fragment,e),k(j.$$.fragment,e),he=!1},d(e){e&&(n(T),n(c),n(y),n(ne),n(M),n(oe),n(ie),n(u),n(ae),n(re),n(f),n(ge),n(se),n(p),n(le),n(ce),n(m),n(ue),n(ee)),n(o),x(I,e),x(P,e),x(E),x(L),x(H),x(q,e),x(D),x(F,e),x(V),x(z,e),x(j)}}}const Ke='{"title":"Login and logout","local":"login-and-logout","sections":[{"title":"login","local":"huggingface_hub.login","sections":[],"depth":2},{"title":"interpreter_login","local":"huggingface_hub.interpreter_login","sections":[],"depth":2},{"title":"notebook_login","local":"huggingface_hub.notebook_login","sections":[],"depth":2},{"title":"logout","local":"huggingface_hub.logout","sections":[],"depth":2}],"depth":1}';function Qe(O){return Ae(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class nt extends Ne{constructor(o){super(),Re(this,o,Qe,Je,Ue,{})}}export{nt as component};
