
    W-PhJ                     x   d Z ddlmZ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'e$d(ee$ef         d)efd*Z%d'e$d)efd+Z&dS )-zDefines experimental extensions to the standard "typing" module that are
supported by the mypy typechecker.

Example usage:
    from mypy_extensions import TypedDict
    )AnyDictN_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     O/var/www/html/test/jupyter/venv/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                 6   |                     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	|d
          S )NtotalTz@TypedDict takes either a dict or keyword arguments, but not both)__annotations__	__total__r   r	   __main__
__module__ )_from_functional_call)
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4HHHHs    0A1 1BBc                   (     e Zd Zd fd	ZexZZ xZS )r(   TFc                   
 dt                      v r%dd l}|                    dt          |rdnd           |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	TypedDictr   zmypy_extensions.TypedDict is deprecated, and will be removed in a future version. Use typing.TypedDict or typing_extensions.TypedDict instead.      
stacklevel__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>L   s)    BBBEAr;r3''BBBr   r!   )globalswarningswarnDeprecationWarningr,   r   superr(   r4   r   r'   itemsupdate__dict__r    hasattrr!   )r   namebasesr+   r   r%   r<   tp_dictannsbaser9   	__class__s             @r   r4   z_TypedDictMeta.__new__1   s(    '))##OOOMMS #!6=AAA     +/+*=*=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   )TF)r	   r#   __qualname__r4   r   __instancecheck____subclasscheck____classcell__)rI   s   @r   r(   r(   0   sD        ! ! ! ! ! !F -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$   typerD   s     r   ArgrQ   z       Kr   c                     | S )z*A positional argument with a default valuer$   rO   s     r   
DefaultArgrT      rR   r   c                     | S )zA keyword-only argumentr$   rO   s     r   NamedArgrV      rR   r   c                     | S )z,A keyword-only argument with a default valuer$   rO   s     r   DefaultNamedArgrX      rR   r   c                     | S )z*A *args-style variadic positional argumentr$   rP   s    r   VarArgr[      rR   r   c                     | S )z*A **kwargs-style variadic keyword argumentr$   rZ   s    r   KwArgr]      rR   r   c                       e Zd ZdS )_DEPRECATED_NoReturnN)r	   r#   rJ   r$   r   r   r_   r_      s          r   r_   c                     | S r   r$   )r   s    r   traitra      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_attrrh      s
    ;r   c                       e Zd Zd Zd ZdS )_FlexibleAliasClsAppliedc                     || _         d S r   val)selfrm   s     r   __init__z!_FlexibleAliasClsApplied.__init__   s    r   c                     | j         S r   rl   rn   r   s     r   __getitem__z$_FlexibleAliasClsApplied.__getitem__   s	    xr   N)r	   r#   rJ   ro   rr   r$   r   r   rj   rj      s2              r   rj   c                       e Zd Zd ZdS )_FlexibleAliasClsc                 ,    t          |d                   S )N)rj   rq   s     r   rr   z_FlexibleAliasCls.__getitem__   s    'R111r   N)r	   r#   rJ   rr   r$   r   r   rt   rt      s#        2 2 2 2 2r   rt   c                       e Zd Zd ZdS )_NativeIntMetac                 ,    t          |t                    S r   )
isinstanceint)r   insts     r   rK   z _NativeIntMeta.__instancecheck__   s    $$$$r   N)r	   r#   rJ   rK   r$   r   r   rx   rx      s#        % % % % %r   rx   c                       e Zd ZdefdZdS )i64r   c                 R    |t           urt          ||          S t          |          S r   	_sentinelr{   r   rd   rH   s      r   r4   zi64.__new__   &    y  q$<<1vvr   Nr	   r#   rJ   r   r4   r$   r   r   r~   r~      -        y      r   r~   )	metaclassc                       e Zd ZdefdZdS )i32r   c                 R    |t           urt          ||          S t          |          S r   r   r   s      r   r4   zi32.__new__   r   r   Nr   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   r   r   s      r   r4   zi16.__new__   r   r   Nr   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   r   r   s      r   r4   z
u8.__new__   r   r   Nr   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)
        rD   rD   module_globalsreturnc                     |                     d|            x}dt           d|  d}t          |          ||| <   | dv rd|  d|  d|  d	}nJ d|  d            dd l}|                    |t
          d           |S )N_DEPRECATED_zmodule 'z' has no attribute ''>   NoReturnz'mypy_extensions.zF' is deprecated, and will be removed in a future version. Use 'typing.z' or 'typing_extensions.z	' insteadFz-Add deprecation message for 'mypy_extensions.r   r0   r2   )r'   r	   r   r<   r=   r>   )rD   r   rm   r9   r<   s        r   _warn_deprecationr      s    !!"7"7"7888A>>>t>>>S!!!N4|I I II I9=I I I 	 	NMdMMMMMMOOOMM#)aM888Jr   c                 <    t          | t                                S )N)r   )r   r;   r   s    r   __getattr__r      s    T'))<<<<r   r   )'__doc__r   r   r   r   r   r   r   r,   rP   r(   r   r/   r	   r#   rQ   rT   rV   rX   r[   r]   r_   ra   rh   rj   rt   FlexibleAliasrx   objectr   r~   r   r   r   	_int_typeformatstrr   r   r$   r   r   <module>r      s            



        ! ! !I I I I$$9 $9 $9 $9 $9T $9 $9 $9N 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++  C c3h C    $=c =c = = = = = =r   