o
    ]iJ                     @   s  d Z ddlmZmZ ddlZddlmZ dd Zdd Zd9d	d
ZG dd de	Z
e
defi Zee_de_ edfddZedfddZedfddZedfddZefddZefddZG dd dZdd Zdd  ZG d!d" d"ZG d#d$ d$Ze ZG d%d& d&e	Ze ZG d'd( d(ed)ZG d*d+ d+ed)ZG d,d- d-ed)Z G d.d/ d/ed)Z!eee e!fD ]
Z"d0j#e"jd1e"_ q["d2e$d3ee$ef d4efd5d6Z%d2e$d4efd7d8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              	   C   s<   zt djd dvrtdW dS  ttfy   Y dS w )N   __name__)abc	functoolstypingz4TypedDict does not support instance and class checksF)sys	_getframe	f_globals	TypeErrorAttributeError
ValueError)clsother r   T/var/www/html/stock_analysis/be/venv/lib/python3.10/site-packages/mypy_extensions.py_check_fails   s   r   c                 O   s   t |i |S N)dict)r   argskwargsr   r   r   	_dict_new      r   c              	   K   sx   | dd}|d u r|}n|rtdt||d}ztdjdd|d< W n ttfy3   Y nw t	|d	|dd
S )NtotalTz@TypedDict takes either a dict or keyword arguments, but not both)__annotations__	__total__r   r   __main__
__module__r   )_from_functional_call)
popr   r   r   r   r   getr   r   _TypedDictMeta)r   	_typename_fieldsr   r   nsr   r   r   _typeddict_new   s   r(   c                       s&   e Zd Zd fdd	Ze ZZ  ZS )r$   TFc           
         s   dt  v rdd l}|jdt|rdndd |dkrtnt|d< tt| | |t	f|}|
di }d	  fd
d| D }|D ]}	||	j
di  q@||_t|dsX||_|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                    s   i | ]
\}}|t | qS r   r   ).0ntpmsgr   r   
<dictcomp>L   s    z*_TypedDictMeta.__new__.<locals>.<dictcomp>r   )globalswarningswarnDeprecationWarningr(   r   superr$   r.   r   r#   itemsupdate__dict__r   hasattrr   )
r   namebasesr'   r   r!   r6   tp_dictannsbase	__class__r2   r   r.   1   s$   




z_TypedDictMeta.__new__)TF)r   r    __qualname__r.   r   __instancecheck____subclasscheck____classcell__r   r   rC   r   r$   0   s    #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                 C      | S )zA normal positional argumentr   typer>   r   r   r   Argz      rL   c                 C   rI   )z*A positional argument with a default valuer   rJ   r   r   r   
DefaultArg   rM   rN   c                 C   rI   )zA keyword-only argumentr   rJ   r   r   r   NamedArg   rM   rO   c                 C   rI   )z,A keyword-only argument with a default valuer   rJ   r   r   r   DefaultNamedArg   rM   rP   c                 C   rI   )z*A *args-style variadic positional argumentr   rK   r   r   r   VarArg   rM   rR   c                 C   rI   )z*A **kwargs-style variadic keyword argumentr   rQ   r   r   r   KwArg   rM   rS   c                   @   s   e Zd ZdS )_DEPRECATED_NoReturnN)r   r    rE   r   r   r   r   rT      s    rT   c                 C   rI   r   r   )r   r   r   r   trait   s   rU   c                  O   s   dd S )Nc                 S   rI   r   r   )xr   r   r   <lambda>   s    zmypyc_attr.<locals>.<lambda>r   )attrskwattrsr   r   r   
mypyc_attr   s   rZ   c                   @   s   e Zd Zdd Zdd ZdS )_FlexibleAliasClsAppliedc                 C   s
   || _ d S r   val)selfr]   r   r   r   __init__      
z!_FlexibleAliasClsApplied.__init__c                 C   s   | j S r   r\   r^   r   r   r   r   __getitem__   s   z$_FlexibleAliasClsApplied.__getitem__N)r   r    rE   r_   rb   r   r   r   r   r[      s    r[   c                   @      e Zd Zdd ZdS )_FlexibleAliasClsc                 C   s   t |d S )N)r[   ra   r   r   r   rb      s   z_FlexibleAliasCls.__getitem__N)r   r    rE   rb   r   r   r   r   rd          rd   c                   @   rc   )_NativeIntMetac                 C   s
   t |tS r   )
isinstanceint)r   instr   r   r   rF      r`   z _NativeIntMeta.__instancecheck__N)r   r    rE   rF   r   r   r   r   rg      rf   rg   c                   @      e Zd ZdefddZdS )i64r   c                 C      |t ur	t||S t|S r   	_sentinelri   r   rV   rB   r   r   r   r.         
zi64.__new__Nr   r    rE   ro   r.   r   r   r   r   rl          rl   )	metaclassc                   @   rk   )i32r   c                 C   rm   r   rn   rp   r   r   r   r.      rq   zi32.__new__Nrr   r   r   r   r   ru      rs   ru   c                   @   rk   )i16r   c                 C   rm   r   rn   rp   r   r   r   r.      rq   zi16.__new__Nrr   r   r   r   r   rv      rs   rv   c                   @   rk   )u8r   c                 C   rm   r   rn   rp   r   r   r   r.      rq   z
u8.__new__Nrr   r   r   r   r   rw      rs   rw   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                 C   s   | d|   }d u rdt d|  d}t|||| < | dv r.d|  d|  d|  d	}nJ d|  ddd l}|j|td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   r*   r,   )r#   r   r   r6   r7   r8   )r>   ry   r]   r3   r6   r   r   r   _warn_deprecation   s   r~   c                 C   s   t | t dS )N)ry   )r~   r5   rx   r   r   r   __getattr__   r   r   r   )'__doc__r
   r   r   r   r   r   r   r(   rK   r$   r   r)   r   r    rL   rN   rO   rP   rR   rS   rT   rU   rZ   r[   rd   FlexibleAliasrg   objectro   rl   ru   rv   rw   	_int_typeformatstrr~   r   r   r   r   r   <module>   sL    

'!	