
    hJ                     .   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%jG                  e"j                  &      e"_         % ["d'e$d(ee$ef   d)efd*Z%d'e$d)efd+Z&y)-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      	 y# t        t
        f$ r Y yw xY w)N   __name__)abc	functoolstypingz4TypedDict does not support instance and class checksF)sys	_getframe	f_globals	TypeErrorAttributeError
ValueError)clsothers     M/var/www/html/eduruby.in/venv/lib/python3.12/site-packages/mypy_extensions.py_check_failsr      sW    ==%%j19WWRSS X
  J' s   /3 AAc                     t        |i |S N)dict)r   argskwargss      r   	_dict_newr      s           c                    |j                  dd      }||}n|rt        d      t        |      |d}	 t        j                  d      j
                  j                  dd      |d<   t        |d	|d
      S # t        t        f$ r Y  w xY w)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599*jQ< )R4HH J' s   2A5 5BBc                   (     e Zd Zd fd	ZexZZ xZS )r'   c           	         dt               v r dd l}|j                  dt        |rdnd       |dk(  rt        nt
        |d<   t        t        | #  | |t        f|      }|j                  di       }d	}	|j                         D 
ci c]  \  }
}|
t        ||	       }}
}|D ]-  }|j                  |j                  j                  di              / ||_        t!        |d
      s||_        |S c c}}
w )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 typer    )globalswarningswarnDeprecationWarningr+   r   superr'   r3   r   r&   itemsr   update__dict__r   hasattrr    )r   namebasesr*   r   r$   r5   tp_dictannsmsgntpbase	__class__s                r   r3   z_TypedDictMeta.__new__1   s     ')#MMS #!6AA   +/+*=994S$Lvv',O59ZZ\BEAr;r3''BB 	BDKK))*;R@A	B"&w, %G Cs   C,)TF)r   r"   __qualname__r3   r   __instancecheck____subclasscheck____classcell__)rE   s   @r   r'   r'   0   s    !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#   typer=   s     r   ArgrM   z       Kr   c                     | S )z*A positional argument with a default valuer#   rK   s     r   
DefaultArgrP      rN   r   c                     | S )zA keyword-only argumentr#   rK   s     r   NamedArgrR      rN   r   c                     | S )z,A keyword-only argument with a default valuer#   rK   s     r   DefaultNamedArgrT      rN   r   c                     | S )z*A *args-style variadic positional argumentr#   rL   s    r   VarArgrW      rN   r   c                     | S )z*A **kwargs-style variadic keyword argumentr#   rV   s    r   KwArgrY      rN   r   c                       e Zd Zy)_DEPRECATED_NoReturnN)r   r"   rF   r#   r   r   r[   r[      s    r   r[   c                     | S r   r#   )r   s    r   traitr]      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_attrrd      s    r   c                       e Zd Zd Zd Zy)_FlexibleAliasClsAppliedc                     || _         y r   val)selfri   s     r   __init__z!_FlexibleAliasClsApplied.__init__   s	    r   c                     | j                   S r   rh   rj   r   s     r   __getitem__z$_FlexibleAliasClsApplied.__getitem__   s    xxr   N)r   r"   rF   rk   rn   r#   r   r   rf   rf      s    r   rf   c                       e Zd Zd Zy)_FlexibleAliasClsc                     t        |d         S )N)rf   rm   s     r   rn   z_FlexibleAliasCls.__getitem__   s    'R11r   N)r   r"   rF   rn   r#   r   r   rp   rp      s    2r   rp   c                       e Zd Zd Zy)_NativeIntMetac                 "    t        |t              S r   )
isinstanceint)r   insts     r   rG   z _NativeIntMeta.__instancecheck__   s    $$$r   N)r   r"   rF   rG   r#   r   r   rt   rt      s    %r   rt   c                       e Zd ZdefdZy)i64r   c                 @    |t         urt        ||      S t        |      S r   	_sentinelrw   r   r`   rD   s      r   r3   zi64.__new__       y q$<1vr   Nr   r"   rF   r}   r3   r#   r   r   rz   rz          y r   rz   )	metaclassc                       e Zd ZdefdZy)i32r   c                 @    |t         urt        ||      S t        |      S r   r|   r~   s      r   r3   zi32.__new__   r   r   Nr   r#   r   r   r   r      r   r   r   c                       e Zd ZdefdZy)i16r   c                 @    |t         urt        ||      S t        |      S r   r|   r~   s      r   r3   zi16.__new__   r   r   Nr   r#   r   r   r   r      r   r   r   c                       e Zd ZdefdZy)u8r   c                 @    |t         urt        ||      S t        |      S r   r|   r~   s      r   r3   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)
        r=   r=   module_globalsreturnc                     |j                  d|        x}dt         d|  d}t        |      ||| <   | dv rd|  d|  d|  d	}nJ d
|  d       dd l}|j	                  |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	' insteadz-Add deprecation message for 'mypy_extensions.r   r/   r1   )r&   r   r   r5   r6   r7   )r=   r   ri   rA   r5   s        r   _warn_deprecationr      s    !!L"788A
"6tfA>S!!N4|v && 8iI 	 	NEdV1MMuMM#)aM8Jr   c                 ,    t        | t                     S )N)r   )r   r4   r   s    r   __getattr__r      s    T')<<r   r   )'__doc__r   r   r   r   r   r   r   r+   rL   r'   r   r.   r   r"   rM   rP   rR   rT   rW   rY   r[   r]   rd   rf   rp   FlexibleAliasrt   objectr}   rz   r   r   r   	_int_typeformatstrr   r   r#   r   r   <module>r      s    
 !I$$9T $9N ;4		  
 B t 
 d 
 D 
 4 
  
   !   2 2
 "#%T %
 H	N N N >  c3" 	,I	 F	**F+ 	, C c3h C $=c =c =r   