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 r,j as Y,u as $,x as d,k as Z,y as a,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.18.0.rc0/en/package_reference/login#huggingface_hub.login">login()</a> is a drop-in replacement method for <a href="/docs/huggingface_hub/v0.18.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-if79kw"&&(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.18.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.18.0.rc0/en/package_reference/login#huggingface_hub.notebook_login">notebook_login()</a> or <a href="/docs/huggingface_hub/v0.18.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-1yo2hc8"&&(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.18.0.rc0/en/package_reference/login#huggingface_hub.login">login()</a>.`,_e,L,be,H,re,D,ae,f,F,$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.18.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.18.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,De='For more details, see <a href="/docs/huggingface_hub/v0.18.0.rc0/en/package_reference/login#huggingface_hub.login">login()</a>.',ge,q,se,p,V,ke,B,Fe="Displays a widget to login to the HF website and store the token.",xe,G,qe=`This is equivalent to <a href="/docs/huggingface_hub/v0.18.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.18.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.18.0.rc0/en/package_reference/login#huggingface_hub.login">login()</a>.',le,j,ce,m,z,ye,K,je="Logout the machine from the Hub.",Le,Q,ze="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.18.0.rc0/src/huggingface_hub/_login.py#L40",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}}}),D=new te({props:{title:"interpreter_login",local:"huggingface_hub.interpreter_login",headingTag:"h2"}}),F=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.18.0.rc0/src/huggingface_hub/_login.py#L126"}}),q=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.18.0.rc0/src/huggingface_hub/_login.py#L195"}}),j=new te({props:{title:"logout",local:"huggingface_hub.logout",headingTag:"h2"}}),z=new de({props:{name:"huggingface_hub.logout",anchor:"huggingface_hub.logout",parameters:[],source:"https://github.com/huggingface/huggingface_hub/blob/v0.18.0.rc0/src/huggingface_hub/_login.py#L107"}}),{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),re=i(),b(D.$$.fragment),ae=i(),f=g("div"),b(F.$$.fragment),$e=i(),N=g("p"),N.textContent=Pe,ve=i(),R=g("p"),R.innerHTML=Ee,we=i(),W=g("p"),W.innerHTML=De,ge=i(),b(q.$$.fragment),se=i(),p=g("div"),b(V.$$.fragment),ke=i(),B=g("p"),B.textContent=Fe,xe=i(),G=g("p"),G.innerHTML=qe,Te=i(),J=g("p"),J.innerHTML=Ve,le=i(),b(j.$$.fragment),ce=i(),m=g("div"),b(z.$$.fragment),ye=i(),K=g("p"),K.textContent=je,Le=i(),Q=g("p"),Q.textContent=ze,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=r(e),c=s(e,"P",{}),Y(c).forEach(n),y=r(e),$(I.$$.fragment,e),ne=r(e),M=s(e,"P",{"data-svelte-h":!0}),d(M)!=="svelte-1gw6v2x"&&(M.innerHTML=He),oe=r(e),$(P.$$.fragment,e),ie=r(e),u=s(e,"DIV",{class:!0});var h=Y(u);$(E.$$.fragment,h),fe=r(h),S=s(h,"P",{"data-svelte-h":!0}),d(S)!=="svelte-h0rxjs"&&(S.textContent=Ce),pe=r(h),U=s(h,"P",{"data-svelte-h":!0}),d(U)!=="svelte-1m8kult"&&(U.innerHTML=Ie),me=r(h),A=s(h,"P",{"data-svelte-h":!0}),d(A)!=="svelte-cj6c9u"&&(A.innerHTML=Me),_e=r(h),$(L.$$.fragment,h),be=r(h),$(H.$$.fragment,h),h.forEach(n),re=r(e),$(D.$$.fragment,e),ae=r(e),f=s(e,"DIV",{class:!0});var _=Y(f);$(F.$$.fragment,_),$e=r(_),N=s(_,"P",{"data-svelte-h":!0}),d(N)!=="svelte-17ujnkh"&&(N.textContent=Pe),ve=r(_),R=s(_,"P",{"data-svelte-h":!0}),d(R)!=="svelte-18007rc"&&(R.innerHTML=Ee),we=r(_),W=s(_,"P",{"data-svelte-h":!0}),d(W)!=="svelte-2rai67"&&(W.innerHTML=De),_.forEach(n),ge=r(e),$(q.$$.fragment,e),se=r(e),p=s(e,"DIV",{class:!0});var C=Y(p);$(V.$$.fragment,C),ke=r(C),B=s(C,"P",{"data-svelte-h":!0}),d(B)!=="svelte-sme73"&&(B.textContent=Fe),xe=r(C),G=s(C,"P",{"data-svelte-h":!0}),d(G)!=="svelte-1gs18dr"&&(G.innerHTML=qe),Te=r(C),J=s(C,"P",{"data-svelte-h":!0}),d(J)!=="svelte-2rai67"&&(J.innerHTML=Ve),C.forEach(n),le=r(e),$(j.$$.fragment,e),ce=r(e),m=s(e,"DIV",{class:!0});var X=Y(m);$(z.$$.fragment,X),ye=r(X),K=s(X,"P",{"data-svelte-h":!0}),d(K)!=="svelte-1462z46"&&(K.textContent=je),Le=r(X),Q=s(X,"P",{"data-svelte-h":!0}),d(Q)!=="svelte-1x6nsdy"&&(Q.textContent=ze),X.forEach(n),ue=r(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){a(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),a(u,fe),a(u,S),a(u,pe),a(u,U),a(u,me),a(u,A),a(u,_e),v(L,u,null),a(u,be),v(H,u,null),l(e,re,t),v(D,e,t),l(e,ae,t),l(e,f,t),v(F,f,null),a(f,$e),a(f,N),a(f,ve),a(f,R),a(f,we),a(f,W),l(e,ge,t),v(q,e,t),l(e,se,t),l(e,p,t),v(V,p,null),a(p,ke),a(p,B),a(p,xe),a(p,G),a(p,Te),a(p,J),l(e,le,t),v(j,e,t),l(e,ce,t),l(e,m,t),v(z,m,null),a(m,ye),a(m,K),a(m,Le),a(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(D.$$.fragment,e),w(F.$$.fragment,e),w(q.$$.fragment,e),w(V.$$.fragment,e),w(j.$$.fragment,e),w(z.$$.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(D.$$.fragment,e),k(F.$$.fragment,e),k(q.$$.fragment,e),k(V.$$.fragment,e),k(j.$$.fragment,e),k(z.$$.fragment,e),he=!1},d(e){e&&(n(T),n(c),n(y),n(ne),n(M),n(oe),n(ie),n(u),n(re),n(ae),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(D,e),x(F),x(q,e),x(V),x(j,e),x(z)}}}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};
