
    XfX#                        d dl Z d dlZd dlZ	 d dlmZ n # e$ r 	 d dlmZ n# e$ r dZY nw xY wY nw xY w	 d dlmZ n# e$ r	 d dlmZ Y nw xY w	 d dlmZm	Z	 n$# e$ r 	 d dlmZm	Z	 n# e$ r dxZ	ZY nw xY wY nw xY we	eeZnd Z	  ej
        dd           d	 Zn# e$ r d
 ZY nw xY wd Zd Zd Zi eeeeeeeeeeej        eej        eej        eej        eej        eej        eej        eej        eej        eej        eej        eej         ee j!        j        ee j!        j        ee j!        j        ee j!        j        ee j!        j        ee j!        j        ee j!        j        eiZ"d Z#d Z$d Z%d Z&dS )    N)_AnnotatedAlias)get_type_hints)NotRequiredRequiredc                 $    t          | d          S )NT)include_extras)_get_type_hints)objs    B/var/www/piapp/venv/lib/python3.11/site-packages/msgspec/_utils.pyr   r   !   s    s48888    FooT)is_classc                 0    t          j        | dd          S )NFT)is_argumentr   typing
ForwardRefvalues    r   _forward_refr   2   s     EDIIIIr   c                 .    t          j        | d          S )NF)r   r   r   s    r   r   r   -   s     E::::r   c                     t          | dd           x}r#t          fd|D                       }| |         S t          | t          j                  r                    | |           S | S )N__parameters__c              3   D   K   | ]}                     ||          V  d S N)get).0pmappings     r   	<genexpr>z _apply_params.<locals>.<genexpr>8   s1      771W[[A&&777777r   )getattrtuple
isinstancer   TypeVarr   )r
   r   paramsargss    `  r   _apply_paramsr'   6   sv    .555v %7777777774y	C	(	( %{{3$$$Jr   c                 ~    i t          | t                    r| }n| j        }fd | i            |j        fS )Nc                    t          | t                    r| }i }nt          | dd           }|d t          t          j        fv s|	v rd S |j        }t          fd| j        D                       }t          |          t          |          k    sJ t          t          ||                    x	|<   }t          |t          j                  r't          |d|j                  }|D ]} ||           d S d S )N
__origin__c              3   8   K   | ]}t          |          V  d S r   )r'   )r   ascopes     r   r    zE_get_class_mro_and_typevar_mappings.<locals>.inner.<locals>.<genexpr>P   s-      EEQq%00EEEEEEr   __orig_bases__)r#   typer!   objectr   Genericr   r"   __args__lendictzip
issubclass	__bases__)
cr-   cls	new_scoper%   r&   basesbinnerr   s
    `      r   r=   z2_get_class_mro_and_typevar_mappings.<locals>.innerG   s   a 
	?CII!\400CtVV^444w'FEEEE!*EEEEEDv;;#d))++++'+C,=,='>'>>GCL9c6>** 	$C!13=AAE $ $a####	$ 	$$ $r   )r#   r/   r*   __mro__)r
   r9   r=   r   s     @@r   #_get_class_mro_and_typevar_mappingsr?   ?   se    G#t n$ $ $ $ $ $$ 
E#rNNN;r   c                 l   i }t          |           \  }}|D ]}|t          j        t          fv r|                    |          }t          t          |                    }t          t          j	                            |j
        d          di           }|j                            di           }|                                D ]m\  }	}
|	|v r
|
t          d          }
n$t          |
t                    rt!          |
          }
t          j        |
||          }
|t%          |
|          }
|
||	<   n|S )a  Get the annotations for a class.

    This is similar to ``typing.get_type_hints``, except:

    - We maintain it
    - It leaves extras like ``Annotated``/``ClassVar`` alone
    - It resolves any parametrized generics in the class mro. The returned
      mapping may still include ``TypeVar`` values, but those should be treated
      as their unparametrized variants (i.e. equal to ``Any`` for the common case).

    Note that this function doesn't check that Generic types are being used
    properly - invalid uses of `Generic` may slip through without complaint.

    The assumption here is that the user is making use of a static analysis
    tool like ``mypy``/``pyright`` already, which would catch misuse of these
    APIs.
    N__dict____annotations__)r?   r   r1   r0   r   r4   varsr!   sysmodules
__module__rA   itemsr/   r#   strr   
_eval_typer'   )r
   hintsmrotypevar_mappingsr9   r   
cls_localscls_globalsannnamer   s              r   get_class_annotationsrQ   ]   s8   $ E?DDC	    6>6***"&&s++$s))__
ckoocndCCZQSTTl0"5599;; 
	  
	 KD%u}}}T

E3'' ,$U++%eZEEE"%eW55E$KK
	  Lr   c                    t          | t                    r| }n| j        }t          |           }t	          |d          rt          |j                  }n%|j        rt          |          }nt                      }i }|                                D ]y\  }}t          |dd          }|t          u r&|                    |           |j        d         ||<   E|t          u r&|                    |           |j        d         ||<   t|||<   z||fS )N__required_keys__r*   Fr   )r#   r/   r*   rQ   hasattrsetrS   	__total__rG   r!   r   addr2   r   discard)r
   r9   	raw_hintsrequiredrJ   kvorigins           r   get_typeddict_infor^      s   #t n%c**Is'(( s,--	 y>>55 E!! 	 	1L%00XLLOOOz!}E!HH{""Qz!}E!HHE!HH(?r   c                 T   t          | t                    r| }n| j        }t          |           }g }g }g }t	          |d          rddlm}m}m} |j	        
                                D ]}	|	j        |ur|	j        |u rt          d          $|	j        }
||
         }|	j        |ur3|                    |	j                   |                    |
|df           o|	j        |ur3|                    |	j                   |                    |
|df           |                    |
|df           |                    |           d }t%          |dd           }n2ddlm}m} g }|j        D ]}	|	j        }
||
         }|	j        }||urt          ||          rI|j        rt1          d	          |                    |j                   |                    |
|df           nF|                    |           |                    |
|df           n|                    |
|df           |	j        |                    |	           |                    |           t%          |d
d           }t%          |dd           }|rt7          ||          }|t9          |          t9          |          ||fS )N__dataclass_fields__r   )_FIELD_FIELD_INITVARMISSINGz3dataclasses with `InitVar` fields are not supportedFT__post_init__)NOTHINGFactoryzvSupport for default factories with `takes_self=True` is not implemented. File a GitHub issue if you need this feature!__attrs_pre_init____attrs_post_init__)r#   r/   r*   rQ   rT   dataclassesra   rb   rc   r`   values_field_type	TypeErrorrP   defaultappenddefault_factoryextendr!   attrsre   rf   __attrs_attrs__
takes_selfNotImplementedErrorfactory	validator_wrap_attrs_validatorsr"   )r
   r9   rJ   rZ   optionaldefaultsra   rb   rc   fieldrP   typpre_init	post_initre   rf   fields_with_validatorsrm   s                     r   get_dataclass_infor      s   #t n!#&&EHHHs*++ ;R??????????-4466 	4 	4E ..$66#M   :D+C}G++...sE 23333&g55 5666sD 12222sE 23333!!!C$77		********!#( 	5 	5E:D+CmGg%%gw// 8) 1,  
 OOGO444OOT3$56666OOG,,,OOT3$67777sE 2333*&--e444!!!3 4d;;C!6==	! 	R./EyQQIhx(IEEr   c                       fd}|S )Nc           	          D ],}|                     | |t          | |j                             - |            d S d S r   )rv   r!   rP   )r
   rz   fieldsr}   s     r   r=   z%_wrap_attrs_validators.<locals>.inner  sX     	B 	BEOOCUZ(@(@AAAA IcNNNNN ! r    )r   r}   r=   s   `` r   rw   rw     s)          Lr   c                      | di |S )z1Used to unpickle Structs with keyword-only fieldsr   r   )r9   kwargss     r   rebuildr     s    3====r   )'collectionsrD   r   typing_extensionsr   	Exceptionr   r	   r   r   r   r   rl   r'   r?   rQ   listr"   rU   	frozensetr4   ListTupleSet	FrozenSetDict
CollectionMutableSequenceSequenceMutableMappingMapping
MutableSetAbstractSetabc_CONCRETE_TYPESr^   r   rw   r   r   r   r   <module>r      s       



 1111111   *******   9CCCCCCC 9 9 9888888889&777777777 & & &&000000000 & & &!%%;;;&& /$NN9 9 9
JFed++++J J J J  ; ; ;; ; ; ; ;;       <) ) )^$	5  y	
 	$ K L% J i K t D OT 4 ND  s!" #$ OO#TOdOOO"DOT1 8     FGF GF GFT      s{    2"2,2,22= A
AA A9A'&A9'	A30A92A33A98A9B B('B(