
    	`i                        d dl mZ d dlmZ ddlmZmZmZ ddlm	Z
mZmZmZmZmZmZ ddlmZ dZd Z G d	 d
e          ZddZdS )    )annotations)Any   )	NODEFAULTStructfield)FactoryStructConfig
StructMetaasdictastupleforce_setattrreplace)get_class_annotations)	FieldInfor
   r   r   fieldsr   r   c                     t           S N)__all__     c/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/msgspec/structs.py__dir__r      s    Nr   c                      e Zd ZU dZded<   ded<   ded<    ed           Zded	<    ed
           Zded<   edd            Z	dS )r   a  A record describing a field in a struct type.

    Parameters
    ----------
    name: str
        The field name as seen by Python code (e.g. ``field_one``).
    encode_name: str
        The name used when encoding/decoding the field. This may differ if
        the field is renamed (e.g. ``fieldOne``).
    type: Any
        The full field type annotation.
    default: Any, optional
        A default value for the field. Will be `NODEFAULT` if no default value
        is set.
    default_factory: Any, optional
        A callable that creates a default value for the field. Will be
        `NODEFAULT` if no ``default_factory`` is set.
    strnameencode_namer   typec                     t           S r   r   r   r   r   <lambda>zFieldInfo.<lambda>7   s     r   )default_factorydefaultc                     t           S r   r    r   r   r   r!   zFieldInfo.<lambda>8   s     r   r"   returnboolc                :    | j         t          u o| j        t          u S )z1A helper for checking whether a field is required)r#   r   r"   )selfs    r   requiredzFieldInfo.required:   s     |y(NT-AY-NNr   N)r%   r&   )
__name__
__module____qualname____doc____annotations__r   r#   r"   propertyr)   r   r   r   r   r       s          & IIIIII5):):;;;G;;;; 51B1BCCCOCCCCO O O XO O Or   r   type_or_instanceStruct | type[Struct]r%   tuple[FieldInfo]c                   | }t          |t                    r|x}}nkt          t          |          t                    rt          |          x}}n7|}t          |d|          }t          |t                    st	          d          t          |          }t          |j                  t          |j                  z
  }g }t          |j        |j
        t          f|z  |j        z             D ]f\  }}}	t          x}
}t          |	t                    r|	j        }n|	t          ur|	}
t          ||||         |
|          }|                    |           gt!          |          S )zGet information about the fields in a Struct.

    Parameters
    ----------
    type_or_instance:
        A struct type or instance.

    Returns
    -------
    tuple[FieldInfo]
    
__origin__z-Must be called with a struct type or instance)r   r   r   r#   r"   )
isinstancer   r   getattr	TypeError_get_class_annotationslen__struct_fields____struct_defaults__zip__struct_encode_fields__r   _Factoryfactoryr   appendtuple)r0   objannotated_clsclshintsnposr   r   r   default_objr#   r"   r   s                r   r   r   @   s    C #z"" 
M!!	DIIz	*	* M"3ii' c<--#z** 	MKLLL"=11Es$%%C,C(D(DDDF*-$	tc55+ +  &k;
 %.-/k8,, 	")1OO	))!G#t+
 
 
 	e==r   N)r0   r1   r%   r2   )
__future__r   typingr    r   r   r   _corer	   r>   r
   r   r   r   r   r   _utilsr   r8   r   r   r   r   r   r   r   <module>rM      s   " " " " " "       & & & & & & & & & &                  D C C C C C  O O O O O O O O@2 2 2 2 2 2r   