§
    [zniÔ  ã                   ó^  — d dl Z d dlmZ d dlmZmZ d dlmZmZm	Z	 d dl
mZ ddlmZ  G d„ d	e¦  «        Z G d
„ d¦  «        Zdeeeeef                           dee         defd„Z G d„ d¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        ZdS )é    N)ÚArgumentParser)ÚListÚUnion)ÚHfFolderÚcreate_repoÚwhoami)Ú	HTTPErroré   )ÚBaseTransformersCLICommandc                   ó*   — e Zd Zedefd„¦   «         ZdS )ÚUserCommandsÚparserc                 óv  — |                       dd¬¦  «        }|                     d„ ¬¦  «         |                       dd¬¦  «        }|                     d„ ¬¦  «         |                       d	d
¬¦  «        }|                     d„ ¬¦  «         |                       dd¬¦  «        }|                     d¬¦  «        }|                      dd¬¦  «        }|                     dt          d¬¦  «         |                     dt          d¬¦  «         |                     dddd¬¦  «         |                     d„ ¬¦  «         d S )NÚloginz6Log in using the same credentials as on huggingface.co)Úhelpc                 ó    — t          | ¦  «        S ©N)ÚLoginCommand©Úargss    úz/var/www/html/cool-property-finder/image-detection-backend/venv/lib/python3.11/site-packages/transformers/commands/user.pyú<lambda>z2UserCommands.register_subcommand.<locals>.<lambda>   s   € µLÀÑ4FÔ4F€ ó    )Úfuncr   z;Find out which huggingface.co account you are logged in as.c                 ó    — t          | ¦  «        S r   )ÚWhoamiCommandr   s    r   r   z2UserCommands.register_subcommand.<locals>.<lambda>   ó   € µ]À4Ñ5HÔ5H€ r   ÚlogoutzLog outc                 ó    — t          | ¦  «        S r   )ÚLogoutCommandr   s    r   r   z2UserCommands.register_subcommand.<locals>.<lambda>!   r   r   Úrepoz_Deprecated: use `huggingface-cli` instead. Commands to interact with your huggingface.co repos.zPDeprecated: use `huggingface-cli` instead. huggingface.co repos related commandsÚcreatezNDeprecated: use `huggingface-cli` instead. Create a new repo on huggingface.coÚnamezYName for your model's repo. Will be namespaced under your username to build the model id.)Útyper   z--organizationz!Optional: organization namespace.z-yz--yesÚ
store_truez"Optional: answer Yes to the prompt)Úactionr   c                 ó    — t          | ¦  «        S r   )ÚRepoCreateCommandr   s    r   r   z2UserCommands.register_subcommand.<locals>.<lambda>5   s   € Õ:KÈDÑ:QÔ:Q€ r   )Ú
add_parserÚset_defaultsÚadd_subparsersÚadd_argumentÚstr)r   Úlogin_parserÚwhoami_parserÚlogout_parserÚrepo_parserÚrepo_subparsersÚrepo_create_parsers          r   Úregister_subcommandz UserCommands.register_subcommand   s‡  € à×(Ò(¨Ð7oÐ(ÑpÔpˆØ×!Ò!Ð'FÐ'FÐ!ÑGÔGÐGØ×)Ò)¨(Ð9vÐ)ÑwÔwˆØ×"Ò"Ð(HÐ(HÐ"ÑIÔIÐIØ×)Ò)¨(¸Ð)ÑCÔCˆØ×"Ò"Ð(HÐ(HÐ"ÑIÔIÐIð ×'Ò'ØØrð (ñ 
ô 
ˆð &×4Ò4Øcð 5ñ 
ô 
ˆð -×7Ò7ØÐkð 8ñ 
ô 
Ðð 	×'Ò'ØÝØlð 	(ñ 	
ô 	
ð 	
ð
 	×'Ò'Ð(8½sÐIlÐ'ÑmÔmÐmØ×'Ò'¨¨g¸lÐQuÐ'ÑvÔvÐvØ×'Ò'Ð-QÐ-QÐ'ÑRÔRÐRÐRÐRr   N)Ú__name__Ú
__module__Ú__qualname__Ústaticmethodr   r4   © r   r   r   r      s@   € € € € € ØðS Nð Sð Sð Sñ „\ðSð Sð Sr   r   c                   ód   — e Zd ZdZdZdZdZdZed„ ¦   «         Z	ed„ ¦   «         Z
ed„ ¦   «         Zd	S )
ÚANSIz;
    Helper for en.wikipedia.org/wiki/ANSI_escape_code
    z[1mz[31mz[90mz[0mc                 ó&   — | j         › |› | j        › �S r   )Ú_boldÚ_reset©ÚclsÚss     r   Úboldz	ANSI.boldB   ó   € à”)Ð,˜QÐ, ¤
Ð,Ð,Ð,r   c                 ó4   — | j         › | j        › |› | j        › �S r   )r=   Ú_redr>   r?   s     r   ÚredzANSI.redF   s#   € à”)Ð6˜SœXÐ6 qÐ6¨#¬*Ð6Ð6Ð6r   c                 ó&   — | j         › |› | j        › �S r   )Ú_grayr>   r?   s     r   Úgrayz	ANSI.grayJ   rC   r   N)r5   r6   r7   Ú__doc__r=   rE   rH   r>   ÚclassmethodrB   rF   rI   r9   r   r   r;   r;   8   sƒ   € € € € € ðð ð €EØ€DØ€EØ€Fàð-ð -ñ „[ð-ð ð7ð 7ñ „[ð7ð ð-ð -ñ „[ð-ð -ð -r   r;   ÚrowsÚheadersÚreturnc                 ó`  — d„ t          g | ¢|‘R Ž D ¦   «         } dt          |¦  «        z  j        |Ž }g }|                      |j        |Ž ¦  «         |                      |j        d„ |D ¦   «         Ž ¦  «         | D ]}|                      |j        |Ž ¦  «         Œ d                     |¦  «        S )z‰
    Inspired by:

    - stackoverflow.com/a/8356620/593036
    - stackoverflow.com/questions/9535954/printing-lists-as-tabular-data
    c                 ó@   — g | ]}t          d „ |D ¦   «         ¦  «        ‘ŒS )c              3   óN   K  — | ] }t          t          |¦  «        ¦  «        V — Œ!d S r   )Úlenr-   )Ú.0Úxs     r   ú	<genexpr>z&tabulate.<locals>.<listcomp>.<genexpr>V   s.   è è € Ð/Ð/ a•c�#˜a™&œ&‘k”kÐ/Ð/Ð/Ð/Ð/Ð/r   )Úmax)rS   Úcols     r   ú
<listcomp>ztabulate.<locals>.<listcomp>V   s/   € ÐOÐOÐO°C•#Ð/Ð/¨3Ð/Ñ/Ô/Ñ/Ô/ÐOÐOÐOr   z{{:{}}} c                 ó   — g | ]}d |z  ‘ŒS )ú-r9   )rS   Úws     r   rX   ztabulate.<locals>.<listcomp>Z   s   € Ð$AÐ$AÐ$A° S¨1¡WÐ$AÐ$AÐ$Ar   ú
)ÚziprR   ÚformatÚappendÚjoin)rL   rM   Ú
col_widthsÚ
row_formatÚlinesÚrows         r   Útabulatere   O   sÔ   € ð PÐO½3Ð;NÀÐ;NÀgÐ;NÐ;NÐ;NÐOÑOÔO€JØ3�*�s 7™|œ|Ñ+Ô3°ZÐ@€JØ€EØ	‡L‚LÐ"�Ô" GÐ,Ñ-Ô-Ð-Ø	‡L‚LÐ"�Ô"Ð$AÐ$A°jÐ$AÑ$AÔ$AÐBÑCÔCÐCØð .ð .ˆØ�ŠÐ&�ZÔ&¨Ð,Ñ-Ô-Ð-Ð-Ø�9Š9�UÑÔÐr   c                   ó   — e Zd Zd„ ZdS )ÚBaseUserCommandc                 ó   — || _         d S r   r   )Úselfr   s     r   Ú__init__zBaseUserCommand.__init__a   s   € ØˆŒ	ˆ	ˆ	r   N)r5   r6   r7   rj   r9   r   r   rg   rg   `   s#   € € € € € ðð ð ð ð r   rg   c                   ó   — e Zd Zd„ ZdS )r   c                 óT   — t          t                               d¦  «        ¦  «         d S )Nz¬ERROR! `huggingface-cli login` uses an outdated login mechanism that is not compatible with the Hugging Face Hub backend anymore. Please use `huggingface-cli login instead.©Úprintr;   rF   ©ri   s    r   ÚrunzLoginCommand.runf   s4   € ÝÝ�HŠHð=ñô ñ	
ô 	
ð 	
ð 	
ð 	
r   N©r5   r6   r7   rp   r9   r   r   r   r   e   ó#   € € € € € ð
ð 
ð 
ð 
ð 
r   r   c                   ó   — e Zd Zd„ ZdS )r   c                 óH  — t          t                               d¦  «        ¦  «         t          j        ¦   «         }|€t          d¦  «         t          ¦   «          	 t          |¦  «        \  }}t          |¦  «         |r=t          t                               d¦  «        d                     |¦  «        ¦  «         d S d S # t          $ rZ}t          |¦  «         t          t                               |j
        j        ¦  «        ¦  «         t          d¦  «         Y d }~d S d }~ww xY w)NzxWARNING! `transformers-cli whoami` is deprecated and will be removed in v5. Please use `huggingface-cli whoami` instead.úNot logged inzorgs: ú,r
   )rn   r;   rF   r   Ú	get_tokenÚexitr   rB   r`   r	   ÚresponseÚtext)ri   ÚtokenÚuserÚorgsÚes        r   rp   zWhoamiCommand.runq   s  € ÝÝ�HŠHð4ñô ñ	
ô 	
ð 	
õ Ô"Ñ$Ô$ˆØˆ=Ý�/Ñ"Ô"Ð"Ý‰FŒFˆFð	Ý ™œ‰JˆD�$Ý�$‰KŒKˆKØð ;Ý•d—i’i Ñ)Ô)¨3¯8ª8°D©>¬>Ñ:Ô:Ð:Ð:Ð:ð;ð ;øåð 	ð 	ð 	Ý�!‰HŒHˆHÝ•$—(’(˜1œ:œ?Ñ+Ô+Ñ,Ô,Ð,Ý�‰GŒGˆGˆGˆGˆGˆGˆGˆGøøøøð	øøøs   ÁAB= Â=
D!ÃADÄD!Nrq   r9   r   r   r   r   p   s#   € € € € € ðð ð ð ð r   r   c                   ó   — e Zd Zd„ ZdS )r    c                 óT   — t          t                               d¦  «        ¦  «         d S )Nz°ERROR! `transformers-cli logout` uses an outdated logout mechanism that is not compatible with the Hugging Face Hub backend anymore. Please use `huggingface-cli logout instead.rm   ro   s    r   rp   zLogoutCommand.runˆ   s4   € ÝÝ�HŠHð>ñô ñ	
ô 	
ð 	
ð 	
ð 	
r   Nrq   r9   r   r   r    r    ‡   rr   r   r    c                   ó   — e Zd Zd„ ZdS )r(   c                 óˆ  — t          t                               d¦  «        ¦  «         t          j        ¦   «         }|€t          d¦  «         t          d¦  «         	 t          j        ddg¦  «                             d¦  «        }t          t           	                    | 
                    ¦   «         ¦  «        ¦  «         n# t          $ r t          d¦  «         Y nw xY w	 t          j        ddg¦  «                             d¦  «        }t          t           	                    | 
                    ¦   «         ¦  «        ¦  «         n7# t          $ r* t          t                               d	¦  «        ¦  «         Y nw xY wt          d
¦  «         t          |¦  «        \  }}| j        j        �| j        j        n|}|› d| j        j        › �}t          dt                               |¦  «        › �¦  «         | j        j        sPt%          d¦  «                             ¦   «         }|d
k    s)|dk    s#|dk    st          d¦  «         t          ¦   «          	 t)          || j        j        | j        j        ¬¦  «        }nf# t*          $ rY}	t          |	¦  «         t          t                               |	j        j        ¦  «        ¦  «         t          d¦  «         Y d }	~	nd }	~	ww xY wt          d¦  «         t          dt                               |¦  «        › �¦  «         t          d¦  «         t          d|› �¦  «         t          d
¦  «         d S )NzlWARNING! Managing repositories through transformers-cli is deprecated. Please use `huggingface-cli` instead.ru   r
   Úgitz	--versionzutf-8z9Looks like you do not have git installed, please install.zgit-lfsz«Looks like you do not have git-lfs installed, please install. You can install from https://git-lfs.github.com/. Then run `git lfs install` (you only have to do this once).Ú ú/zYou are about to create zProceed? [Y/n] ÚyÚyesÚAbort)r#   Úorganizationz
Your repo now lives at:z  zK
You can clone it locally with the command below, and commit/push as usual.z
  git clone )rn   r;   rF   r   rw   rx   Ú
subprocessÚcheck_outputÚdecoderI   ÚstripÚFileNotFoundErrorr   r   r‰   r#   rB   r‡   ÚinputÚlowerr   r	   ry   rz   )
ri   r{   Ústdoutr|   Ú_Ú	namespaceÚ	full_nameÚchoiceÚurlr~   s
             r   rp   zRepoCreateCommand.run“   s   € ÝÝ�HŠHð8ñô ñ	
ô 	
ð 	
õ Ô"Ñ$Ô$ˆØˆ=Ý�/Ñ"Ô"Ð"Ý�‰GŒGˆGð	OÝÔ,¨e°[Ð-AÑBÔB×IÒIÈ'ÑRÔRˆFÝ•$—)’)˜FŸLšL™NœNÑ+Ô+Ñ,Ô,Ð,Ð,øÝ ð 	Oð 	Oð 	OÝÐMÑNÔNÐNÐNÐNð	Oøøøð
	ÝÔ,¨i¸Ð-EÑFÔF×MÒMÈgÑVÔVˆFÝ•$—)’)˜FŸLšL™NœNÑ+Ô+Ñ,Ô,Ð,Ð,øÝ ð 	ð 	ð 	ÝÝ—’ðSñô ñô ð ð ð ð	øøøõ 	ˆb‰	Œ	ˆ	å˜‘-”-‰ˆˆaØ.2¬iÔ.DÐ.P�D”IÔ*Ð*ÐVZˆ	Ø Ð3Ð3 4¤9¤>Ð3Ð3ˆ	ÝÐ?­¯ª°9Ñ)=Ô)=Ð?Ð?Ñ@Ô@Ð@àŒyŒ}ð 	ÝÐ,Ñ-Ô-×3Ò3Ñ5Ô5ˆFØ˜b’L�L F¨c¢M M°V¸u²_°_Ý�g‘”�Ý‘”�ð	Ý˜e¨$¬)¬.ÀtÄyÔG]Ð^Ñ^Ô^ˆCˆCøÝð 	ð 	ð 	Ý�!‰HŒHˆHÝ•$—(’(˜1œ:œ?Ñ+Ô+Ñ,Ô,Ð,Ý�‰GŒGˆGˆGˆGˆGˆGˆGøøøøð	øøøõ 	Ð)Ñ*Ô*Ð*ÝÐ#•4—9’9˜S‘>”>Ð#Ð#Ñ$Ô$Ð$ÝÐ\Ñ]Ô]Ð]ÝÐ$˜sÐ$Ð$Ñ%Ô%Ð%Ýˆb‰	Œ	ˆ	ˆ	ˆ	s?   ÁA"B? Â?CÃCÃA"E Å1E6Å5E6É&I3 É3
KÉ=AKËKNrq   r9   r   r   r(   r(   ’   s#   € € € € € ð2ð 2ð 2ð 2ð 2r   r(   )rŠ   Úargparser   Útypingr   r   Úhuggingface_hub.hf_apir   r   r   Úrequests.exceptionsr	   r„   r   r   r;   r-   Úintre   rg   r   r   r    r(   r9   r   r   ú<module>rœ      só  ðð Ð Ð Ð Ø #Ð #Ð #Ð #Ð #Ð #Ø Ð Ð Ð Ð Ð Ð Ð à @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ø )Ð )Ð )Ð )Ð )Ð )à (Ð (Ð (Ð (Ð (Ð (ðSð Sð Sð Sð SÐ-ñ Sô Sð Sð>-ð -ð -ð -ð -ñ -ô -ð -ð.�4˜˜U 3¨ 8œ_Ô-Ô.ð ¸¸c¼ð Àsð ð ð ð ð"ð ð ð ð ñ ô ð ð

ð 
ð 
ð 
ð 
�?ñ 
ô 
ð 
ðð ð ð ð �Oñ ô ð ð.
ð 
ð 
ð 
ð 
�Oñ 
ô 
ð 
ð3ð 3ð 3ð 3ð 3˜ñ 3ô 3ð 3ð 3ð 3r   