
    9ij8                        S SK r S SKJr  S SKJrJrJrJrJr  S SK	J
r
  S\\\\\4         S\S   4S jr\ " S	 S
5      5       r\ " S S5      5       r\ " S S5      5       r\ " S S5      5       r\ " S S5      5       rg)    N)	dataclass)AnyDictListLiteralOptional)convert_timestampsiblings_datareturnRepoSiblingc                    U (       d  / $ U  Vs/ s GH\  n[        UR                  S5      =(       d    UR                  S5      UR                  S5      =(       d    UR                  S5      UR                  S5      =(       d    UR                  S5      UR                  S5      =(       d    UR                  S5      UR                  S	5      =(       d    UR                  S
5      [        UR                  S5      =(       d    UR                  S5      5      [        UR                  S5      =(       d    UR                  S5      UR                  S5      =(       d    UR                  S5      S9S9PGM_     sn$ s  snf )a  
Parse siblings data into RepoSibling objects.

Args:
    siblings_data: Raw siblings data from API response, supporting both
                  uppercase (Path, Size, etc.) and lowercase (path, size, etc.) field names.

Returns:
    List of RepoSibling objects.
PathpathSizesizeSha256sha256TypetypeRevisionrevisionCommittedDatecommittedDate)r   r   )	rfilenamer   blob_idr   shalast_modifiedlfs)r   getr	   BlobLfsInfo)r
   siblings     S/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/modelscope/hub/info.py_parse_siblingsr#      s    	 ' 'g 	kk&)@W[[-@V$;F(;KK)BW[[-BV$;F(;J'B7;;z+B+GKK,H,hGKKXgLhi[[(?GKK,?{{8,EH0E	
 '  s   E$E5c                       \ rS rSr% Sr\\   \S'   \\   \S'   \\   \S'   \\   \S'   \\   \S'   \\   \S'   \\   \S	'   \\   \S
'   \\	R                     \S'   \\	R                     \S'   S r
Srg)OrganizationInfo*   z*Organization information for a repository.idname	full_namedescriptionavatargithub_addressr   emailcreated_timemodified_timec                    UR                  SS 5      U l        UR                  SS5      U l        UR                  SS5      U l        UR                  SS5      U l        UR                  SS5      U l        UR                  SS5      U l        UR                  SUR                  S	S 5      5      U l        UR                  S
UR                  SS5      5      U l        UR                  SUR                  SS 5      5      nU(       a  [        U5      OS U l
        UR                  SUR                  SS 5      5      nU(       a  [        U5      U l        g S U l        g )NIdName FullNameDescriptionAvatarGithubAddressr   r   Emailr-   
GmtCreatedr.   GmtModifiedr/   )popr'   r(   r)   r*   r+   r,   r   r-   r	   r.   r/   )selfkwargsr.   r/   s       r"   __init__OrganizationInfo.__init__8   s   **T4(JJvr*	J3!::mR8jj2.$jj"=JJvvzz&$'?@	ZZGR)@A
zz,

>40PQ?K-l;QU

=&**_d2STAN.}=TX    )
r+   r.   r*   r-   r)   r,   r'   r/   r(   r   N)__name__
__module____qualname____firstlineno____doc__r   int__annotations__strdatetimer>   __static_attributes__ r@   r"   r%   r%   *   s}    4
3-}#SMSM!
3-C=8,,--H--..Yr@   r%   c                   >    \ rS rSr% Sr\\   \S'   Sr\\	   \S'   Sr
g)r    G   Nr   r   rK   )rA   rB   rC   rD   r   r   rF   rG   r   rH   rJ   rK   r@   r"   r    r    G   s    D(3- FHSM r@   r    c                       \ rS rSr% Sr\\S'   Sr\\	   \S'   Sr
\\   \S'   Sr\\   \S'   Sr\\   \S'   Sr\\R                     \S	'   Sr\\   \S
'   Srg)r   M   a  
Contains basic information about a repo file inside a repo on the Hub.

Attributes:
    rfilename (str): file name, relative to the repo root.
    size (`int`, *optional*): The file's size, in bytes.
    blob_id (`str`, *optional*): The file's git OID.
    lfs (`BlobLfsInfo`, *optional*): The file's LFS metadata.
    type (`str`, *optional*): The file's type.
    sha (`str`, *optional*): The file's latest commit SHA.
    last_modified (`datetime`, *optional*): The file's last modified time.
r   Nr   r   r   r   r   r   rK   )rA   rB   rC   rD   rE   rH   rG   r   r   rF   r   r   r   r   rI   r   r    rJ   rK   r@   r"   r   r   M   sj     ND(3-!GXc]!D(3-C#15M8H--.5!%C+	%r@   c                      \ rS rSr% Sr\\   \S'   \\   \S'   \\   \S'   \\   \S'   \\   \S'   \\   \S'   \\   \S	'   \\	   \S
'   \\   \S'   \\   \S'   \\   \S'   \\   \S'   \\
R                     \S'   \\
R                     \S'   \\\      \S'   \\\      \S'   \\\\\4         \S'   \\   \S'   \\   \S'   \\   \S'   \\   \S'   \\   \S'   \\   \S'   \\   \S'   \\\\4      \S'   \\\      \S'   \\\      \S'   \\   \S'   \\   \S'   \\\      \S '   \\\      \S!'   \\\\4      \S"'   \\   \S#'   \\
R                     \S$'   S% rS&rg')(	ModelInfoe   a  
Contains detailed information about a model on ModelScope Hub. This object is returned by [`model_info`].

Attributes:
    id (`int`, *optional*): Model ID.
    name (`str`, *optional*): Model name.
    author (`str`, *optional*): Model author.
    chinese_name (`str`, *optional*): Chinese display name.
    visibility (`int`, *optional*): Visibility level (1=private, 5=public).
    is_published (`int`, *optional*): Whether the model is published.
    is_online (`int`, *optional*): Whether the model is online.
    already_star (`bool`, *optional*): Whether current user has starred this model.
    description (`str`, *optional*): Model description.
    license (`str`, *optional*): Model license.
    downloads (`int`, *optional*): Number of downloads.
    likes (`int`, *optional*): Number of likes.
    created_at (`datetime`, *optional*): Date of creation of the repo on the Hub.
    last_updated_time (`datetime`, *optional*): Last update timestamp.
    architectures (`List[str]`, *optional*): Model architectures.
    model_type (`List[str]`, *optional*): Model types.
    tasks (`List[Dict[str, Any]]`, *optional*): Supported tasks.
    readme_content (`str`, *optional*): README content.
    organization (`OrganizationInfo`, *optional*): Organization information.
    created_by (`str`, *optional*): Creator username.
    is_certification (`int`, *optional*): Certification status.
    approval_mode (`int`, *optional*): Approval mode.
    card_ready (`int`, *optional*): Whether model card is ready.
    backend_support (`str`, *optional*): Backend support information.
    model_infos (`Dict[str, Any]`, *optional*): Detailed model configuration information.
    tags (`List[str]`, *optional*): Model Tags.
    is_accessible (`int`, *optional*): Whether accessible.
    revision (`str`, *optional*): Revision/branch.
    related_arxiv_id (`List[str]`, *optional*): Related arXiv paper IDs.
    related_paper (`List[int]`, *optional*): Related papers.
    sha (`str`, *optional*): Latest commit SHA.
    last_modified (`datetime`, *optional*): Latest commit date.
    last_commit (`Dict[str, Any]`, *optional*): Latest commit information.
    siblings (List[RepoSibling], optional): Basic information about files that constitute the model.
r'   r(   authorchinese_name
visibilityis_published	is_onlinealready_starr*   license	downloadslikes
created_atlast_updated_timearchitectures
model_typetasksreadme_contentorganization
created_byis_certificationapproval_mode
card_readybackend_supportmodel_infossiblingstagsis_accessibler   related_arxiv_idrelated_paperlast_commitr   r   c                    UR                  SS 5      U l        UR                  SS5      U l        UR                  SS5      U l        UR                  SS 5      U l        UR                  SS 5      U l        UR                  SS 5      U l        UR                  SS 5      U l        UR                  S	S5      U l        UR                  S
S5      U l	        UR                  SS 5      U l
        UR                  SS 5      =(       d    UR                  SS 5      U l        UR                  SS 5      nU(       a  [        U5      OS U l        UR                  SS 5      nU(       a  [        U5      OS U l        UR                  S/ 5      U l        UR                  S/ 5      U l        UR                  S/ 5      U l        UR                  SS5      U l        UR                  SS 5      nU(       a  ['        S*0 UD6OS U l        UR                  SS 5      U l        UR                  SS 5      U l        UR                  SS 5      U l        UR                  SS 5      U l        UR                  SS5      U l        UR                  S0 5      U l        UR                  S/ 5      U l        UR                  SS 5      U l        UR                  SS5      U l        UR                  S/ 5      U l        UR                  S / 5      U l        UR                  S!S 5      =(       d    UR                  S"S 5      nU(       a  [A        US!5      (       a  URB                  (       a  URB                  S#   n[A        US$5      (       a  URE                  5       OS U l#        U RF                  (       a  U RF                  RI                  S%5      OS U l%        U RF                  (       a$  [        U RF                  RI                  S&5      5      OS U l&        OS U l#        S U l%        S U l&        UR                  S'S5      U l'        UR                  S(S 5      =(       d    UR                  S)S 5      n[Q        U5      U l)        U RT                  RW                  U5        g )+Nr1   r2   r3   ChineseName
VisibilityIsPublishedIsOnlineAlreadyStarr5   License	DownloadsStarsLikesCreatedTimeLastUpdatedTimeArchitectures	ModelTypeTasksReadMeContentOrganization	CreatedByIsCertificationApprovalMode	CardReadyBackendSupportz{}
ModelInfosTagsIsAccessibler   RelatedArxivIdRelatedPapercommitsCommitsr   to_dictr'   committed_daterS   ri   SiblingsrK   ),r;   r'   r(   rT   rU   rV   rW   rX   r*   rY   rZ   r[   r	   r\   r]   r^   r_   r`   ra   r%   rb   rc   rd   re   rf   rg   rh   rj   rk   r   rl   rm   hasattrr   r   rn   r   r   r   rS   r#   ri   __dict__updater<   r=   r.   r]   org_datar   rn   ri   s           r"   r>   ModelInfo.__init__   s{   **T4(JJvr*	"JJ}b9 **\48"JJ}d;J5"JJ}d;!::mR8zz)R0K6ZZ.K&**Wd2K
zz-6=I+L9t"JJ'8$?IZ!23D!E`d#ZZ< **["5ZZ,
$jj"=::nd3<D,8x8$ **[$7 &

+<d C#ZZ= **[$7%zz*:DA!::lB7JJvr*	#ZZ=

:r2 &

+;R @#ZZ;**Y-LIt1Lww	22w!//!,K8?Y8W8W{224]aD595E5Et''++D14DH^b^n^n!243C3C3G3GHX3Y!ZtxD#DDH!%Djj2.::j$/O6::j$3O'1 	V$r@   )"rX   re   r^   rS   rg   rf   rT   r\   rc   r*   rZ   r'   rk   rd   rW   rV   rn   r   r]   rY   r[   rh   r_   r(   rb   ra   rl   rm   r   r   ri   rj   r`   rU   N)rA   rB   rC   rD   rE   r   rF   rG   rH   boolrI   r   r   r   r%   r   r>   rJ   rK   r@   r"   rQ   rQ   e   s   &P 	
3-SM3-3-}4. #c]}C=**++ 1 122DI&&c##Dc3h())SM!+,, sm#C=  c]"$sCx.))tK()) 49
 C=  sm tCy))DI&& $sCx.))	#H--..2%r@   rQ   c                      \ rS rSr% Sr\\   \S'   \\   \S'   \\   \S'   \\   \S'   \\	S      \S'   \\
   \S	'   \\   \S
'   \\   \S'   \\   \S'   \\   \S'   \\R                     \S'   \\R                     \S'   \\   \S'   \\   \S'   \\   \S'   \\\\\4         \S'   \\\\4      \S'   \\   \S'   \\R                     \S'   \\\      \S'   S rSrg)DatasetInfo   a  
Contains detailed information about a dataset on ModelScope Hub. This object is returned by [`dataset_info`].

Attributes:
    id (`int`, *optional*)): Dataset ID.
    name (`str`, *optional*)): Dataset name.
    author (`str`, *optional*): Dataset owner (user or organization).
    chinese_name (`str`, *optional*): Chinese display name.
    visibility (`int`, *optional*)): Visibility level (1=private, 3=interal, 5=public).
    'internal' means visible to logged-in users only.
    already_star (`bool`, *optional*)): Whether current user has starred this dataset.
    description (`str`, *optional*): Dataset description.
    license (`str`, *optional*)): Dataset license.
    downloads (`int`, *optional*)): Number of downloads.
    likes (`int`, *optional*)): Number of likes.
    created_at (`int`, *optional*): Creation timestamp.
    last_updated_time (`int`, *optional*): Last update timestamp.
    readme_content (`str`, *optional*): README content.
    organization (`OrganizationInfo`, *optional*): Organization information.
    created_by (`str`, *optional*): Creator username.
    tags (`List[Dict[str, Any]]`): Dataset tags.
    last_commit (`Dict[str, Any]`, *optional*): Latest commit information.
    sha (`str`, *optional*): Latest commit SHA.
    last_modified (`datetime`, *optional*): Latest commit date.
    siblings (`List[RepoSibling]`, *optional*): Basic information about files in the dataset.
r'   r(   rS   rT   )         rU   rX   r*   rY   rZ   r[   r\   r]   ra   rb   rc   rj   rn   r   r   ri   c                    UR                  SS 5      U l        UR                  SS5      U l        UR                  SUR                  SS 5      =(       d    UR                  SS 5      5      U l        UR                  SS5      U l        UR                  SS 5      U l        UR                  S	S 5      U l        UR                  S
S5      U l        UR                  SS 5      =(       d    UR                  SS 5      U l        UR                  SS5      U l	        UR                  SS 5      U l
        UR                  SS 5      nU(       a  [        U5      OS U l        UR                  SS 5      nU(       a  [        U5      OS U l        UR                  SS5      U l        UR                  SS 5      nU(       a  [        S0 UD6OS U l        UR                  SS 5      U l        UR                  S/ 5      U l        UR                  SS 5      =(       d    UR                  SS 5      nU(       a  ['        US5      (       a  UR(                  (       a  UR(                  S   n['        US5      (       a  UR+                  5       OS U l        U R,                  (       a  U R,                  R/                  S5      OS U l        U R,                  (       a$  [        U R,                  R/                  S5      5      OS U l        OS U l        S U l        S U l        UR                  SS 5      =(       d    UR                  SS 5      n[5        U5      U l        U R8                  R;                  U5        g )Nr1   r2   r3   rS   Owner	Namespacerp   rq   rt   r5   rx   rw   ru   rv   	GmtCreaterz   r~   r   r   r   r   r   r   r   r'   r   ri   r   rK   )r;   r'   r(   rS   rT   rU   rX   r*   r[   rY   rZ   r	   r\   r]   ra   r%   rb   rc   rj   r   r   r   rn   r   r   r   r#   ri   r   r   r   s           r"   r>   DatasetInfo.__init__'  s   **T4(JJvr*	jj6::gt+D+e

S^`dHef"JJ}b9 **\48"JJ}d;!::mR8ZZ.K&**Wd2K
zz)R0K6zz+t4=I+L9t"JJ'8$?IZ!23D!E`d$jj"=::nd3<D,8x8$ **[$7JJvr*	**Y-LIt1Lww	22w!//!,K8?Y8W8W{224]aD595E5Et''++D14DH^b^n^n!243C3C3G3GHX3Y!ZtxD#DDH!%D::j$/O6::j$3O'1 	V$r@   )rX   rS   rT   r\   rc   r*   rZ   r'   rn   r   r]   rY   r[   r(   rb   ra   r   ri   rj   rU   N)rA   rB   rC   rD   rE   r   rF   rG   rH   r   r   rI   r%   r   r   r   r   r>   rJ   rK   r@   r"   r   r      s   6 	
3-SM3-)**4. #c]}C=**++ 1 122SM!+,,
4S#X'
(($sCx.))	#H--..tK())$%r@   r   )rI   dataclassesr   typingr   r   r   r   r   modelscope.hub.utils.utilsr	   rH   r#   r%   r    r   rQ   r   rK   r@   r"   <module>r      s   
  ! 5 5 88Dc3h,@#A d=FY < Y Y Y8 ! ! !
 & & &. L% L% L%^ U% U% U%r@   