
    Zi                     \    d dl mZmZmZmZ d dlmZ d dlZerd dlm	Z	  G d d          Z
dS )    )TYPE_CHECKINGOptionalDictAny)UUIDN)	ServerAPIc                      e Zd ZdZdddededededed	eeeef                  d
edefdZ	e
defd            Ze
defd            Ze
defd            Ze
defd            Ze
defd            Ze
deeeef                  fd            Zed	ee         deeef         fd            ZdefdZdedefdZdefdZdS )AttachedFunctionz/Represents a function attached to a collection.clientr   idnamefunction_nameinput_collection_idoutput_collectionparamstenantdatabasec
                     || _         || _        || _        || _        || _        || _        || _        || _        |	| _        dS )a  Initialize an AttachedFunction.

        Args:
            client: The API client
            id: Unique identifier for this attached function
            name: Name of this attached function instance
            function_name: The function name (e.g., "record_counter", "statistics")
            input_collection_id: ID of the input collection
            output_collection: Name of the output collection
            params: Function-specific parameters
            tenant: The tenant name
            database: The database name
        N)	_client_id_name_function_name_input_collection_id_output_collection_params_tenant	_database)
selfr   r   r   r   r   r   r   r   r   s
             a/root/projects/butler/venv/lib64/python3.11/site-packages/chromadb/api/models/AttachedFunction.py__init__zAttachedFunction.__init__   sJ    2 
+$7!"3!    returnc                     | j         S )z0The unique identifier of this attached function.)r   r   s    r   r   zAttachedFunction.id/   s     xr!   c                     | j         S )z,The name of this attached function instance.)r   r$   s    r   r   zAttachedFunction.name4   s     zr!   c                     | j         S )zThe function name.)r   r$   s    r   r   zAttachedFunction.function_name9   s     ""r!   c                     | j         S )zThe ID of the input collection.)r   r$   s    r   r   z$AttachedFunction.input_collection_id>   s     ((r!   c                     | j         S )z"The name of the output collection.)r   r$   s    r   r   z"AttachedFunction.output_collectionC   s     &&r!   c                     | j         S )zThe function parameters.)r   r$   s    r   r   zAttachedFunction.paramsH   s     |r!   c                     | i S t          | t                    rI	 | rt          j        |           ni }t          |t                    r|ni S # t          j        $ r i cY S w xY wt          | t                    r| S i S )zuNormalize params to a consistent dict format.

        Handles None, empty strings, JSON strings, and dicts.
        )
isinstancestrjsonloadsdictJSONDecodeError)r   results     r   _normalize_paramsz"AttachedFunction._normalize_paramsM   s     >Ifc"" 	/5=F+++2!+FD!9!9AvvrA'   			fd## 	M	s   0A A A c                 X    d| j          d| j         d| j         d| j         d| j         dS )NzAttachedFunction(id=z, name='z', function_name='z', input_collection_id=z, output_collection='z'))r   r   r   r   r   r$   s    r   __repr__zAttachedFunction.__repr___   s_    >48 > >TZ > >"1> >#'#<> > #'"9> > >	
r!   otherc                    t          |t                    sdS |                     | j                  }|                     |j                  }| j        |j        k    oe| j        |j        k    oU| j        |j        k    oE| j        |j        k    o5| j        |j        k    o%||k    o| j	        |j	        k    o| j
        |j
        k    S )z2Compare two AttachedFunction objects for equality.F)r+   r
   r2   r   r   r   r   r   r   r   r   )r   r5   self_paramsother_paramss       r   __eq__zAttachedFunction.__eq__g   s    %!122 	5 ,,T\::--em<< H	! 2
ek)2#u';;2 )U-GG2 '5+CC	2
 |+2 -2 %/1		
r!   c           
         |                      | j                  }|r.t          t          |                                                    nd}t          | j        | j        | j        | j	        | j
        || j        | j        f          S )z$Return hash of the AttachedFunction. )r2   r   tuplesorteditemshashr   r   r   r   r   r   r   )r   normalized_paramsparams_tuples      r   __hash__zAttachedFunction.__hash__{   s     !224<@@8IQE&*002233444r 	 
#)'	
 
 	
r!   N)__name__
__module____qualname____doc__r   r,   r   r   r   r    propertyr   r   r   r   r   r   staticmethodr2   r4   objectboolr9   intrB   r;   r!   r   r
   r
   	   s       99!"!" !" 	!"
 !" "!" !" c3h(!" !" !" !" !" !"F D    X c    X #s # # # X# )T ) ) ) X) '3 ' ' ' X' c3h0    X (3- DcN    \"
# 
 
 
 

F 
t 
 
 
 
(
# 
 
 
 
 
 
r!   r
   )typingr   r   r   r   uuidr   r-   chromadb.apir   r
   r;   r!   r   <module>rO      s    5 5 5 5 5 5 5 5 5 5 5 5        '&&&&&&E
 E
 E
 E
 E
 E
 E
 E
 E
 E
r!   