o
    xi                     @  s|   d dl mZ d dlmZmZmZmZmZ d dlm	Z	 d dl
mZ d dlmZ ddlmZ er4d dlmZ G d	d
 d
eZdS )    )annotations)TYPE_CHECKINGAnyListOptionalTuple)Field)Self)field_validator   )ArtifactsBase)ArtifactCollectionFragmentc                   @  s(  e Zd ZU dZeddddZded< 	 edddZded	< 	 ed
dZded< 	 ded< 	 dZ	ded< 	 eddZ
ded< 	 dZded< 	 eddZded< 	 eddZded< 	 edddZded< 	 eedZded< 	 edddd.d d!Zedddd/d$d%Zed0d'd(Zed1d,d-ZdS )2ArtifactCollectionDataa  Transport-free model for local `ArtifactCollection` data.

    For now, this is separated from the public `ArtifactCollection` model
    to more easily ensure continuity in the public `ArtifactCollection` API.

    Note:
        In a future change, consider making this the public `ArtifactCollection` class:
        - Replace the existing `ArtifactCollection` class with this one.
        - Rename this class to `ArtifactCollection`.
        Note that this would be a breaking change.
    
__typenameTF)aliasfrozenreprstr
typename__)r   r   idr   )
min_lengthnametypeNzOptional[str]description)r   
created_at
updated_atprojectentity)defaultr   zOptional[Tuple[str, ...]]aliases)default_factoryz	List[str]tagsplain)modevreturnc                 C     ddl m} ||S )Nr   )validate_artifact_name)wandb.sdk.artifacts._validatorsr'   )clsr$   r'    r*   c/home/ubuntu/.local/lib/python3.10/site-packages/wandb/sdk/artifacts/_models/artifact_collection.py_validate_nameK   s   z%ArtifactCollectionData._validate_namer   	list[str]c                 C  r&   )z<Ensure tags is a validated, deduped list of (str) tag names.r   )validate_tags)r(   r.   )r)   r$   r.   r*   r*   r+   _validate_tagsQ   s   z%ArtifactCollectionData._validate_tagsboolc                 C  s&   ddl m} ddlm} | j||kS )zLReturn True if this collection is an `ArtifactSequence` (source collection).r   )gql_typename)ArtifactSequenceTypeFields)wandb._pydanticr1   wandb.sdk.artifacts._generatedr2   r   )selfr1   r2   r*   r*   r+   is_sequenceX   s   z"ArtifactCollectionData.is_sequenceobjr   r	   c                 C  sd   |j du rtdt|d| |j|j|j|jj|j|j|j|j j|j j	jdd |j
jD ddS )z.Instantiate this type from a GraphQL fragment.NzMissing project info in z datac                 S  s   g | ]	}|j r|j jqS r*   )noder   ).0er*   r*   r+   
<listcomp>p   s    z8ArtifactCollectionData.from_fragment.<locals>.<listcomp>)r   r   r   r   r   r   r   r   r   r!   r   )r   
ValueErrorr   r   r   r   r   r   r   r   r!   edges)r)   r7   r*   r*   r+   from_fragment`   s   
z$ArtifactCollectionData.from_fragment)r$   r   r%   r   )r$   r   r%   r-   )r%   r0   )r7   r   r%   r	   )__name__
__module____qualname____doc__r   r   __annotations__r   r   r   r   r   r   r   r   listr!   r
   r,   r/   propertyr6   classmethodr>   r*   r*   r*   r+   r      s@   
 

r   N)
__future__r   typingr   r   r   r   r   pydanticr   typing_extensionsr	   r3   r
   
base_modelr   r4   r   r   r*   r*   r*   r+   <module>   s    