
    NgS                     @   d Z ddlmZ ddlZddlmZ d Zd Zd'dZ G d d	e          Z	 e	d
e
fi           Zee_        de_         edfdZedfdZedfdZedfdZefdZefdZ G d d          Zd Zd Z G d d          Z G d d          Z e            Z G d de          Z e            Z G d de          Z G d d e          Z G d! d"e          Z G d# d$e          Z eeee fD ]"Z!d%"                    e!j        &          e!_         #[!dS )(zDefines experimental extensions to the standard "typing" module that are
supported by the mypy typechecker.

Example usage:
    from mypy_extensions import TypedDict
    )AnyN_type_checkc                     	 t          j        d          j        d         dvrt          d          n# t          t
          f$ r Y nw xY wdS )N   __name__)abc	functoolstypingz4TypedDict does not support instance and class checksF)sys	_getframe	f_globals	TypeErrorAttributeError
ValueError)clsothers     K/var/www/html/ai-engine/env/lib/python3.11/site-packages/mypy_extensions.py_check_failsr      sf    =%j19WWWRSSS X J'   5s   03 AAc                     t          |i |S N)dict)r   argskwargss      r   	_dict_newr      s            c                 2   |                     dd          }||}n|rt          d          t          |          |d}	 t          j        d          j                            dd          |d<   n# t          t          f$ r Y nw xY wt          |d	|          S )
NtotalTz@TypedDict takes either a dict or keyword arguments, but not both)__annotations__	__total__r   r   __main__
__module__ )
popr   r   r   r   r   getr   r   _TypedDictMeta)r   	_typename_fieldsr   r   nss         r   _typeddict_newr*      s    JJw%%E	 ) ( ) ) 	) "']]	?	?B=++599*jQQ<J'    )R,,,s    0A1 1BBc                   (     e Zd Zd fd	ZexZZ xZS )r&   Tc                    |dk    rt           nt          |d<   t          t          |                               | |t
          f|          }|                    di           }dfd|                                D             }|D ]0}|                    |j	                            di                      1||_
        t          |d          s||_        |S )N	TypedDict__new__r   z?TypedDict('Name', {f0: t0, f1: t1, ...}); each t must be a typec                 8    i | ]\  }}|t          |          S r#   r   ).0ntpmsgs      r   
<dictcomp>z*_TypedDictMeta.__new__.<locals>.<dictcomp>=   s)    BBBEAr;r3''BBBr   r    )r*   r   superr&   r.   r   r%   itemsupdate__dict__r   hasattrr    )
r   namebasesr)   r   tp_dictannsbaser3   	__class__s
           @r   r.   z_TypedDictMeta.__new__1   s     +/+*=*=99,,44S$LLvv',,OBBBBTZZ\\BBB 	B 	BDKK))*;R@@AAAA"&w,, 	& %Gr   )T)r   r"   __qualname__r.   r   __instancecheck____subclasscheck____classcell__)r?   s   @r   r&   r&   0   sC             ( -98)))))r   r&   r-   a  A simple typed name space. At runtime it is equivalent to a plain dict.

    TypedDict creates a dictionary type that expects all of its
    instances to have a certain set of keys, with each key
    associated with a value of a consistent type. This expectation
    is not checked at runtime but is only enforced by typecheckers.
    Usage::

        Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})
        a: Point2D = {'x': 1, 'y': 2, 'label': 'good'}  # OK
        b: Point2D = {'z': 3, 'label': 'bad'}           # Fails type check
        assert Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first')

    The type info could be accessed via Point2D.__annotations__. TypedDict
    supports two additional equivalent forms::

        Point2D = TypedDict('Point2D', x=int, y=int, label=str)

        class Point2D(TypedDict):
            x: int
            y: int
            label: str

    The latter syntax is only supported in Python 3.6+, while two other
    syntax forms work for 3.2+
    c                     | S )zA normal positional argumentr#   typer:   s     r   ArgrG   k       Kr   c                     | S )z*A positional argument with a default valuer#   rE   s     r   
DefaultArgrJ   p   rH   r   c                     | S )zA keyword-only argumentr#   rE   s     r   NamedArgrL   u   rH   r   c                     | S )z,A keyword-only argument with a default valuer#   rE   s     r   DefaultNamedArgrN   z   rH   r   c                     | S )z*A *args-style variadic positional argumentr#   rF   s    r   VarArgrQ      rH   r   c                     | S )z*A **kwargs-style variadic keyword argumentr#   rP   s    r   KwArgrS      rH   r   c                       e Zd ZdS )NoReturnN)r   r"   r@   r#   r   r   rU   rU      s          r   rU   c                     | S r   r#   )r   s    r   traitrW      s    Jr   c                      d S )Nc                     | S r   r#   )xs    r   <lambda>zmypyc_attr.<locals>.<lambda>   s    Q r   r#   )attrskwattrss     r   
mypyc_attrr^      s
    ;r   c                       e Zd Zd Zd ZdS )_FlexibleAliasClsAppliedc                     || _         d S r   val)selfrc   s     r   __init__z!_FlexibleAliasClsApplied.__init__   s    r   c                     | j         S r   rb   rd   r   s     r   __getitem__z$_FlexibleAliasClsApplied.__getitem__   s	    xr   N)r   r"   r@   re   rh   r#   r   r   r`   r`      s2              r   r`   c                       e Zd Zd ZdS )_FlexibleAliasClsc                 ,    t          |d                   S )N)r`   rg   s     r   rh   z_FlexibleAliasCls.__getitem__   s    'R111r   N)r   r"   r@   rh   r#   r   r   rj   rj      s#        2 2 2 2 2r   rj   c                       e Zd Zd ZdS )_NativeIntMetac                 ,    t          |t                    S r   )
isinstanceint)r   insts     r   rA   z _NativeIntMeta.__instancecheck__   s    $$$$r   N)r   r"   r@   rA   r#   r   r   rn   rn      s#        % % % % %r   rn   c                       e Zd ZdefdZdS )i64r   c                 R    |t           urt          ||          S t          |          S r   	_sentinelrq   r   rZ   r>   s      r   r.   zi64.__new__   &    y  q$<<1vvr   Nr   r"   r@   rw   r.   r#   r   r   rt   rt      -        y      r   rt   )	metaclassc                       e Zd ZdefdZdS )i32r   c                 R    |t           urt          ||          S t          |          S r   rv   rx   s      r   r.   zi32.__new__   ry   r   Nrz   r#   r   r   r~   r~      r{   r   r~   c                       e Zd ZdefdZdS )i16r   c                 R    |t           urt          ||          S t          |          S r   rv   rx   s      r   r.   zi16.__new__   ry   r   Nrz   r#   r   r   r   r      r{   r   r   c                       e Zd ZdefdZdS )u8r   c                 R    |t           urt          ||          S t          |          S r   rv   rx   s      r   r.   z
u8.__new__   ry   r   Nrz   r#   r   r   r   r      r{   r   r   a/  A native fixed-width integer type when used with mypyc.

        In code not compiled with mypyc, behaves like the 'int' type in these
        runtime contexts:

        * {name}(x[, base=n]) converts a number or string to 'int'
        * isinstance(x, {name}) is the same as isinstance(x, int)
        )r:   r   )#__doc__r   r   r   r   r   r   r*   rF   r&   r   r-   r   r"   rG   rJ   rL   rN   rQ   rS   rU   rW   r^   r`   rj   FlexibleAliasrn   objectrw   rt   r~   r   r   	_int_typeformatr#   r   r   <module>r      s9          



        ! ! !- - - -$9 9 9 9 9T 9 9 90 N;44		  
 B t    
 d    
 D    
 4    
     
                        2 2 2 2 2 2 2 2
 "!##% % % % %T % % %
 FHH	    N        N        N        >     c3" 	, 	,I	 F	*F++  IIr   