%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3.12/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3.12/__pycache__/typing.cpython-312.pyc

�

���f�����dZddlmZmZddlZddlmZddlZddlZddlZddl	Z	ddl
Z
ddlZddl
Z
ddlZddlZddlmZmZmZmZddlmZmZmZmZmZmZmZmZgd�Zd�dd	�d
�Zd�dd	�d�Zd
�Z d�Z!d�Z"d�Z#d�Z$d�Z%dd�d�Z&d�Z'd�Z(d�Z)d�Z*gZ+iZ,d�dd�d�Z-e.�fd�Z/Gd�d�Z0Gd�d�Z1Gd �d!e0e1d�"�Z2Gd#�d$e2d�"�Z3Gd%�d&e4�Z5Gd'�d(e5�)�Z6e2d*��Z7e2d+��Z8e2d,��Z9e2d-��Z:e2d.��Z;e2d/��Z<e2d0��Z=d1�Z>e2d2��Z?e3e-d��d3���Z@e2d4��ZAe2d5��ZBe2d6��ZCGd7�d8e0d�"�ZDd9e6d:eEfd;�ZFd9e6d:eEfd<�ZGGd=�d>�ZHd?�ZId@�ZJdA�ZKdB�ZLe-dC��ZMdD�ZNdE�ZOGdF�dGe0d�"�ZPGdH�dIePd�"�ZQGdJ�dKe1ePd�"�ZRGdL�dMeRd�"�ZSGdN�dOe1eQd�"�ZTGdP�dQeRd�"�ZUGdR�dSeRd�"�ZVGdT�dUe1eQd�"�ZWdV�ZXGdW�dXeQd�"�ZYGdY�dZeQd�"�ZZe2d[��Z[Gd\�d]eQd�"�Z\Gd^�d_�Z]e.hd`��Z^e.hda��Z_e^e_zdbhzZ`dc�Zadd�Zbd�df�Zcd�dh�Zdgdi�djdkgdl�Zee	j�dm��Zge+j�egj��dn�Zjej�eej�do�Zlej�eel�[j[lGdp�dqe�Zmendr��ZoGds�dteem�)�ZpGdu�dve1eQd�"�ZqGdw�dx�Zrdy�Zsdz�Ztd{�Zuej�ej�ej�ej�eeefZzd�d|�Z{d}�Z|d~�Z}d�Z~d��Zd�Z�d�e8d:e8fd��Z�d��Z�d��Z�d��Z�ee	�j
ee���Z�d��Z�d��Z�d��Z�d��Z�ed��Z�ed��Z�ed��Z�ed�d���Z�ed�d���Z�ed�d���Z�ed�d���Z�ed�de4���Z�ed�e�e��Z�eRZ�e�ej�j0d�Z�e�ej�j2de�Z�e�ej�j4d��Z�e�ej�j6de�Z�e�ej�j8de�Z�e�ej�j:de�Z�e�ej�j<de�Z�e�ej�j>de�Z�e�ej�j@d�Z�e�ej�jBde�Z�e�ej�jDde�Z�eUej�jFdg�Z�d�e�_e�ej�jHded����Z�e�ej�jLde�Z�e�ej�jNdg�Z�e�ej�jPdg�Z�e�ej�jRde�Z�e�ej�jTde�Z�eSej�jVdd����Z�eVe�d�dd����Z�d�e�_e�e�dedd����Z�e�e�j`ded����Z�e�e�dedd����Z�e�e.dedd����Z�e�ej�jhde�Z�e�ej�jjde�Z�e�ej�jldg�Z�e�ej�jnde�Z�e�e�jpded����Z�e�e�jtded����Z�e�e�dgdd����Z�e�ej
dgd����Z�e�e�j|dg�Z�e�e�j~de�Z�e�e�j�dg�Z�e�ej�j�d��Z�e�ej�j�dg�Z�e�e4dedd����Z�d�e�_esGd��d�ep��Z�esGd��d�ep��Z�esGd��d�ep��Z�esGd��d�ep��Z�esGd��d�ep��Z�esd����Z�esd����Z�d�d��Z�e.hd���Z�e.hd���Z�Gd��d�e4�Z�d�d��Z�e4�j�e�d�d�i�Z�d��Z�e�e�_�Gd��d�e4�Z�d�ddœdÄZ�e4�j�e�d�d�i�Z�dńe�_�e2dƄ�Z�e2dDŽ�Z�GdȄdɫZ�e�Z�dZ�Gdʄd�ee��Z�Gd̄d�e�e��Z�Gd΄d�e�e��Z�GdЄd�e4�Z�Gd҄d�e߬)�Z�e�d�ze�_�e�e
�j�e�j�<e�e�j�de�Z�e�e�j�de�Z�GdՄd�e߬)�Ze�d�ze_�ee
�j�e�j�<d؄�Z�Gdلd�ep�Z�ddddd�dۜd�eEd�eEd�eEd�eEd�e�e4e6e�d�e6fzd�fd�e6d:e�fd�Z�d�dd�f�Z�d��Z�y)�a
The typing module: Support for gradual typing as defined by PEP 484 and subsequent PEPs.

Among other things, the module includes the following:
* Generic, Protocol, and internal machinery to support generic aliases.
  All subscripted types like X[int], Union[int, str] are generic aliases.
* Various "special forms" that have unique meanings in type annotations:
  NoReturn, Never, ClassVar, Self, Concatenate, Unpack, and others.
* Classes whose instances can be type arguments to generic classes and functions:
  TypeVar, ParamSpec, TypeVarTuple.
* Public helper functions: get_type_hints, overload, cast, final, and others.
* Several protocols to support duck-typing:
  SupportsFloat, SupportsIndex, SupportsAbs, and others.
* Special types: NewType, NamedTuple, TypedDict.
* Deprecated wrapper submodules for re and io related types.
* Deprecated aliases for builtin types and collections.abc ABCs.

Any name not present in __all__ is an implementation detail
that may be changed without notice. Use at your own risk!
�)�abstractmethod�ABCMetaN)�defaultdict)�WrapperDescriptorType�MethodWrapperType�MethodDescriptorType�GenericAlias)�_idfunc�TypeVar�	ParamSpec�TypeVarTuple�
ParamSpecArgs�ParamSpecKwargs�
TypeAliasType�Generic)c�	Annotated�Any�Callable�ClassVar�Concatenate�Final�
ForwardRefr�Literal�Optionalr�Protocol�Tuple�Typerr
�Union�AbstractSet�
ByteString�	Container�ContextManager�Hashable�	ItemsView�Iterable�Iterator�KeysView�Mapping�MappingView�MutableMapping�MutableSequence�
MutableSet�Sequence�Sized�
ValuesView�	Awaitable�
AsyncIterator�
AsyncIterable�	Coroutine�
Collection�AsyncGenerator�AsyncContextManager�
Reversible�SupportsAbs�
SupportsBytes�SupportsComplex�
SupportsFloat�
SupportsIndex�SupportsInt�
SupportsRound�ChainMap�Counter�Deque�Dict�DefaultDict�List�OrderedDict�Set�	FrozenSet�
NamedTuple�	TypedDict�	Generator�BinaryIO�IO�Match�Pattern�TextIO�AnyStr�assert_type�assert_never�cast�clear_overloads�dataclass_transform�final�get_args�
get_origin�
get_overloads�get_type_hints�is_typeddict�
LiteralString�Never�NewType�
no_type_check�no_type_check_decorator�NoReturn�NotRequired�overload�overriderr�Required�reveal_type�runtime_checkable�Self�Text�
TYPE_CHECKING�	TypeAlias�	TypeGuardr�UnpackF��allow_special_formsc�\�|�td�St|t�rt|||��S|S)z=For converting None to type(None), and strings to ForwardRef.N)�module�is_class)�type�
isinstance�strr)�argrqros   �/usr/lib/python3.12/typing.py�
_type_convertrx�s0��
�{��D�z���#�s���#�f�7J�K�K��J�Tc���ttf}|s|tfz
}|r
|tfz
}t	|||��}t|t�r|j|vrt|�d���|ttttttfvr|S|r|ttfvr|St|t�s|ttfvrtd|�d���t!|�t"urt|�d|d�d���|S)a�Check that the argument is a type, and return it (internal helper).

    As a special case, accept None and return type(None) instead. Also wrap strings
    into ForwardRef instances. Consider several corner cases, for example plain
    special forms like Union are not valid, while Union[int, str] is OK, etc.
    The msg argument is a human-readable error message, e.g.::

        "Union[arg, ...]: arg should be a type."

    We append the repr() of the actual value (truncated to 100 chars).
    )rqro� is not valid as type argumentzPlain z Got z.100�.)rrrrrxrt�
_GenericAlias�
__origin__�	TypeErrorrr\rar]rhrk�_SpecialFormrs�tuple)rv�msg�is_argumentrqro�invalid_generic_formss      rw�_type_checkr��s���%�h�/����(��,���!�e�X�-�!�
��F�@S�
T�C��3�
�&��N�N�3�3��3�%�=�>�?�?�
�s�M�8�U�D�)�D�D��
��s�x��&7�7��
��#�|�$����/B�(B��&���%C�D�E�E��C�y�E���3�%�u�S�4�L��2�3�3��Jryc�N�|duxs t|ttttf�S�N.)rtr��listr�_ConcatenateGenericAlias)rvs rw�_is_param_exprr��s,���#�:�@��C�
�D�)�%=�>�@�@ryc��|jtjjuxrt	|�dk(xrt|d�S)aCInternal helper for munging collections.abc.Callable's __args__.

    The canonical representation for a Callable's __args__ flattens the
    argument types, see https://github.com/python/cpython/issues/86361.

    For example::

        >>> import collections.abc
        >>> P = ParamSpec('P')
        >>> collections.abc.Callable[[int, int], str].__args__ == (int, int, str)
        True
        >>> collections.abc.Callable[P, str].__args__ == (P, str)
        True

    As a result, if we need to reconstruct the Callable from its __args__,
    we need to unflatten it.
    �r)r~�collections�abcr�lenr�)�typ�argss  rw�_should_unflatten_callable_argsr��s@��&	���+�/�/�2�2�2�	=��T��a��;�N�4��7�$;�<�ryc�V�t|t�r6|jdk(r|jS|j�d|j��S|duryt|tj
�r|jSt|t�rddjd�|D��zdzSt|�S)	a;Return the repr() of an object, special-casing types (internal helper).

    If obj is a type, we return a shorter version than the default
    type.__repr__, based on the module and qualified name, which is
    typically enough to uniquely identify a type.  For everything
    else, we fall back on repr(obj).
    �builtinsr|.�...�[�, c3�2K�|]}t|����y�w�N)�
_type_repr)�.0�ts  rw�	<genexpr>z_type_repr.<locals>.<genexpr>s����:��z�!�}�:����])
rtrs�
__module__�__qualname__�types�FunctionType�__name__r��join�repr��objs rwr�r��s����#�t���>�>�Z�'��#�#�#��.�.�!��3�#3�#3�"4�5�5�
�c�z���#�u�)�)�*��|�|���#�u���T�Y�Y�:�c�:�:�:�S�@�@���9�ryc�`�g}|D]�}t|t�r�t|t�r/|D])}t|g�D]}||vs�|j	|���+�St|d�r||vs�d|j	|��vt
|dd�D]}||vs�|j	|����t|�S)aCollect all type variables and parameter specifications in args
    in order of first appearance (lexicographic order).

    For example::

        >>> P = ParamSpec('P')
        >>> T = TypeVar('T')
        >>> _collect_parameters((T, Callable[P, T]))
        (~T, ~P)
    �__typing_subst__�__parameters__�)rtrsr��_collect_parameters�append�hasattr�getattr)r��
parametersr��x�	collecteds     rwr�r�s����J�
�)���a����
��5�
!��
5��!4�a�S�!9�5�I� �
�2�"�)�)�)�4�5�
5��Q�*�
+��
�"��!�!�!�$��Q� 0�"�5�
)���J�&��%�%�a�(�
)�)�$���ryc
��|st|�d���t|�}||k7rtd||kDrdnd�d|�d|�d|����y)	z�Check correct count for parameters of a generic cls (internal helper).

    This gives a nice error message in case of count mismatch.
    � is not a generic class�Too �many�few� arguments for �	; actual �, expected N)rr�)�clsr��elen�alens    rw�_check_genericr�'sh��
��3�%�6�7�8�8��z�?�D��t�|��$����v�%�@��PS�u�U#�#'�&��D�6�;�<�	<�ryc��g}|D]=}t|dd�}|�|r|ddus|j|��-|j|��?|S)N�__typing_unpacked_tuple_args__���.)r��extendr�)r��newargsrv�subargss    rw�_unpack_argsr�3sW���G�� ���#�?��F�����G�B�K�3�4F��N�N�7�#��N�N�3�� ��Nry��unhashable_fallbackc�h�	tj|�S#t$r|s�t|�cYSwxYwr�)�dict�fromkeysr�_deduplicate_unhashable)�paramsr�s  rw�_deduplicater�=s6��/��}�}�V�$�$���/�"��&�v�.�.�	/�s��1�1c�D�g}|D]}||vs�|j|��|Sr�)r�)�unhashable_params�new_unhashabler�s   rwr�r�Gs4���N�
�%���N�"��!�!�!�$�%��ryc��t|�}t|�}t|�}	|D]}|j|��	|S#t$rYywxYw)NF)r�r��remove�
ValueError)�
first_args�second_args�first_unhashable�second_unhashabler��elems      rw�_compare_args_orderlessr�Ns_��.�z�:��/��<���
��A��$�	�D�
�H�H�T�N�	��5�L������s�?�	A�
Ac���g}|D]O}t|ttjf�r|j	|j
��?|j
|��Qtt|d���S)zwInternal helper for Union creation and substitution.

    Flatten Unions among parameters, then remove duplicates.
    Tr�)	rt�_UnionGenericAliasr��	UnionTyper��__args__r�r�r��r�r��ps   rw�_remove_dups_flattenr�Ys\���F�
����a�,�e�o�o�>�?��M�M�!�*�*�%��M�M�!��	���f�$�?�@�@ryc��g}|D]?}t|t�r|j|j��/|j	|��At|�S)zHInternal helper for Literal creation: flatten Literals among parameters.)rt�_LiteralGenericAliasr�r�r�r�r�s   rw�_flatten_literal_paramsr�isI��
�F�
����a�-�.��M�M�!�*�*�%��M�M�!��	�
��=�ry��typedc�&���fd�}|�||�S|S)z�Internal wrapper caching __getitem__ of generic types.

    For non-hashable arguments, the original function is used as a fallback.
    c�����tj�����}|t�<tj	|j
�~tj���fd��}|S)Nr�c�P��	t�|i|��S#t$rYnwxYw�|i|��Sr�)�_cachesr)r��kwds�funcs  �rw�innerz+_tp_cache.<locals>.decorator.<locals>.inner�s>���
��t�}�d�3�d�3�3���
��
����&��&�&s�
�	�)�	functools�	lru_cacher��	_cleanupsr��cache_clear�wraps)r��cacher�r�s`  �rw�	decoratorz_tp_cache.<locals>.decorator}s^���1�	�#�#�%�0��6�����
�����*�*�+��	����	�	'�
�	'��ryr�)r�r�r�s ` rw�	_tp_cacher�xs ���
�(�������ryc������t|t�r|j����St|ttt
jf��rt|t�rftd�|jD��}|j}t||�r|j|dd|df}n|j|}|r	t|}t���fd�|jD��}||jk(r|St|t�rt	|j|�St|t
j�r$tjtj |�S|j#|�S|S)z�Evaluate all forward references in the given type t.

    For use of globalns and localns see the docstring for get_type_hints().
    recursive_guard is used to prevent infinite recursion with a recursive
    ForwardRef.
    c3�VK�|]!}t|t�rt|�n|���#y�wr�)rtrur�r�rvs  rwr�z_eval_type.<locals>.<genexpr>�s*������$.�c�3�#7�
�3��S�@��s�')Nr�c3�:�K�|]}t|�������y�wr�)�
_eval_type)r��a�globalns�localns�recursive_guards  ���rwr�z_eval_type.<locals>.<genexpr>�s�����^�a�
�1�h���I�^�s�)rtr�	_evaluater}r	r�r�r�r��__unpacked__r�r~rmr��reduce�operator�or_�	copy_with)r�r�r�r�r��is_unpacked�ev_argss ```   rwr�r��s$����!�Z� ��{�{�8�W�o�>�>��!�m�\�5�?�?�C�D��a��&����:�:���D��.�.�K�.�q�$�7��L�L�$�s��)�T�"�X�!6�7���L�L��&����1�I���^�ST�S]�S]�^�^���a�j�j� ��H��a��&�����g�6�6��a����)��#�#�H�L�L�'�:�:��;�;�w�'�'��Hryc��eZdZdZdZd�Zy)�_FinalzMixin to prohibit subclassing.)�__weakref__c�"�d|vrtd��y)N�_rootz&Cannot subclass special typing classes�r)r�r�r�s   rw�__init_subclass__z_Final.__init_subclass__�s���$���D�E�E�ryN)r�r�r��__doc__�	__slots__r
r�ryrwrr�s��(� �I�Fryrc��eZdZdZdZdZy)�_NotIterablea�Mixin to prevent iteration, without being compatible with Iterable.

    That is, we could do::

        def __iter__(self): raise TypeError()

    But this would make users of this mixin duck type-compatible with
    collections.abc.Iterable - isinstance(foo, Iterable) would be True.

    Luckily, we can instead prevent iteration by setting __iter__ to None, which
    is treated specially.
    r�N)r�r�r�rr�__iter__r�ryrwrr�s����I��Hryrc�\�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
ed��Zy
)r�)�_namer�_getitemc�V�||_|j|_|j|_yr�)rr�rr)�self�getitems  rw�__init__z_SpecialForm.__init__�s!����
��%�%��
�����ryc�8�|dvr|jSt|��)N>r�r�)r�AttributeError)r�items  rw�__getattr__z_SpecialForm.__getattr__�s ���/�/��:�:���T�"�"ryc��td|����)N�Cannot subclass r�r�basess  rw�__mro_entries__z_SpecialForm.__mro_entries__�s���*�4�(�3�4�4ryc� �d|jzS�N�typing.�r�rs rw�__repr__z_SpecialForm.__repr__�����4�:�:�%�%ryc��|jSr�r&r's rw�
__reduce__z_SpecialForm.__reduce__�����z�z�ryc��td|����)NzCannot instantiate r)rr�r�s   rw�__call__z_SpecialForm.__call__�s���-�d�X�6�7�7ryc��t||fSr��r�r�others  rw�__or__z_SpecialForm.__or__�����T�5�[�!�!ryc��t||fSr�r0r1s  rw�__ror__z_SpecialForm.__ror__�����U�D�[�!�!ryc��t|�d���)Nz! cannot be used with isinstance()r�rr�s  rw�__instancecheck__z_SpecialForm.__instancecheck__�����4�&� A�B�C�Cryc��t|�d���)Nz! cannot be used with issubclass()r�rr�s  rw�__subclasscheck__z_SpecialForm.__subclasscheck__�r;ryc�&�|j||�Sr�)r�rr�s  rw�__getitem__z_SpecialForm.__getitem__�s���}�}�T�:�.�.ryN)r�r�r�rrrr"r(r+r.r3r6r:r>r�rAr�ryrwr�r��sO��0�I�'�
#�5�&��8�"�"�D�D��/��/ryr�)rc��eZdZd�Zy)�_LiteralSpecialFormc�N�t|t�s|f}|j|g|���Sr�)rtr�rr@s  rwrAz_LiteralSpecialForm.__getitem__s)���*�e�,�$��J��t�}�}�T�/�J�/�/ryN)r�r�r�rAr�ryrwrCrCs��0ryrCc�(��eZdZ�fd�Z�fd�Z�xZS)�_AnyMetac�H��|turtd��t�|�
|�S)Nz+typing.Any cannot be used with isinstance())rr�superr:)rr��	__class__s  �rwr:z_AnyMeta.__instancecheck__	s&����3�;��I�J�J��w�(��-�-ryc�2��|turyt�|�	�S)Nz
typing.Any)rrHr()rrIs �rwr(z_AnyMeta.__repr__s����3�;���w��!�!ry)r�r�r�r:r(�
__classcell__�rIs@rwrFrFs���.�
"�"ryrFc�"��eZdZdZ�fd�Z�xZS)raWSpecial type indicating an unconstrained type.

    - Any is compatible with every type.
    - Any assumed to have all methods.
    - All values assumed to be instances of Any.

    Note that all the above statements are true from the point of view of
    static type checkers. At runtime, Any should not be used with instance
    checks.
    c�H��|turtd��t�|�
|�S)NzAny cannot be instantiated)rrrH�__new__�r�r��kwargsrIs   �rwrOzAny.__new__ s%����#�:��8�9�9��w��s�#�#ry)r�r�r�rrOrKrLs@rwrrs���	�$�$ryr)�	metaclassc��t|�d���)a�Special type indicating functions that never return.

    Example::

        from typing import NoReturn

        def stop() -> NoReturn:
            raise Exception('no way')

    NoReturn can also be used as a bottom type, a type that
    has no values. Starting in Python 3.11, the Never type should
    be used for this concept instead. Type checkers should treat the two
    equivalently.
    � is not subscriptablerr@s  rwrara&s�� �t�f�1�2�
3�3ryc��t|�d���)adThe bottom type, a type that has no members.

    This can be used to define a function that should never be
    called, or a function that never returns::

        from typing import Never

        def never_call_me(arg: Never) -> None:
            pass

        def int_or_str(arg: int | str) -> None:
            never_call_me(arg)  # type checker error
            match arg:
                case int():
                    print("It's an int")
                case str():
                    print("It's a str")
                case _:
                    never_call_me(arg)  # OK, arg is of type Never
    rTrr@s  rwr]r];s��,�t�f�1�2�
3�3ryc��t|�d���)asUsed to spell the type of "self" in classes.

    Example::

        from typing import Self

        class Foo:
            def return_self(self) -> Self:
                ...
                return self

    This is especially useful for:
        - classmethods that are used as alternative constructors
        - annotating an `__enter__` method which returns self
    rTrr@s  rwrhrhTs��"�t�f�1�2�
3�3ryc��t|�d���)a
Represents an arbitrary literal string.

    Example::

        from typing import LiteralString

        def run_query(sql: LiteralString) -> None:
            ...

        def caller(arbitrary_string: str, literal_string: LiteralString) -> None:
            run_query("SELECT * FROM students")  # OK
            run_query(literal_string)  # OK
            run_query("SELECT * FROM " + literal_string)  # OK
            run_query(arbitrary_string)  # type checker error
            run_query(  # type checker error
                f"SELECT * FROM students WHERE name = {arbitrary_string}"
            )

    Only string literals and other LiteralStrings are compatible
    with LiteralString. This provides a tool to help prevent
    security issues such as SQL injection.
    rTrr@s  rwr\r\hs��0�t�f�1�2�
3�3ryc�:�t||�d��}t||f�S)a>Special type construct to mark class variables.

    An annotation wrapped in ClassVar indicates that a given
    attribute is intended to be used as a class variable and
    should not be set on instances of that class.

    Usage::

        class Starship:
            stats: ClassVar[dict[str, int]] = {} # class variable
            damage: int = 10                     # instance variable

    ClassVar accepts only types and cannot be further subscribed.

    Note that ClassVar is not a class itself, and should not
    be used with isinstance() or issubclass().
    � accepts only single type.�r�r}�rr�rs   rwrr��'��&�z�d�V�+E�#F�G�D����w�'�'ryc�:�t||�d��}t||f�S)a�Special typing construct to indicate final names to type checkers.

    A final name cannot be re-assigned or overridden in a subclass.

    For example::

        MAX_SIZE: Final = 9000
        MAX_SIZE += 1  # Error reported by type checker

        class Connection:
            TIMEOUT: Final[int] = 10

        class FastConnector(Connection):
            TIMEOUT = 1  # Error reported by type checker

    There is no runtime checking of these properties.
    rYrZr[s   rwrr�r\ryc���|dk(rtd��t|t�s|f}d�t�fd�|D��}t|�}t	|�dk(r|dSt	|�dk(rtd�|vrt
||d	�
�St
||�S)a�Union type; Union[X, Y] means either X or Y.

    On Python 3.10 and higher, the | operator
    can also be used to denote unions;
    X | Y means the same thing to the type checker as Union[X, Y].

    To define a union, use e.g. Union[int, str]. Details:
    - The arguments must be types and there must be at least one.
    - None as an argument is a special case and is replaced by
      type(None).
    - Unions of unions are flattened, e.g.::

        assert Union[Union[int, str], float] == Union[int, str, float]

    - Unions of a single argument vanish, e.g.::

        assert Union[int] == int  # The constructor actually returns int

    - Redundant arguments are skipped, e.g.::

        assert Union[int, str, int] == Union[int, str]

    - When comparing unions, the argument order is ignored, e.g.::

        assert Union[int, str] == Union[str, int]

    - You cannot subclass or instantiate a union.
    - You can use Optional[X] as a shorthand for Union[X, None].
    r�z Cannot take a Union of no types.z)Union[arg, ...]: each arg must be a type.c3�6�K�|]}t|�����y�wr��r��r�r�r�s  �rwr�zUnion.<locals>.<genexpr>�s�����?�q�{�1�c�*�?����rr�Nr��name)rrtr�r�r�rsr��rr�r�s  @rwrr�s����>�R���:�;�;��j�%�(� �]�
�
5�C��?�J�?�?�J�%�j�1�J�
�:��!���!�}��
�:��!���T�
�j� 8�!�$�
��D�D��d�J�/�/ryc��t||fS)z�Used from the C implementation of TypeVar.

    TypeVar.__or__ calls this instead of returning types.UnionType
    because we want to allow unions between TypeVars and strings
    (forward references).
    r0)�left�rights  rw�_make_unionrj�s����u���ryc�H�t||�d��}t|td�fS)z,Optional[X] is equivalent to Union[X, None].z requires a single type.N)r�rrs)rr�rvs   rwrr�s+���j�T�F�*B�"C�
D�C���d�4�j��!�!ryc
��t|�}	td�ttt	|���D��}t
||�S#t
$rY�wxYw)aSpecial typing form to define literal types (a.k.a. value types).

    This form can be used to indicate to type checkers that the corresponding
    variable or function parameter has a value equivalent to the provided
    literal (or one of several literals)::

        def validate_simple(data: Any) -> Literal[True]:  # always returns True
            ...

        MODE = Literal['r', 'rb', 'w', 'wb']
        def open_helper(file: str, mode: MODE) -> str:
            ...

        open_helper('/some/path', 'r')  # Passes type check
        open_helper('/other/path', 'typo')  # Error in type checker

    Literal[...] cannot be subclassed. At runtime, an arbitrary value
    is allowed as type argument to Literal[...], but type checkers may
    impose restrictions.
    c3�&K�|]	\}}|���y�wr�r�)r�r��_s   rwr�zLiteral.<locals>.<genexpr>s����^���A�1�^�s�)r�r�r�r��_value_and_type_iterrr�r@s  rwrr�sW��2)��4�J�
��^��d�;O�PZ�;[�6\�)]�^�^�
� ��j�1�1���
��
�s�-A�	A�Ac��t|�d���)a:Special form for marking type aliases.

    Use TypeAlias to indicate that an assignment should
    be recognized as a proper type alias definition by type
    checkers.

    For example::

        Predicate: TypeAlias = Callable[..., bool]

    It's invalid when used anywhere except as in the example above.
    rTrr@s  rwrkrk
s���t�f�1�2�
3�3ryc����|dk(rtd��t|t�s|f}|ddust|dt�std��d�g�fd�|ddD��|d��}t	||�S)	acSpecial form for annotating higher-order functions.

    ``Concatenate`` can be used in conjunction with ``ParamSpec`` and
    ``Callable`` to represent a higher-order function which adds, removes or
    transforms the parameters of a callable.

    For example::

        Callable[Concatenate[int, P], int]

    See PEP 612 for detailed information.
    r�z&Cannot take a Concatenate of no types.r�.zMThe last parameter to Concatenate should be a ParamSpec variable or ellipsis.z/Concatenate[arg, ...]: each arg must be a type.c3�6�K�|]}t|�����y�wr�r`ras  �rwr�zConcatenate.<locals>.<genexpr>4s�����A�A�K��3�'�A�rbN)rrtr�rr�rfs  @rwrrs�����R���@�A�A��j�%�(� �]�
��r�N�c�!�Z�
�2��	�%J��:�;�	;�
;�C�R�A��C�R��A�R�:�b�>�R�J�#�D�*�5�5ryc�:�t||�d��}t||f�S)a�Special typing construct for marking user-defined type guard functions.

    ``TypeGuard`` can be used to annotate the return type of a user-defined
    type guard function.  ``TypeGuard`` only accepts a single type argument.
    At runtime, functions marked this way should return a boolean.

    ``TypeGuard`` aims to benefit *type narrowing* -- a technique used by static
    type checkers to determine a more precise type of an expression within a
    program's code flow.  Usually type narrowing is done by analyzing
    conditional code flow and applying the narrowing to a block of code.  The
    conditional expression here is sometimes referred to as a "type guard".

    Sometimes it would be convenient to use a user-defined boolean function
    as a type guard.  Such a function should use ``TypeGuard[...]`` as its
    return type to alert static type checkers to this intention.

    Using  ``-> TypeGuard`` tells the static type checker that for a given
    function:

    1. The return value is a boolean.
    2. If the return value is ``True``, the type of its argument
       is the type inside ``TypeGuard``.

    For example::

         def is_str_list(val: list[object]) -> TypeGuard[list[str]]:
             '''Determines whether all objects in the list are strings'''
             return all(isinstance(x, str) for x in val)

         def func1(val: list[object]):
             if is_str_list(val):
                 # Type of ``val`` is narrowed to ``list[str]``.
                 print(" ".join(val))
             else:
                 # Type of ``val`` remains as ``list[object]``.
                 print("Not a list of strings!")

    Strict type narrowing is not enforced -- ``TypeB`` need not be a narrower
    form of ``TypeA`` (it can even be a wider form) and this may lead to
    type-unsafe results.  The main reason is to allow for things like
    narrowing ``list[object]`` to ``list[str]`` even though the latter is not
    a subtype of the former, since ``list`` is invariant.  The responsibility of
    writing type-safe type guards is left to the user.

    ``TypeGuard`` also works with type variables.  For more information, see
    PEP 647 (User-Defined Type Guards).
    rYrZr[s   rwrlrl8s(��b�z�d�V�+E�#F�G�D����w�'�'ryc�F�eZdZdZdZd
dd�d�Zd�Zd�Zd	�Zd
�Z	d�Z
d�Zy)rz-Internal wrapper to hold a forward reference.)�__forward_arg__�__forward_code__�__forward_evaluated__�__forward_value__�__forward_is_argument__�__forward_is_class__�__forward_module__NF)rrc�(�t|t�std|����|jd�rd|�d�}n|}	t	|dd�}||_||_d|_d|_	||_
||_||_y#t
$rtd|����wxYw)	Nz*Forward reference must be a string -- got �*�(z,)[0]z<string>�evalz/Forward reference must be an expression -- got F)
rtrur�
startswith�compile�SyntaxErrorrurvrwrxryrzr{)rrvr�rqrr�arg_to_compile�codes       rwrzForwardRef.__init__us����#�s�#��H���P�Q�Q�
�>�>�#�� ���U�^�N� �N�	Y��>�:�v�>�D� #��� $���%*��"�!%���'2��$�$,��!�"(�����	Y�� O�PS�w�W�X�X�	Y�s�
A9�9Bc��|j|vr|S|jr||ur�|�|�ix}}n	|�|}n|�|}|j�5ttj
j
|jd�d|�}tt|j||�d|j|j��}t|||||jhz�|_
d|_|jS)N�__dict__z*Forward references must evaluate to types.)r�roT)rurwr{r��sys�modules�getr�rrvryrzr�rx)rr�r�r��type_s     rwr�zForwardRef._evaluate�s������?�2��K��)�)�W�H�-D���G�O�%'�'��7��!�"����"���&�&�2�"��K�K�O�O�D�$;�$;�T�B�J�PX��� ��T�*�*�H�g�>�<� �8�8�$(�$=�$=�	�E�&0��x��/�T�=Q�=Q�<R�*R�&�D�"�*.�D�&��%�%�%ryc�.�t|t�stS|jr@|jr4|j|jk(xr|j
|j
k(S|j|jk(xr|j|jk(Sr�)rtr�NotImplementedrwrurxr{r1s  rw�__eq__zForwardRef.__eq__�s����%��,�!�!��%�%�%�*E�*E��(�(�E�,A�,A�A�F��*�*�e�.E�.E�E�
G��$�$��(=�(=�=�D��'�'�5�+C�+C�C�	Eryc�D�t|j|jf�Sr�)�hashrur{r's rw�__hash__zForwardRef.__hash__�s���T�)�)�4�+B�+B�C�D�Dryc��t||fSr�r0r1s  rwr3zForwardRef.__or__�r4ryc��t||fSr�r0r1s  rwr6zForwardRef.__ror__�r7ryc�b�|j�d}nd|j��}d|j�|�d�S)N�z	, module=zForwardRef(�))r{ru)r�module_reprs  rwr(zForwardRef.__repr__�s@���"�"�*��K�%�d�&=�&=�%@�A�K��T�1�1�4�[�M��C�Cry�TN)r�r�r�rrrr�r�r�r3r6r(r�ryrwrrms9��7�'�I�
)�u�)�0&�4E�E�"�"�Dryrr��returnc�B�t|t�xr
t|dd�S)N�#__typing_is_unpacked_typevartuple__F)rtrsr��r�s rw�_is_unpacked_typevartupler��s(���A�t�$�
$�
E��A�<�e�D�Fryc�H�t|ttf�xst|�Sr�)rtrrr�r�s rw�_is_typevar_liker��s���a�'�9�-�.�N�2K�A�2N�Nryc��eZdZdZd�Zy)�_PickleUsingNameMixinz/Mixin enabling pickling based on self.__name__.c��|jSr��r�r's rwr+z _PickleUsingNameMixin.__reduce__�s���}�}�ryN)r�r�r�rr+r�ryrwr�r��s
��9�ryr�c��d}t||d��}t|t�r|jtust|t
�rt
|dd�rt|�d���|S)N�*Parameters to generic types must be types.T)r�rFr{)r�rtr}r~rmr	r�r)rrvr�s   rw�_typevar_substr��sW��
6�C�
�c�3�D�
1�C�	�C��	'�C�N�N�f�,D�	�C��	&�7�3���+N��3�%�=�>�?�?��Jryc	��|j}|j|�}||dzdD] }t|t�s�t	d|����t|�}t|�}|}||z
dz
}	d}
d}t
|�D]Q\}}
t|
t�r�t|
dd�}|s�'t|�dk(s�6|ddus�>|
�t	d��|}
|d}�S|
�t||
�}t|	||
z
dz
�}	n||	z|kDrt	d	|�d
|�d|dz
����g|d|�|g||z
z�t||||	z
��|g||	z
|z
|z
dz
z�|||	z
d��S)Nrcz(More than one TypeVarTuple parameter in r�r�r�.z6More than one unpacked arbitrary-length tuple argumentr�Too few arguments for r�z, expected at least )r��indexrtr
rr��	enumeratersr��minr�)r�aliasr�r��typevartuple_index�paramr��plenrhri�var_tuple_index�fillarg�krvr�s               rw�_typevartuple_prepare_substr��s���
�
!�
!�F����d�+���*�Q�.�/�0�P���e�\�*��F�u�g�N�O�O�P��t�9�D��v�;�D��D��%�%��)�E��O��G��D�/�%���3��#�t�$��c�#C�T�J�G��3�w�<�1�,�����1C�"�.�#�$\�]�]�"#��!�!�*��%��"��4��)���E�4�/�1�A�5�6��	
����	��0���8#�#'�&�(<�T�!�V�H�F�G�	G��	
�e�t����)�'�$�.�
/��	�d�4����&�'���)�T�E�\�D�(�+=�=��A�
B�	�

�d�U�l�m�	��ryc��t|ttf�rtd�|D��}|St|�st	d|����|S)Nc3�4K�|]}t|d����y�w)zExpected a type.Nr`�r�r�s  rwr�z#_paramspec_subst.<locals>.<genexpr>s����D�1�K��#5�6�D���zFExpected a list of types, an ellipsis, ParamSpec, or Concatenate. Got )rtr�r�r�r�rrvs  rw�_paramspec_substr��sU���#��e�}�%��D��D�D���J��C�
 ��:�:=��@�A�	A��Jryc�*�|j}|j|�}|t|�k\rtd|����t|�dk(rt	|d�s|dk(sJ�|f}|St||t�rg|d|�t||��||dzd��}|S)Nr�rcr)r�r�r�rr�rtr�r�)rr�r�r��is     rw�_paramspec_prepare_substr�s���
�
!�
!�F����T��A��C��I�~��0���8�9�9�
�6�{�a���t�A�w� 7��A�v�
�v��w���K�
�D��G�T�	"�7��b�q��7�5��a��>�7�D��1���J�7���Kryc���t|t�s|f}td�|D��}|ttfv}|r|st	d|j
�d���t
d�|D��st	d|j�d���tt|��t|�k7r�t	d|j�d���|jD]}t|dd	�}|��|||�}�t||t|j��g}t|j|�D]8\}}t|t�r|j|��(|j!|��:t|�}t#||�S)
a�Parameterizes a generic class.

    At least, parameterizing a generic class is the *main* thing this method
    does. For example, for some generic class `Foo`, this is called when we
    do `Foo[int]` - there, with `cls=Foo` and `params=int`.

    However, note that this method is also called when defining generic
    classes in the first place with `class Foo(Generic[T]): ...`.
    c3�2K�|]}t|����y�wr��rx�r�r�s  rwr�z)_generic_class_getitem.<locals>.<genexpr>%s����4��=��#�4�r�zParameter list to z[...] cannot be emptyc3�2K�|]}t|����y�wr�)r�r�s  rwr�z)_generic_class_getitem.<locals>.<genexpr>.s����7�1�#�A�&�7�r�zParameters to zF[...] must all be type variables or parameter specification variables.z[...] must all be unique�__typing_prepare_subst__N)rtr�rrrr��allr�r��setr�r�r��zipr
r�r�r})r�r��is_generic_or_protocolr��prepare�new_args�new_args       rw�_generic_class_getitemr�su���f�e�$����
�4�V�4�
4�F� �W�h�$7�7�����$�S�%5�%5�$6�6K�L��
��7��7�7�� �����/8�9�:�
:��s�6�{��s�6�{�*�� �����.F�G�I�
I��'�'�	.�E��e�%?��F�G��"� ��f�-��	.�	�s�F�C��(:�(:�$;�<���!�#�"4�"4�f�=�	)�N�E�7��%��.�����(�����(�		)�
�x�����f�%�%ryc���
�tt|�
|i|��g}d|jvrt|jv}n7t|j
vxr#|jdk7xrt|�tk7}|rtd��d|jvr�t|j�}d}|jD]?}t|t�s�|jtus�'|�td��|j}�A|�at|�}t|��
|�
ksDdj!�
fd�|D��}dj!d�|D��}	td|�d	|	�d
���|}t#|�|_y)N�__orig_bases__rz!Cannot inherit from plain Genericz0Cannot inherit from Generic[...] multiple times.r�c3�>�K�|]}|�vs�t|����y�wr��ru)r�r��gvarsets  �rwr�z)_generic_init_subclass.<locals>.<genexpr>fs�����"M�a�A�W�<L�3�q�6�"M�s�	�c3�2K�|]}t|����y�wr�r�)r��gs  rwr�z)_generic_init_subclass.<locals>.<genexpr>gs����"9�a�3�q�6�"9�r�zSome type variables (z) are not listed in Generic[r�)rHrr
r�r��	__bases__r�rs�_TypedDictMetarr�rtr}r~r�r�r�r�)r�r�rQ�tvars�error�gvars�base�tvarset�s_vars�s_argsr�s          @rw�_generic_init_subclassr�Hsq���	�'�3�)�4�:�6�:��E��3�<�<�'��3�-�-�-���C�M�M�)�0��L�L�J�.�0���I��/�	�
��;�<�<��3�<�<�'�#�C�$6�$6�7�����&�&�	,�D��4��/��O�O�w�.��$�#�J�L�L��+�+��
	,����%�j�G��%�j�G��g�%����"M�5�"M�M�����"9�5�"9�9���"7��x�@:�:@���!D�E�E��E��u��C�ryc�J�|jd�xr|jd�S)N�__)r��endswith)�attrs rw�
_is_dunderr�ns���?�?�4� �8�T�]�]�4�%8�8ryc�X��eZdZdZddd�d�Zd�Zd�Zd�Z�fd	�Zd
�Z	d�Z
�fd�Z�xZS)
�_BaseGenericAliasa�The central part of the internal API.

    This represents a generic version of type 'origin' with type arguments 'params'.
    There are two kind of these aliases: user defined and special. The special ones
    are wrappers around builtin collections and ABCs in collections.abc. These must
    have 'name' always set. If 'inst' is False, then the alias can't be instantiated;
    this is used by e.g. typing.List and typing.Dict.
    TN��instrec�<�||_||_||_d|_yr�)�_instrr~r)r�originr�res    rwrz_BaseGenericAlias.__init__{s����
���
� �����ryc���|js0td|j�d|jj�d���|j|i|��}	||_|S#t$rY|SwxYw)NzType z cannot be instantiated; use z
() instead)r�rrr~r��__orig_class__�	Exception)rr�rQ�results    rwr.z_BaseGenericAlias.__call__�s����z�z��e�D�J�J�<�0#�#'�?�?�#;�#;�"<�J�H�I�
I� ����$�1�&�1��	�$(�F�!�
�
���	���
�	�s�A�	A&�%A&c�,�g}|j|vr|j|j�|j|�}||dzdD].}t|t�st|t�s�$t|�S|jt�t|�S�Nrc)r~r�r�rtr��
issubclassrr�)rr!�resr��bs     rwr"z!_BaseGenericAlias.__mro_entries__�s������?�?�%�'��J�J�t���'��K�K�����q��s�t��	 �A��!�.�/�:�a��3I���S�z��	 �
�J�J�w���S�z�ryc���|dvr$|jxs|jjSd|jvr!t	|�st|j|�St
|��)N>r�r�r~)rr~r�r�r�r�r)rr�s  rwrz_BaseGenericAlias.__getattr__�sU���/�/��:�:�9����!9�!9�9��4�=�=�(��D�1A��4�?�?�D�1�1��T�"�"ryc�t��t|�s|dvrt�|�	||�yt|j||�y)N>r�r�_nparams)r�rH�__setattr__�setattrr~)rr��valrIs   �rwr�z_BaseGenericAlias.__setattr__�s2����d��t�'E�E��G���c�*��D�O�O�T�3�/ryc�6�|jt|��Sr��r>rsr9s  rwr:z#_BaseGenericAlias.__instancecheck__�����%�%�d�3�i�0�0ryc��td��)NzBSubscripted generics cannot be used with class and instance checksrr=s  rwr>z#_BaseGenericAlias.__subclasscheck__�s���5�6�	6ryc���ttt�|�
�t	|j
�D�cgc]}t
|�r�|��c}z��Scc}wr�)r�r�rH�__dir__�dirr~r��rr�rIs  �rwr�z_BaseGenericAlias.__dir__�sJ����C����)�$'����$8�Q�D�
�4�@P�4�Q�R�S�T�	T��Qs�A�A)
r�r�r�rrr.r"rr�r:r>r�rKrLs@rwr�r�qs>����(,�$���
�#�0�1�6�T�Tryr�c�|��eZdZddd��fd�
Zd�Zd�Zd�Zd�Zed	��Z	d
�Z
d�Zd�Zd
�Z
d�Z�fd�Zd�Z�xZS)r}TNr�c����t�|�|||��t|t�s|f}td�|D��|_t|�|_|s|j|_yy)Nr�c3�4K�|]}|turdn|���y�w).N)�_TypingEllipsisr�s  rwr�z)_GenericAlias.__init__.<locals>.<genexpr>�s'����/�$%�&'�/�%9�c�� �/�r�)rHrrtr�r�r�r�r�)rr�r�r�rerIs     �rwrz_GenericAlias.__init__�sc���
����d���6��$��&��7�D��/�)-�/�/��
�1�$�7����$�/�/�D�O�ryc��t|t�stS|j|jk(xr|j|jk(Sr�)rtr}r�r~r�r1s  rwr�z_GenericAlias.__eq__�s>���%��/�!�!����5�#3�#3�3�4��M�M�U�^�^�3�	5ryc�D�t|j|jf�Sr�)r�r~r�r's rwr�z_GenericAlias.__hash__�s���T�_�_�d�m�m�4�5�5ryc��t||fSr�r0�rris  rwr3z_GenericAlias.__or__�r4ryc��t||fSr�r0�rrhs  rwr6z_GenericAlias.__ror__�����T�4�Z� � ryc�*�|jttfvrtd|����|jst|�d���t|t�s|f}t
d�|D��}t|�}|j|�}|j|�}|S)Nz%Cannot subscript already-subscripted r�c3�2K�|]}t|����y�wr�r�r�s  rwr�z,_GenericAlias.__getitem__.<locals>.<genexpr>
s����4�!�]�1�%�4�r�)
r~rrrr�rtr�r��_determine_new_argsr)rr�r��rs    rwrAz_GenericAlias.__getitem__�s���"�?�?�w��1�1��C�D�6�J�K�K��"�"��t�f�$;�<�=�=��$��&��7�D��4�t�4�4���D�!���+�+�D�1���N�N�8�$���ryc
�@�|j}|D]}t|dd�}|��|||�}�t|�}t|�}||k7rtd||kDrdnd�d|�d|�d|����t	t||��}t
|j|j|��S)Nr�r�r�r�r�r�r�)	r�r�r�rr�r�r��_make_substitutionr�)rr�r�r�r�r�r��new_arg_by_params        rwrz!_GenericAlias._determine_new_argss����$�$���	+�E��e�%?��F�G��"��t�T�*��	+��4�y���6�{���4�<��d�T�D�[�6�e�"D�O�TX�SY�Z'�'+�f�K��v�?�@�
@���F�D� 1�2���T�,�,�T�]�]�<L�M�N�Nryc	���g}|D�]V}t|t�r|j|��&t|dd�}|r|||�}nbt|dd�}|s|}nPg}|D];}	t|	t�r|j||	��(|j||	��=|t
|�}|jtjjk(r"t|t�r|j|���t|�r|j|���
t|t�r,|jt
|j||�����F|j|���Y|S)z$Create a list of new type arguments.r�Nr�r�)
rtrsr�r�r
r�r�r~r�r�rr�r)
rr�rr��old_arg�	substfuncr��	subparamsr�r�s
          rwrz _GenericAlias._make_substitution0sE�����8	)�G��'�4�(�����(����);�T�B�I��#�$4�W�$=�>��#�G�-=�r�B�	� �%�G� �G�&�@��%�a��6�#�N�N�+;�A�+>�?�#�N�N�+;�A�+>�?�	@�
&�e�G�n�5�G����+�/�/�":�":�:�z�'�SX�?Y�����(�*�7�3�����(��G�U�+�����$�1�1�'�;K�L�M������(�q8	)�r�ryc�h�|j|j||j|j��S�N)rer�)rIr~rr��rr�s  rwrz_GenericAlias.copy_withns%���~�~�d�o�o�t�$�*�*�4�:�:�~�V�Vryc��|jrd|jz}nt|j�}|jr3dj	|jD�cgc]
}t|���c}�}nd}|�d|�d�Scc}w)Nr%r�z()r�r�)rr�r~r�r�)rrer�r�s    rwr(z_GenericAlias.__repr__qsm���:�:��t�z�z�)�D��d�o�o�.�D��=�=��9�9�T�]�]�C��j��m�C�D�D��D���q���a� � ��	Ds�A;c��|jrt�|j}n|j}t|j�}t|�dk(rt
|dt�s|\}tj||ffS�Nrcr)	r�globalsr~r�r�r�rtrr)rr�r�s   rwr+z_GenericAlias.__reduce__}sd���:�:��Y�t�z�z�*�F��_�_�F��T�]�]�#���t�9��>�*�T�!�W�e�"<��E�D����&�$��/�/ryc�D��t|jt�rtd|����|jrt
�|�|�S|jtur>t|vry|j|�}||dzdD]}t|t�s�||us�y|jfS)Nrr�rc)rtr~r�rrrHr"rrr�r�)rr!r�r�rIs    �rwr"z_GenericAlias.__mro_entries__�s�����d�o�o�|�4��.�t�h�7�8�8��:�:��7�*�5�1�1��?�?�g�%��5� �����D�!�A��1�Q�3�4�[�
���a�!2�3���
��
����!�!ryc#�"K�t|��y�wr�)rmr's rwrz_GenericAlias.__iter__�s�����T�l��s�
)r�r�r�rr�r�r3r6r�rArrrr(r+r"rrKrLs@rwr}r}�s]���2.2��0�5�6�"�!�����>O�:<�|W�
!�0�
"�ryr}c�^��eZdZddd��fd�
Zed��Zd�Zd�Z�fd�Zd	�Z	d
�Z
d�Z�xZS)�_SpecialGenericAliasTNr�c����|�|j}t�|�	|||��||_|jdk(rd|j
�d�|_yd|j�d|j
�d�|_y)Nr�r�zA generic version of r|)r�rHrr�r�r�r)rr��nparamsr�rerIs     �rwrz_SpecialGenericAlias.__init__�sv����<��?�?�D�
����d���6���
����
�*�2�6�3F�3F�2G�q�I�D�L�2�6�3D�3D�2E�Q�v�GZ�GZ�F[�[\�]�D�Lryc���t|t�s|f}d�t�fd�|D��}t|||j�|j	|�S)Nr�c3�6�K�|]}t|�����y�wr�r`ras  �rwr�z3_SpecialGenericAlias.__getitem__.<locals>.<genexpr>�������;�q�{�1�c�*�;�rb)rtr�r�r�r�rr�r�s  @rwrAz _SpecialGenericAlias.__getitem__�sH����&�%�(��Y�F�:���;�F�;�;���t�V�T�]�]�3��~�~�f�%�%ryc�\�t|j||j|j��Sr)r}r~rr��rr�s  rwrz_SpecialGenericAlias.copy_with�s$���T�_�_�f�"&�*�*�4�:�:�?�	?ryc� �d|jzSr$r&r's rwr(z_SpecialGenericAlias.__repr__�r)ryc����t|t�r t|j|j�St|t�st||j�St
�|�|�Sr�)rtrr�r~r}rHr>)rr�rIs  �rwr>z&_SpecialGenericAlias.__subclasscheck__�sN����c�/�0��c�n�n�d�o�o�>�>��#�}�-��c�4�?�?�3�3��w�(��-�-ryc��|jSr�r&r's rwr+z_SpecialGenericAlias.__reduce__�r,ryc��t||fSr�r0rs  rwr3z_SpecialGenericAlias.__or__�r4ryc��t||fSr�r0rs  rwr6z_SpecialGenericAlias.__ror__�rry)
r�r�r�rr�rArr(r>r+r3r6rKrLs@rwrr�s@���04�4�^��&��&�?�&�.��"�!ryrc�0��eZdZddd��fd�
Z�fd�Z�xZS)�_DeprecatedGenericAliasTNr�c�:��t�|�||||��||_y)Nr�)rHr�_removal_version)rr�r �removal_versionr�rerIs      �rwrz _DeprecatedGenericAlias.__init__�s#���	�����t�$��?� /��ryc���ddl}|j|j�d|j��|j��t
�|�|�S)Nrr|)r�)�warnings�_deprecatedr�rr/rHr:)rr�r2rIs   �rwr:z)_DeprecatedGenericAlias.__instancecheck__�sG������������q�����-�d�6K�6K�	
��w�(��.�.ry)r�r�r�rr:rKrLs@rwr-r-�s���8<�4�0�/�/ryr-c�$��eZdZ�fd�Zd�Z�xZS)�_CallableGenericAliasc	���|jdk(sJ�|j}t|�dk(rt|d�rt�|��Sddj
|ddD�cgc]
}t|���c}��dt|d��d�Scc}w)	Nrr�rztyping.Callable[[r�r�z], r�)rr�r�r�rHr(r�r�)rr�r�rIs   �rwr(z_CallableGenericAlias.__repr__�s�����z�z�Z�'�'�'��}�}���t�9��>�n�T�!�W�5��7�#�%�%���Y�Y�t�C�R�y�A�!�
�1�
�A�B�C�3��d�2�h�'�(��+�	,��As�B
c��|j}t|�dk(rt|d�st|dd�|df}tj
t|ffS)Nr�rr�)r�r�r�r�rrrrs  rwr+z _CallableGenericAlias.__reduce__�sO���}�}���D�	�Q��>�$�q�'�#:���S�b�	�?�D��H�,�D����(�D�!1�1�1ry)r�r�r�r(r+rKrLs@rwr5r5�s
���,�2ryr5c�(�eZdZd�Zd�Zed��Zy)�
_CallableTypec�\�t|j||j|j��Sr)r5r~rr�r&s  rwrz_CallableType.copy_with�s&��$�T�_�_�f�*.�*�*�4�:�:�G�	Gryc���t|t�rt|�dk7rtd��|\}}t|t�rt|�|f}n||f}|j|�S)Nr�z6Callable must be used as Callable[[arg, ...], result].)rtr�r�rr��__getitem_inner__)rr�r�r�s    rwrAz_CallableType.__getitem__�sf���&�%�(�C��K�1�,<��<�=�
=����f��d�D�!��D�k�6�*�F��F�^�F��%�%�f�-�-ryc���|\}}d}t||�}|tur|jt|f�St	|t
�s|f}td�|D��}||fz}|j|�S)Nz.Callable[args, result]: result must be a type.c3�2K�|]}t|����y�wr�r�r�s  rwr�z2_CallableType.__getitem_inner__.<locals>.<genexpr>s����8�C�]�3�'�8�r�)r��Ellipsisrrrtr�)rr�r�r�r�s     rwr<z_CallableType.__getitem_inner__�st�����f�>���V�S�)���8���>�>�?�F�";�<�<��$��&��7�D��8�4�8�8����	�!���~�~�f�%�%ryN)r�r�r�rrAr�r<r�ryrwr9r9�s!��G�.��
&��
&ryr9c��eZdZed��Zy)�
_TupleTypec���t|t�s|f}t|�dk\r:|ddur3d�t�fd�|ddD��}|jg|�t���Sd�t�fd�|D��}|j|�S)Nr�r�.z Tuple[t, ...]: t must be a type.c3�6�K�|]}t|�����y�wr�r`ras  �rwr�z)_TupleType.__getitem__.<locals>.<genexpr>s�����D�1�;�q�#�.�D�rbz*Tuple[t0, t1, ...]: each t must be a type.c3�6�K�|]}t|�����y�wr�r`ras  �rwr�z)_TupleType.__getitem__.<locals>.<genexpr>r#rb)rtr�r�rrr$s  @rwrAz_TupleType.__getitem__s�����&�%�(��Y�F��v�;�!���r�
�c� 1�4�C��D��s���D�D�F��>�>�"<�F�"<�O�"<�=�=�:���;�F�;�;���~�~�f�%�%ryN)r�r�r�r�rAr�ryrwrArAs���	&��	&ryrAc�F��eZdZd�Zd�Zd�Z�fd�Zd�Zd�Z�fd�Z	�xZ
S)r�c��t|Sr�r0r&s  rwrz_UnionGenericAlias.copy_withs���V�}�ryc��t|ttjf�stS	t|j�t|j�k(S#t$r#t|j|j�cYSwxYwr�)	rtr�r�r�r�r�r�rr�r1s  rwr�z_UnionGenericAlias.__eq__se���%�"4�e�o�o�!F�G�!�!�	J��t�}�}�%��U�^�^�)<�<�<���	J�*�4�=�=�%�.�.�I�I�	J�s�*A�)A?�>A?c�>�tt|j��Sr�)r��	frozensetr�r's rwr�z_UnionGenericAlias.__hash__%s���I�d�m�m�,�-�-ryc����|j}t|�dk(rD|dtd�urdt|d��d�S|dtd�urdt|d��d�St�|��S)Nr�rztyping.Optional[rcr�)r�r�rsr�rHr(�rr�rIs  �rwr(z_UnionGenericAlias.__repr__(sw����}�}���t�9��>��A�w�$�t�*�$�)�*�T�!�W�*=�)>�a�@�@��a��D��J�&�)�*�T�!�W�*=�)>�a�@�@��w��!�!ryc�6�|jt|��Sr�r�r9s  rwr:z$_UnionGenericAlias.__instancecheck__1r�ryc�B�|jD]}t||�s�yy)NT)r�r�)rr�rvs   rwr>z$_UnionGenericAlias.__subclasscheck__4s"���=�=�	�C��#�s�#��	ryc�@��t�|��\}\}}|t|ffSr�)rHr+r)rr�r�r�rIs    �rwr+z_UnionGenericAlias.__reduce__9s(���$�w�1�3���n�v�t��e�T�]�"�"ry)r�r�r�rr�r�r(r:r>r+rKrLs@rwr�r�s,����J�.�"�1��
#�#ryr�c��d�|D�S)Nc3�6K�|]}|t|�f���y�wr�)rsr�s  rwr�z'_value_and_type_iter.<locals>.<genexpr>?s����-�Q�Q��Q��L�-�s�r�)r�s rwroro>s
��-�*�-�-ryc��eZdZd�Zd�Zy)r�c��t|t�stStt	|j
��tt	|j
��k(Sr�)rtr�r�r�ror�r1s  rwr�z_LiteralGenericAlias.__eq__Cs?���%�!5�6�!�!��'��
�
�6�7�3�?S�TY�Tb�Tb�?c�;d�d�dryc�P�ttt|j���Sr�)r�rIror�r's rwr�z_LiteralGenericAlias.__hash__Is���I�2�4�=�=�A�B�C�CryN)r�r�r�r�r�r�ryrwr�r�Bs��e�Dryr�c���eZdZ�fd�Z�xZS)r�c����t|dttf�r
g|dd�|d��St|dt�rg|dd�|dj��}t
�|�|�S)Nr�)rtr�r�r�r�rHr)rr�rIs  �rwrz"_ConcatenateGenericAlias.copy_withNsm����f�R�j�4��-�0�.�V�C�R�[�.�6�"�:�.�.��f�R�j�":�;�9�v�c�r�{�9�V�B�Z�%8�%8�9�F��w� ��(�(ry)r�r�r�rrKrLs@rwr�r�Ms
���)�)ryr�c�<�t||�d��}t||f��S)a�Type unpack operator.

    The type unpack operator takes the child types from some container type,
    such as `tuple[int, str]` or a `TypeVarTuple`, and 'pulls them out'.

    For example::

        # For some generic class `Foo`:
        Foo[Unpack[tuple[int, str]]]  # Equivalent to Foo[int, str]

        Ts = TypeVarTuple('Ts')
        # Specifies that `Bar` is generic in an arbitrary number of types.
        # (Think of `Ts` as a tuple of an arbitrary number of individual
        #  `TypeVar`s, which the `Unpack` is 'pulling out' directly into the
        #  `Generic[]`.)
        class Bar(Generic[Unpack[Ts]]): ...
        Bar[int]  # Valid
        Bar[int, str]  # Also valid

    From Python 3.11, this can also be done using the `*` operator::

        Foo[*tuple[int, str]]
        class Bar(Generic[*Ts]): ...

    And from Python 3.12, it can be done using built-in syntax for generics::

        Foo[*tuple[int, str]]
        class Bar[*Ts]: ...

    The operator can also be used along with a `TypedDict` to annotate
    `**kwargs` in a function signature::

        class Movie(TypedDict):
            name: str
            year: int

        # This function expects two keyword arguments - *name* of type `str` and
        # *year* of type `int`.
        def foo(**kwargs: Unpack[Movie]): ...

    Note that there is only some runtime checking of this operator. Not
    everything the runtime allows may be accepted by static type checkers.

    For more information, see PEPs 646 and 692.
    rY)r�r�)r��_UnpackGenericAliasr[s   rwrmrmVs(��^�z�d�V�+E�#F�G�D��d�$��9�9ryc�D��eZdZd�Z�fd�Zed��Zed��Z�xZS)rWc�:�dt|jd��d�S)Nztyping.Unpack[rr�)r�r�r's rwr(z_UnpackGenericAlias.__repr__�s"�� �
�4�=�=��+;� <�=�Q�?�?ryc�>��|jr|St�|�	|�Sr�)r�rHrArKs  �rwrAz_UnpackGenericAlias.__getitem__�s!����3�3��K��w�"�4�(�(ryc���|jtusJ�t|j�dk(sJ�|j\}t	|t
�r |jtusJ�|jSyr�)r~rmr�r�rtr}r�r�s  rwr�z2_UnpackGenericAlias.__typing_unpacked_tuple_args__�s_�����&�(�(�(��4�=�=�!�Q�&�&�&��}�}����c�=�)��>�>�U�*�*�*��<�<��ryc��|jtusJ�t|j�dk(sJ�t	|jdt
�Sr)r~rmr�r�rtr
r's rwr�z7_UnpackGenericAlias.__typing_is_unpacked_typevartuple__�sA�����&�(�(�(��4�=�=�!�Q�&�&�&��$�-�-��*�L�9�9ry)	r�r�r�r(rA�propertyr�r�rKrLs@rwrWrW�s6���@�
)�
�����:��:ryrWc��eZdZdZy)rz(Internal placeholder for ... (ellipsis).N)r�r�r�rr�ryrwrr�s��2ryr>�_is_protocolr�r�r��__type_params__�__protocol_attrs__�_is_runtime_protocol�__non_callable_proto_members__>rrOr�rrr�r	�__annotations__�__subclasshook__�__class_getitem__�__abstractmethods__�_MutableMapping__markerc��t�}|jddD]`}|jdvr�t|di�}g|j�|��D].}|jd�r�|tvs�|j|��0�b|S)z�Collect protocol members from a protocol class objects.

    This includes names actually defined in the class dictionary, as well
    as names that appear in annotations. Special names (above) are skipped.
    Nr�>rrrd�_abc_)r��__mro__r�r�r�r��EXCLUDED_ATTRIBUTES�add)r��attrsr��annotationsr�s     rw�_get_protocol_attrsrp�s���
�E�E����C�R� � ���=�=�3�3���d�$5�r�:��2�d�m�m�2�k�2�	 �D��?�?�7�+��<O�0O��	�	�$��	 �	 ��Lryc�H�t|�}|jrtd��|jtury|j
D]3}|jjdt�}|tus�,||_ntj|_|j|g|��i|��y)Nz Protocols cannot be instantiatedr)	rsr_rr�_no_init_or_replace_initrkr�r��object)rr�rQr�r��inits      rwrrrr�s���
�t�*�C�
����:�;�;��|�|�3�3�����'���}�}� � ��-E�F���/�/��C�L��	'�������C�L�L��'��'��'ryrcc���	tj|dz�xs|S#t$rYnwxYw	tj|dz�jjd|�S#ttf$rYywxYw)Nrcr�)r��_getframemodulenamer�	_getframe�	f_globalsr�r�)�depth�defaults  rw�_callerr{�sx��
��&�&�u�q�y�1�<�W�<���
��
��
��}�}�U�Q�Y�'�1�1�5�5�j�'�J�J���J�'�
���
�s��	*�*�1A � A2�1A2r�c��t|�dvS)z�Allow instance and class checks for special stdlib modules.

    The abc and functools modules indiscriminately call isinstance() and
    issubclass() on the whole MRO of a user class, which may contain protocols.
    >Nr�r�)r{)rys rw�_allow_reckless_class_checksr}�s���5�>�7�7�7ry)rr0r%r&r2r#r.r!r4r7�Buffer�AbstractContextManager�AbstractAsyncContextManager)zcollections.abc�
contextlibc��ddlm}|S)Nr��getattr_static)�inspectr�r�s rw�_lazy_load_getattr_staticr�s
��'��ryc�(�t|jffSr�)rr~)�psargss rw�_pickle_psargsr�s���6�,�,�.�.�.ryc�(�t|jffSr�)rr~)�pskwargss rw�_pickle_pskwargsr�s���X�0�0�2�2�2ryc�<��eZdZ�fd�Z�fd�Z�fd�Z�fd�Z�xZS)�
_ProtocolMetac�6��|dk(r|tfk(rnvt|vrn|D]i}|tthvr�|jtj|jg�vr�?t|t�rt|dd�r�]td|����t�|�,||||fi|��S)Nrr_Fz5Protocols can only inherit from other protocols, got )rrrsr��_PROTO_ALLOWLISTr�r�r�r�rrHrO)�mclsrer!�	namespacerQr�rIs      �rwrOz_ProtocolMeta.__new__s�����:��%�G�:�"5��
��
��
���V�W�-�-��}�}�(8�(<�(<�T�_�_�b�(Q�Q�"�4��1�#�D�.�%�@�$��#�h�(���
��w��t�T�5�)�F�v�F�Fryc�`��t�|�|i|��t|dd�rt|�|_yy)Nr_F)rHrr�rprarPs   �rwrz_ProtocolMeta.__init__1s3���
���$�)�&�)��3���.�%8��%=�C�"�/ryc�b��|turtj||�St|dd�rut	�skt|t�st
d��t|dd�st
d��|jr,|jjd�turt
d��t�|�	|�S)Nr_Fz"issubclass() arg 1 must be a classrb�LInstance and class checks can only be used with @runtime_checkable protocolsrez<Protocols with non-method members don't support issubclass())rrsr>r�r}rtrrcr�r��_proto_hookrH)r�r2rIs  �rwr>z_ProtocolMeta.__subclasscheck__6s�����(�?��)�)�#�u�5�5��C���/�0�2��e�T�*�� D�E�E��3� 6��>��3����2�2��L�L�$�$�%7�8�K�G��R����w�(��/�/ryc�n��|turtj||�St|dd�st�|�	|�St|dd�st�st
d��t�|�	|�ryt�}|jD]}	|||�}|��||jvs�yy#t$rYywxYw)Nr_Frbr�T)rrsr:r�rHr}rr�rarrc)r��instancer�r�r�rIs     �rwr:z_ProtocolMeta.__instancecheck__Os�����(�?��)�)�#�x�8�8��s�N�E�2��7�,�X�6�6���3�U�;�,�.��<�=�
=��7�$�X�.��2�4���*�*�		�D�
�$�X�t�4���{�t�3�+M�+M�M���		���
"�
���
�s�	B'�'	B4�3B4)r�r�r�rOrr>r:rKrLs@rwr�r�s���G�&>�
0�2�ryr�c��|jjdd�stS|jD]�}|jD]�}||jvr|j|�
tccS�;t|di�}t
|tjj�s�^||vs�ct|t�s�tt|dd�s����tcSy)Nr_FrdT)r�r�r�rarkr�rtr�r�r(r�r)r�r2r�r�ros     rwr�r�qs����<�<���N�E�2����&�&�"���M�M�	"�D��t�}�}�$��=�=��&�.�)�)��"�$�(9�2�>�K��;����(?�(?�@��K�'��u�g�.�7�5�.�RW�3X��	"�"�!�"� ryc�.��eZdZdZdZdZdZ�fd�Z�xZS)ra_Base class for protocol classes.

    Protocol classes are defined as::

        class Proto(Protocol):
            def meth(self) -> int:
                ...

    Such classes are primarily used with static type checkers that recognize
    structural subtyping (static duck-typing).

    For example::

        class C:
            def meth(self) -> int:
                return 0

        def func(x: Proto) -> int:
            return x.meth()

        func(C())  # Passes static type check

    See PEP 544 for details. Protocol classes decorated with
    @typing.runtime_checkable act as simple-minded runtime protocols that check
    only the presence of given attributes, ignoring their type signatures.
    Protocol classes can be generic, they are defined as::

        class GenProto[T](Protocol):
            def meth(self) -> T:
                ...
    r�TFc�:��t�|�|i|��|jjdd�s!t	d�|j
D��|_d|jvrt|_|jr)|jtjurt|_	yyy)Nr_Fc3�,K�|]}|tu���y�wr��r�r�r�s  rwr�z-Protocol.__init_subclass__.<locals>.<genexpr>�s����"H�Q�1��=�"H�s�re)rHr
r�r��anyr�r_r�rerrrrrPs   �rwr
zProtocol.__init_subclass__�s����
��!�4�2�6�2��|�|�����6�"�"H�#�-�-�"H�H�C���S�\�\�1�#.�C� ��������0A�0A� A�3�C�L�!B�ry)	r�r�r�rrr_rbr
rKrLs@rwrr�s%����@�I��L� ��
4�
4ryrc�P��eZdZdZ�fd�Zd�Zd�Zd�Zd�Zd�Z	�fd�Z
d	�Z�xZS)
�_AnnotatedAliasa�Runtime representation of an annotated type.

    At its core 'Annotated[t, dec1, dec2, ...]' is an alias for the type 't'
    with extra annotations. The alias behaves like a normal typing alias.
    Instantiating is the same as instantiating the underlying type; binding
    it to types is also the same.

    The metadata itself is stored in a '__metadata__' attribute as a tuple.
    c���t|t�r|j|z}|j}t�|�||d��||_y)Nrrd)rtr��__metadata__r~rHr)rr��metadatarIs   �rwrz_AnnotatedAlias.__init__�sD����f�o�.��*�*�X�5�H��&�&�F�
�����k��:�$��ryc�X�t|�dk(sJ�|d}t||j�Sr)r�r�r�)rr��new_types   rwrz_AnnotatedAlias.copy_with�s0���6�{�a�����!�9���x��):�):�;�;ryc��djt|j�djd�|jD���S)Nztyping.Annotated[{}, {}]r�c3�2K�|]}t|����y�wr�)r�r�s  rwr�z+_AnnotatedAlias.__repr__.<locals>.<genexpr>�s����9�!�d�1�g�9�r�)�formatr�r~r�r�r's rwr(z_AnnotatedAlias.__repr__�s9��)�0�0��t���'��I�I�9�t�'8�'8�9�9�
�	
ryc�b�tjt|jf|jzffSr�)rrrr~r�r's rwr+z_AnnotatedAlias.__reduce__�s1���������)�D�,=�,=�=�"
�
�	
ryc��t|t�stS|j|jk(xr|j|jk(Sr�)rtr�r�r~r�r1s  rwr�z_AnnotatedAlias.__eq__�sB���%��1�!�!����5�#3�#3�3�<��%�%��);�);�;�	=ryc�D�t|j|jf�Sr�)r�r~r�r's rwr�z_AnnotatedAlias.__hash__�s���T�_�_�d�&7�&7�8�9�9ryc�,��|dvryt�|�|�S)N>r�r�r)rHrr�s  �rwrz_AnnotatedAlias.__getattr__�s����/�/���w�"�4�(�(ryc��|jfSr�)r~r s  rwr"z_AnnotatedAlias.__mro_entries__�s�����!�!ry)
r�r�r�rrrr(r+r�r�rr"rKrLs@rwr�r��s0����%�<�

�
�
=�:�)�
"ryr�c�D�eZdZdZdZd�Zd�Zed��d��Zd�Z	y	)
ra+Add context-specific metadata to a type.

    Example: Annotated[int, runtime_check.Unsigned] indicates to the
    hypothetical runtime_check module that this type is an unsigned int.
    Every other consumer of this type can ignore this metadata and treat
    this type as int.

    The first argument to Annotated must be a valid type.

    Details:

    - It's an error to call `Annotated` with less than two arguments.
    - Access the metadata via the ``__metadata__`` attribute::

        assert Annotated[int, '$'].__metadata__ == ('$',)

    - Nested Annotated types are flattened::

        assert Annotated[Annotated[T, Ann1, Ann2], Ann3] == Annotated[T, Ann1, Ann2, Ann3]

    - Instantiating an annotated type is equivalent to instantiating the
    underlying type::

        assert Annotated[C, Ann1](5) == C(5)

    - Annotated can be used as a generic type alias::

        type Optimized[T] = Annotated[T, runtime.Optimize()]
        # type checker will treat Optimized[int]
        # as equivalent to Annotated[int, runtime.Optimize()]

        type OptimizedList[T] = Annotated[list[T], runtime.Optimize()]
        # type checker will treat OptimizedList[int]
        # as equivalent to Annotated[list[int], runtime.Optimize()]

    - Annotated cannot be used with an unpacked TypeVarTuple::

        type Variadic[*Ts] = Annotated[*Ts, Ann1]  # NOT valid

      This would be equivalent to::

        Annotated[T1, T2, T3, ..., Ann1]

      where T1, T2 etc. are TypeVars, which would be invalid, because
      only one type should be passed to Annotated.
    r�c��td��)Nz&Type Annotated cannot be instantiated.r�r�r�rQs   rwrOzAnnotated.__new__$s���@�A�Aryc�N�t|t�s|f}|j|g|���Sr�)rtr��_class_getitem_inner)r�r�s  rwrfzAnnotated.__class_getitem__'s+���&�%�(��Y�F�'�s�'�'��5�f�5�5ryTr�c��t|�dkrtd��t|d�rtd��d}t|d|d��}t	|dd�}t||�S)	Nr�zUAnnotated[...] should be used with at least two arguments (a type and an annotation).rz?Annotated[...] should not be used with an unpacked TypeVarTuplez$Annotated[t, ...]: t must be a type.Trnrc)r�rr�r�r�r�)r�r�r�r�r�s     rwr�zAnnotated._class_getitem_inner,ss���v�;��?��+�,�
,�%�V�A�Y�/��4�5�
5�4���V�A�Y���F�������$���v�x�0�0ryc�J�tdj|j���)NzCannot subclass {}.Annotated)rr�r�r�s   rwr
zAnnotated.__init_subclass__:s!���*�1�1�#�.�.�A�
�	
ryN)
r�r�r�rrrOrfr�r�r
r�ryrwrr�s8��-�^�I�B�6�
�T��1��1�
ryrc�V�t|t�r
t|dd�std|z��d|_t�|_|jD]7}	tt||d��}|r�|jj|��9|S#t$r}td|�d��|�d}~wwxYw)a:Mark a protocol class as a runtime protocol.

    Such protocol can be used with isinstance() and issubclass().
    Raise TypeError if applied to a non-protocol class.
    This allows a simple-minded structural check very similar to
    one trick ponies in collections.abc such as Iterable.

    For example::

        @runtime_checkable
        class Closable(Protocol):
            def close(self): ...

        assert isinstance(open('/some/file'), Closable)

    Warning: this will check only the presence of the required methods,
    not their type signatures!
    r_FzB@runtime_checkable can be only applied to protocol classes, got %rTNz,Failed to determine whether protocol member z is a method member)r�rr�rrbr�rcra�callablermr�)r�r��is_callable�es    rwrgrg@s���&�c�7�#�7�3���+N��"�$'�(�)�	)�#�C��
*-��C�&��&�&�
=��		=�"�7�3��d�#;�<�K���2�2�6�6�t�<�
=��J���	��>�t�h�G%�%���
��	�s�B
�
	B(�B#�#B(c��|S)z�Cast a value to a type.

    This returns the value unchanged.  To the type checker this
    signals that the return value has the designated type, but at
    runtime we intentionally don't check anything (we want this
    to be as fast as possible).
    r�)r�r�s  rwrSrSjs	���Jryc��|S)a�Ask a static type checker to confirm that the value is of the given type.

    At runtime this does nothing: it returns the first argument unchanged with no
    checks or side effects, no matter the actual type of the argument.

    When a static type checker encounters a call to assert_type(), it
    emits an error if the value is not of the specified type::

        def greet(name: str) -> None:
            assert_type(name, str)  # OK
            assert_type(name, int)  # type checker error
    r�)r�r�s  rwrQrQus	���Jryc�T�t|dd�riSt|t��r4i}t|j�D]�}|�6tt
jj|jd�di�}n|}|jjdi�}t|tj�ri}|�tt|��n|}|�|�||}}|j�D]B\}	}
|
�td�}
t|
t�rt!|
dd��}
t#|
||�}
|
||	<�D��|r|S|j�D��cic]\}}|t%|���c}}S|�`t|tj&�r
|j}n4|}
t)|
d�r|
j*}
t)|
d�r�t|
d	i�}|�|}n|�|}t|dd�}|�,t|t,�riSt/d
j1|���t|�}|j�D]Y\}	}
|
�td�}
t|
t�r't!|
t|tj&�d��}
t#|
||�||	<�[|r|S|j�D��cic]\}}|t%|���c}}Scc}}wcc}}w)a
Return type hints for an object.

    This is often the same as obj.__annotations__, but it handles
    forward references encoded as string literals and recursively replaces all
    'Annotated[T, ...]' with 'T' (unless 'include_extras=True').

    The argument may be a module, class, method, or function. The annotations
    are returned as a dictionary. For classes, annotations include also
    inherited members.

    TypeError is raised if the argument is not of a type that can contain
    annotations, and an empty dictionary is returned if no annotations are
    present.

    BEWARE -- the behavior of globalns and localns is counterintuitive
    (unless you are familiar with how eval() and exec() work).  The
    search order is locals first, then globals.

    - If no dict arguments are passed, an attempt is made to use the
      globals from obj (or the respective module's globals for classes),
      and these are also used as the locals.  If the object does not appear
      to have globals, an empty dictionary is used.  For classes, the search
      order is globals first then locals.

    - If one dict argument is passed, it is used for both globals and
      locals.

    - If two dict arguments are passed, they specify globals and
      locals, respectively.
    �__no_type_check__Nr�rdFT)r�rr�__wrapped__�__globals__z1{!r} is not a module, class, method, or function.)r�rtrs�reversedrkr�r�r�r�r�r��GetSetDescriptorTyper��vars�itemsrurr��_strip_annotations�
ModuleTyper�r��_allowed_typesrr�)r�r�r��include_extras�hintsr��base_globals�ann�base_localsre�valuer�r��nsobjs              rwrZrZ�s���>�s�'��.��	��#�t�����S�[�[�)�	$�D���&�s�{�{���t����'M�z�[]�^��'���-�-�#�#�$5�r�:�C��#�u�9�9�:���.5�o�$�t�D�z�*�7�K���8�#3�-8��k��"�y�y�{�
$���e��=� ��J�E��e�S�)�&�u�%�$�O�E�"�5�,��D��#��d��

$�#	$�0'�u�`�RW�R]�R]�R_�,`�$�!�Q�Q�0B�1�0E�-E�,`�`����c�5�+�+�,��|�|�H��E��%��/��)�)���%��/��u�m�R�8�H��?��G�	�����C�*�D�1�E��}��c�>�*��I��+�+1�6�#�;�8�
8���K�E��{�{�}�;���e��=���J�E��e�S�!��� *�3��0@�0@� A�A���E�
!���'�:��d��;�#�5�\�e�k�k�m�(\�d�a���,>�q�,A�)A�(\�\��I-a��H)]s�;J�J$c���t|t�rt|j�St	|d�r0|jt
tfvrt|jd�St|t�r>td�|jD��}||jk(r|S|j|�St|t�rCtd�|jD��}||jk(r|St|j|�St|tj�rQtd�|jD��}||jk(r|Stjt j"|�S|S)z(Strip the annotations from a given type.r~rc3�2K�|]}t|����y�wr��r�r�s  rwr�z%_strip_annotations.<locals>.<genexpr>������H��0��3�H�r�c3�2K�|]}t|����y�wr�r�r�s  rwr�z%_strip_annotations.<locals>.<genexpr>�r�r�c3�2K�|]}t|����y�wr�r�r�s  rwr�z%_strip_annotations.<locals>.<genexpr>�r�r�)rtr�r�r~r�rerbr�r}r�rr	r�r�r�rrr)r��
stripped_argss  rwr�r��s���!�_�%�!�!�,�,�/�/��q�,��A�L�L�X�{�4K�$K�!�!�*�*�Q�-�0�0��!�]�#��H�Q�Z�Z�H�H�
��A�J�J�&��H��{�{�=�)�)��!�\�"��H�Q�Z�Z�H�H�
��A�J�J�&��H��A�L�L�-�8�8��!�U�_�_�%��H�Q�Z�Z�H�H�
��A�J�J�&��H�������m�<�<��Hryc��t|t�rtSt|ttt
tf�r|jS|turtSt|tj�rtjSy)a�Get the unsubscripted version of a type.

    This supports generic types, Callable, Tuple, Union, Literal, Final, ClassVar,
    Annotated, and others. Return None for unsupported types.

    Examples::

        >>> P = ParamSpec('P')
        >>> assert get_origin(Literal[42]) is Literal
        >>> assert get_origin(int) is None
        >>> assert get_origin(ClassVar[int]) is ClassVar
        >>> assert get_origin(Generic) is Generic
        >>> assert get_origin(Generic[T]) is Generic
        >>> assert get_origin(Union[T, int]) is Union
        >>> assert get_origin(List[Tuple[T, T]][int]) is list
        >>> assert get_origin(P.args) is P
    N)rtr�rr�r	rrr~rr�r���tps rwrXrX	s^��$�"�o�&����"�(�,�$�o�7�8��}�}��	�W�}����"�e�o�o�&�����ryc�*�t|t�r|jf|jzSt|tt
f�r-|j}t||�rt|dd�|df}|St|tj�r|jSy)a�Get type arguments with all substitutions performed.

    For unions, basic simplifications used by Union constructor are performed.

    Examples::

        >>> T = TypeVar('T')
        >>> assert get_args(Dict[str, int]) == (str, int)
        >>> assert get_args(int) == ()
        >>> assert get_args(Union[int, Union[T, int], str][int]) == (int, str)
        >>> assert get_args(Union[int, Tuple[T, int]][str]) == (int, Tuple[str, int])
        >>> assert get_args(Callable[[], T][int]) == ([], int)
    Nr�r�)rtr�r~r�r}r	r�r�r�r�r�)r�r�s  rwrWrW$	s~���"�o�&��
�
��"�/�/�1�1��"�}�l�3�4��k�k��*�2�s�3���C�R��>�3�r�7�+�C��
��"�e�o�o�&��{�{��
ryc�"�t|t�S)a+Check if an annotation is a TypedDict class.

    For example::

        >>> from typing import TypedDict
        >>> class Film(TypedDict):
        ...     title: str
        ...     year: int
        ...
        >>> is_typeddict(Film)
        True
        >>> is_typeddict(dict)
        False
    )rtr�r�s rwr[r[>	s���b�.�)�)ry�drvc�p�t|�}t|�tkDr|dtdz}td|����)a�Statically assert that a line of code is unreachable.

    Example::

        def int_or_str(arg: int | str) -> None:
            match arg:
                case int():
                    print("It's an int")
                case str():
                    print("It's a str")
                case _:
                    assert_never(arg)

    If a type checker finds that a call to assert_never() is
    reachable, it will emit an error.

    At runtime, this throws an exception when called.
    Nr�z*Expected code to be unreachable, but got: )r�r��_ASSERT_NEVER_REPR_MAX_LENGTH�AssertionError)rvr�s  rwrRrRS	s@��&
��I�E�
�5�z�1�1��4�4�5��=��
�E�e�W�M�
N�Nryc��t|t�r�t|�D]�}t||�}t	|d�rB|j
|j
�d|j��k7st|dd�|jk7r�^t|tj�rd|_
t|tj�rd|j_
t|t�s��t|���	d|_
|S#t$rY|SwxYw)aIDecorator to indicate that annotations are not type hints.

    The argument must be a class or function; if it is a class, it
    applies recursively to all methods and classes defined in that class
    (but not to methods defined in its superclasses or subclasses).

    This mutates the function(s) or class(es) in place.
    r�r|r�NT)rtrsr�r�r�r�r�r�r�r�r��
MethodType�__func__r_r)rv�keyr�s   rwr_r_l	s����#�t���s�8�	#�C��#�s�#�C��C��0��#�#�#�*:�*:�);�1�S�\�\�N�'K�K��3��d�3�s�~�~�E�
��#�u�1�1�2�(,��%��#�u�/�/�0�15����.��#�t�$��c�"�%	#�&
� $����J���
���J�
�s�%C.�.	C;�:C;c�B��tj���fd��}|S)z�Decorator to give another decorator the @no_type_check effect.

    This wraps the decorator with something that wraps the decorated
    function in @no_type_check.
    c�.���|i|��}t|�}|Sr�)r_)r�r�r�r�s   �rw�wrapped_decoratorz2no_type_check_decorator.<locals>.wrapped_decorator�	s!����$�'�$�'���T�"���ry)r�r�)r�r�s` rwr`r`�	s(����_�_�Y��� ��
�ryc��td��)z*Helper for @overload to raise when called.z�You should not call an overloaded function. A series of @overload-decorated functions outside a stub module should always be followed by an implementation that is not @overload-ed.)�NotImplementedError)r�r�s  rw�_overload_dummyr��	s��
�	9�:�:ryc��t|d|�}	|t|j|j|jj
<tS#t$rYtSwxYw)a�Decorator for overloaded functions/methods.

    In a stub file, place two or more stub definitions for the same
    function in a row, each decorated with @overload.

    For example::

        @overload
        def utf8(value: None) -> None: ...
        @overload
        def utf8(value: bytes) -> bytes: ...
        @overload
        def utf8(value: str) -> bytes: ...

    In a non-stub file (i.e. a regular .py file), do the same but
    follow it with an implementation.  The implementation should *not*
    be decorated with @overload::

        @overload
        def utf8(value: None) -> None: ...
        @overload
        def utf8(value: bytes) -> bytes: ...
        @overload
        def utf8(value: str) -> bytes: ...
        def utf8(value):
            ...  # implementation goes here

    The overloads for a function can be retrieved at runtime using the
    get_overloads() function.
    r�)r��_overload_registryr�r��__code__�co_firstlinenorr�)r��fs  rwrcrc�	sa��@	��j�$�'�A�
�VZ��1�<�<�(����8����9R�9R�S�����
����
�s�7A�	A�Ac���t|d|�}|jtvrgSt|j}|j|vrgSt	||jj��S)z6Return all defined overloads for *func* as a sequence.r�)r�r�r�r�r��values)r�r��mod_dicts   rwrYrY�	s`��	��j�$�'�A��|�|�-�-��	�!�!�,�,�/�H��~�~�X�%��	������(�/�/�1�2�2ryc�,�tj�y)z$Clear all overloads in the registry.N)r��clearr�ryrwrTrT�	s�����ryc�B�	d|_|S#ttf$rY|SwxYw)a�Decorator to indicate final methods and final classes.

    Use this decorator to indicate to type checkers that the decorated
    method cannot be overridden, and decorated class cannot be subclassed.

    For example::

        class Base:
            @final
            def done(self) -> None:
                ...
        class Sub(Base):
            def done(self) -> None:  # Error reported by type checker
                ...

        @final
        class Leaf:
            ...
        class Other(Leaf):  # Error reported by type checker
            ...

    There is no runtime checking of these properties. The decorator
    attempts to set the ``__final__`` attribute to ``True`` on the decorated
    object to allow runtime introspection.
    T)�	__final__rr)r�s rwrVrV�	s5��4
����
�H��
�I�&�
�	
��H�
������T�KT�VT�T_co)�	covariant�V_co�VT_co�T_contra)�
contravariant�CT_co)r��boundrP�aDeprecated alias to collections.abc.Callable.

    Callable[[int], str] signifies a function that takes a single
    parameter of type int and returns a str.

    The subscription syntax must always be used with exactly two
    values: the argument list and the return type.
    The argument list must be a list of types, a ParamSpec,
    Concatenate or ellipsis. The return type must be a single type.

    There is no syntax to indicate optional or keyword arguments;
    such function types are rarely used as callback types.
    rrd)r�)r0r�rr�a]Deprecated alias to builtins.tuple.

    Tuple[X, Y] is the cross-product type of X and Y.

    Example: Tuple[T1, T2] is a tuple of two elements corresponding
    to type variables T1 and T2.  Tuple[int, float, str] is a tuple
    of an int, a float and a string.

    To specify a variable-length tuple of homogeneous type, use Tuple[T, ...].
    rDrArFrGr"r6rBrCra�Deprecated alias to builtins.type.

    builtins.type or typing.Type can be used to annotate class objects.
    For example, suppose we have the following classes::

        class User: ...  # Abstract base for User classes
        class BasicUser(User): ...
        class ProUser(User): ...
        class TeamUser(User): ...

    And a function that takes a class argument that's a subclass of
    User and returns an instance of the corresponding class::

        def new_user[U](user_class: Type[U]) -> U:
            user = user_class()
            # (Here we could write the user object to a database)
            return user

        joe = new_user(BasicUser)

    At this point the type checker knows that joe has type BasicUser.
    c�*�eZdZdZdZedefd��Zy)r=z(An ABC with one abstract method __int__.r�r�c��yr�r�r's rw�__int__zSupportsInt.__int__�
���ryN)r�r�r�rrr�intrr�ryrwr=r=|
s#��2��I��
��
��
ryr=c�*�eZdZdZdZedefd��Zy)r;z*An ABC with one abstract method __float__.r�r�c��yr�r�r's rw�	__float__zSupportsFloat.__float__�
rryN)r�r�r�rrr�floatr	r�ryrwr;r;�
�#��4��I��
�5�
��
ryr;c�*�eZdZdZdZedefd��Zy)r:z,An ABC with one abstract method __complex__.r�r�c��yr�r�r's rw�__complex__zSupportsComplex.__complex__�
rryN)r�r�r�rrr�complexrr�ryrwr:r:�
s#��6��I��
�W�
��
ryr:c�*�eZdZdZdZedefd��Zy)r9z*An ABC with one abstract method __bytes__.r�r�c��yr�r�r's rw�	__bytes__zSupportsBytes.__bytes__�
rryN)r�r�r�rrr�bytesrr�ryrwr9r9�
rryr9c�*�eZdZdZdZedefd��Zy)r<z*An ABC with one abstract method __index__.r�r�c��yr�r�r's rw�	__index__zSupportsIndex.__index__�
rryN)r�r�r�rrrrrr�ryrwr<r<�
s#��4��I��
�3�
��
ryr<c�>���d�x�f�G��fd�d��
}t|�S)r�c�4��eZdZW�ZdZdZedW�fd��Zy)r8zMAn ABC with one abstract method __abs__ that is covariant in its return type.r�r�c��yr�r�r's rw�__abs__zSupportsAbs.__abs__�
rryN)r�r�r�r`rrrr��.type_paramsr�s��rwr8r8�
s$���W��I��
��
��
ryr8r���
.generic_baserr�s @@rw�#<generic parameters of SupportsAbs>r�
s����
�
�X�
ryc�>���d�x�f�G��fd�d��
}t|�S)r�c�:��eZdZW�ZdZdZeddedW�fd��Zy)r>zOAn ABC with one abstract method __round__ that is covariant in its return type.r��ndigitsr�c��yr�r�)rr"s  rw�	__round__zSupportsRound.__round__�
rryN�r)	r�r�r�r`rrrrr$rs��rwr>r>�
s+���Y��I��
��
�Q�
��
ryr>r�rs @@rw�%<generic parameters of SupportsRound>r&�
s����
�
�x�
ryr�c���|D��cgc]\}}|��	}}}|D��cic]\}}|t|d|�d����}}}tj||||��}|x|_|j_|Scc}}wcc}}w)Nzfield z annotation must be a type��defaultsrq)r�r��
namedtuplerdrO)rer�rqr)�nr��fields�nm_tpls        rw�
_make_nmtupler.�
s���!�
"�D�A�q�a�
"�F�
"��
 ���A���A���s�*D�E�F�
F�
 �E�
 �
�
#�
#�D�&�-5�f�F�F�>C�C�F��V�^�^�;��M��
#��
 s
�A+�A1>
�_makerO�_asdict�_fields�_sourcer�_replacer�__getnewargs__�_field_defaults>r�r�rdc��eZdZd�Zy)�NamedTupleMetac���t|vsJ�|D]}|tus�|tus�td��td�|D��}|j	di�}g}|D]M}||vr|j|��|s�td|�dt
|�dkDrdnd�d	d
j|�����t||j�|D�cgc]}||��	c}|d��}	||	_
t|vrt}
t|
�|	_
|D]@}|tvrtd
|z��|t vs�"||	j"vs�1t%|	|||��Bt|vr|	j'�|	Scc}w)Nz3can only inherit from a NamedTuple type and Genericc3�<K�|]}|turtn|���y�wr�)�_NamedTupler�)r�r�s  rwr�z)NamedTupleMeta.__new__.<locals>.<genexpr>�
s����O��t�{�2�e��<�O���rdzNon-default namedtuple field z cannot follow default fieldrc�sr�� r�r�r(z&Cannot overwrite NamedTuple attribute )r:rrr�r�r�r�r�r.r�r�r��classmethodrf�_prohibitedr�_specialr1r�r
)r��typenamer!�nsr�r��
default_names�
field_namer+r-�
class_getitemr�s            rwrOzNamedTupleMeta.__new__�
s����e�#�#�#��	K�D��;�&�4�w�+>��I�K�K�	K��O��O�O�����(�"�-���
��	?�J��R���$�$�Z�0���"?�
�|�L>�*-�m�*<�q�*@�3�b�"I��#'�9�9�]�#;�"<�!>�?�?�		?��x������8E�(F�1��A��(F�&(��&6�8��!����e��2�M�'2�=�'A�F�$��	.�C��k�!�$�%M�PS�%S�T�T��H�$��F�N�N�)B����R��W�-�		.�
�e���$�$�&��
��)Gs�EN)r�r�r�rOr�ryrwr7r7�
s�� ryr7c��|�|j�}n
|rtd��t||t���}tf|_|S)a?Typed version of namedtuple.

    Usage::

        class Employee(NamedTuple):
            name: str
            id: int

    This is equivalent to::

        Employee = collections.namedtuple('Employee', ['name', 'id'])

    The resulting class has an extra __annotations__ attribute, giving a
    dict that maps field names to types.  (The field names are also in
    the _fields attribute, which is part of the namedtuple API.)
    An alternative equivalent functional syntax is also accepted::

        Employee = NamedTuple('Employee', [('name', str), ('id', int)])
    zIEither list of fields or keywords can be provided to NamedTuple, not both�rq)r�rr.r{rHr�)rAr,rQ�nts    rwrHrH�
sK��(�~������	��C�D�	D�	�x���	�	:�B�#�
�B��
�IryrHc�$�t|vsJ�tfSr�)rHr:�r!s rw�_namedtuple_mro_entriesrKs��������>�ryc�"�eZdZdd�ZeZd�ZeZy)r�c
��|D]'}t|�tus�|tus�td��t	d�|D��rtf}nd}tjt|g|�t��|�}t|d�s||_i}|jdi�}	d}
|	j�D��cic]\}}|t||
|j���� }	}}t�}
t�}|D]�}|j|jjdi��|jjdt��}|
|z}
||z}|jjd	t��}|
|z}
||z}��|j|	�|	j�D]�\}}t!|�}|t"urt%|�}|r|d
}t!|�}|t&urd}n
|t(urd}n|}|r#|
j+|�|j-|��s|j+|�|
j-|���|
j/|�sJd
|�d|
�d|����||_t3|
�|_t3|�|_t|d�s||_|Scc}}w)a7Create a new typed dict class object.

        This method is called when TypedDict is subclassed,
        or when TypedDict is instantiated. This way
        TypedDict supports all three syntax forms described in its docstring.
        Subclasses and instances of TypedDict return actual dictionaries.
        zHcannot inherit from both a TypedDict type and a non-TypedDict base classc3�<K�|]}t|t����y�wr�)r�rr�s  rwr�z)_TypedDictMeta.__new__.<locals>.<genexpr>3s����5�!�z�!�W�%�5�r;r�r�rdz?TypedDict('Name', {f0: t0, f1: t1, ...}); each t must be a typerG�__required_keys__�__optional_keys__rTFz,Required keys overlap with optional keys in z: required_keys=z, optional_keys=�	__total__)rsr�rrr�rOr�r�r�r�r�r�r�r��updater�rXrrWrerbrm�discard�
isdisjointrdrIrOrPrQ)r�rer!rB�totalr��generic_base�tp_dictro�own_annotationsr�r+r��
required_keys�
optional_keys�
base_required�
base_optional�annotation_key�annotation_type�annotation_origin�annotation_args�is_requireds                      rwrOz_TypedDictMeta.__new__&s����	B�D��D�z��/�D��4G��!A�B�B�	B�
�5�u�5�5�#�:�L��L��,�,�~�t�5J�|�5J�T�5J�B�O���w� 0�1�%*�G�"����&�&�!2�B�7��O��)�.�.�0�
���2�
�{�2�s�7�+=�+=�>�>�
��
���
���
��		+�D����t�}�}�0�0�1B�B�G�H� �M�M�-�-�.A�3�5�I�M��]�*�M��]�*�M� �M�M�-�-�.A�3�5�I�M��]�*�M��]�*�M�		+�	���?�+�/>�/D�/D�/F�	6�+�N�O� *�?� ;�� �I�-�"*�?�";��"�&5�a�&8�O�(2�?�(C�%� �H�,�"��"�k�1�#��#����!�!�.�1��%�%�n�5��!�!�.�1��%�%�n�5�)	6�,�'�'�
�6�	
�:�4�&�A���0�-�!1�
3�	
�6�#.���$-�m�$<��!�$-�m�$<��!��w��,� %�G�����e
s�*#Jc��td��)Nz4TypedDict does not support instance and class checksr)r�r2s  rwr>z _TypedDictMeta.__subclasscheck__vs���N�O�OryN)T)r�r�r�rOr�r.r>r:r�ryrwr�r�%s��L�\�H�P�*�ryr��rUc���|�|}n
|rtd��|rtjdtd��dt	|�i}t�}|�||d<t
|d||��}tf|_|S)	a*A simple typed namespace. At runtime it is equivalent to a plain dict.

    TypedDict creates a dictionary type such that a type checker will expect all
    instances to have a certain set of keys, where each key is
    associated with a value of a consistent type. This expectation
    is not checked at runtime.

    Usage::

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

    The type info can be accessed via the Point2D.__annotations__ dict, and
    the Point2D.__required_keys__ and Point2D.__optional_keys__ frozensets.
    TypedDict supports an additional equivalent form::

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

    By default, all keys must be present in a TypedDict. It is possible
    to override this by specifying totality::

        class Point2D(TypedDict, total=False):
            x: int
            y: int

    This means that a Point2D TypedDict can have any of the keys omitted. A type
    checker is only expected to support a literal False or True as the value of
    the total argument. True is the default, and makes all items defined in the
    class body be required.

    The Required and NotRequired special forms can also be used to mark
    individual keys as being required or not required::

        class Point2D(TypedDict):
            x: int               # the "x" key must always be present (Required is the default)
            y: NotRequired[int]  # the "y" key can be omitted

    See PEP 655 for more details on Required and NotRequired.
    z@TypedDict takes either a dict or keyword arguments, but not bothz�The kwargs-based syntax for TypedDict definitions is deprecated in Python 3.11, will be removed in Python 3.13, and may not be understood by third-party type checkers.r���
stacklevelrdr�r�rc)	rr2�warn�DeprecationWarningr�r{r�rIr�)rAr,rUrQrBrq�tds       rwrIrI}s���^�~���	��(�)�	)�
��
�
�
7�
��	
��T�&�\�	*�B�
�Y�F�
��!��<��	��"�b��	6�B�"��B��
�IryrIc��tfSr�)�
_TypedDictrJs rw�<lambda>rl�s��:�-�ryc�N�t||j�d��}t||f�S)a�Special typing construct to mark a TypedDict key as required.

    This is mainly useful for total=False TypedDicts.

    For example::

        class Movie(TypedDict, total=False):
            title: Required[str]
            year: int

        m = Movie(
            title='The Matrix',  # typechecker error if key is omitted
            year=1999,
        )

    There is no runtime checking that a required key is actually provided
    when instantiating a related TypedDict.
    � accepts only a single type.�r�rr}r[s   rwrere�s+��(�z�d�j�j�\�1M�#N�O�D����w�'�'ryc�N�t||j�d��}t||f�S)a7Special typing construct to mark a TypedDict key as potentially missing.

    For example::

        class Movie(TypedDict):
            title: str
            year: NotRequired[int]

        m = Movie(
            title='The Matrix',  # typechecker error if key is omitted
            year=1999,
        )
    rnror[s   rwrbrb�s+���z�d�j�j�\�1M�#N�O�D����w�'�'ryc�8�eZdZdZeZd�Zd�Zd�Zd�Z	d�Z
d�Zy)	r^a+NewType creates simple unique types with almost zero runtime overhead.

    NewType(name, tp) is considered a subtype of tp
    by static type checkers. At runtime, NewType(name, tp) returns
    a dummy callable that simply returns its argument.

    Usage::

        UserId = NewType('UserId', int)

        def name_by_id(user_id: UserId) -> str:
            ...

        UserId('user')          # Fails type check

        name_by_id(42)          # Fails type check
        name_by_id(UserId(42))  # OK

        num = UserId(5) + 1     # type: int
    c��||_d|vr|jd�d}||_||_t	�}|dk7r||_yy)Nr|r��typing)r��
rpartitionr��
__supertype__r{r�)rrer��def_mods    rwrzNewType.__init__sN�� ����$�;��?�?�3�'��+�D���
�����)���h��%�D�O�ryc�:��|j�G�fd�d�}|fS)Nc���eZdZ�fd�Zy)�&NewType.__mro_entries__.<locals>.Dummyc	�F��|j}td|�d|�d��d���)NzGCannot subclass an instance of NewType. Perhaps you were looking for: `z = NewType(r�z)`)r�r)r��
subclass_name�superclass_names  �rwr
z8NewType.__mro_entries__.<locals>.Dummy.__init_subclass__s:��� #���
���%��k�-�1B�"�_�DU�UW�Y��ryN)r�r�r�r
)r|s�rw�Dummyrys���
ryr}r�)rr!r}r|s   @rwr"zNewType.__mro_entries__s!����-�-��	�	��x�ryc�8�|j�d|j��S)Nr|)r�r�r's rwr(zNewType.__repr__$s���/�/�"�!�D�$5�$5�#6�7�7ryc��|jSr�)r�r's rwr+zNewType.__reduce__'s��� � � ryc��t||fSr�r0r1s  rwr3zNewType.__or__*r4ryc��t||fSr�r0r1s  rwr6zNewType.__ror__-r7ryN)r�r�r�rr
r.rr"r(r+r3r6r�ryrwr^r^�s,���*�H�&�
�8�!�"�"ryr^c��eZdZdZdZeedefd���Zeedefd���Z	ed!d��Z
eedefd���Zede
fd	��Zed!d
��Zedefd��Zed"de
defd
��Zedefd��Zed"de
defd��Zed"de
deefd��Zed#de
de
de
fd��Zedefd��Zede
fd��Zed$de
de
fd��Zedefd��Zedede
fd��Zedeeddfd��Zed%d��Zed!d ��Zy)&rLa�Generic base class for TextIO and BinaryIO.

    This is an abstract, generic version of the return of open().

    NOTE: This does not distinguish between the different possible
    classes (text vs. binary, read vs. write vs. read/write,
    append-only, unbuffered).  The TextIO and BinaryIO subclasses
    below capture the distinctions between text vs. binary, which is
    pervasive in the interface; however we currently do not offer a
    way to track the other distinctions in the type system.
    r�r�c��yr�r�r's rw�modezIO.modeH���	
ryc��yr�r�r's rwrezIO.nameMr�ryNc��yr�r�r's rw�closezIO.closeRrryc��yr�r�r's rw�closedz	IO.closedVr�ryc��yr�r�r's rw�filenoz	IO.fileno[rryc��yr�r�r's rw�flushzIO.flush_rryc��yr�r�r's rw�isattyz	IO.isattycrryr+c��yr�r�)rr+s  rw�readzIO.readgrryc��yr�r�r's rw�readablezIO.readablekrry�limitc��yr�r�)rr�s  rw�readlinezIO.readlineorry�hintc��yr�r�)rr�s  rw�	readlineszIO.readlinessrry�offset�whencec��yr�r�)rr�r�s   rw�seekzIO.seekwrryc��yr�r�r's rw�seekablezIO.seekable{rryc��yr�r�r's rw�tellzIO.tellrry�sizec��yr�r�)rr�s  rw�truncatezIO.truncate�rryc��yr�r�r's rw�writablezIO.writable�rryr<c��yr�r��rr<s  rw�writezIO.write�rry�linesc��yr�r�)rr�s  rw�
writelinesz
IO.writelines�rryc��yr�r�r's rw�	__enter__zIO.__enter__�rryc��yr�r�)rrsr��	tracebacks    rw�__exit__zIO.__exit__�rry)r�N)r�r%r�)r�z
IO[AnyStr]) r�r�r�rrr]rrur�rer��boolr�rr�r�r�rPr�r�r�rDr�r�r�r�r�r�r�r�r�r�r�ryrwrLrL9sd��
��I�
��
�c�
���
���
�c�
���
��
��
���
��
���
��
��
��
��
��
��
��
��
��
�c�
�6�
��
��
�$�
��
��
�c�
�6�
��
��
�c�
�4��<�
��
��
�3�
��
�C�
��
��
�$�
��
��
�c�
��
��
�S�
�C�
��
��
�$�
��
��
�v�
�#�
��
��
��V��
��
��
��
��
��
��
ryrLc�J�eZdZdZdZedeeefde	fd��Z
edd��Zy)	rKz5Typed version of the return of open() in binary mode.r�r<r�c��yr�r�r�s  rwr�zBinaryIO.write�rryc��yr�r�r's rwr�zBinaryIO.__enter__�rryN)r�rK)r�r�r�rrrrr�	bytearrayrr�r�r�ryrwrKrK�sH��?��I��
�u�U�I�-�.�
�3�
��
��
��
ryrKc���eZdZdZdZeedefd���Zeede	fd���Z
eedee	fd���Zeede
fd���Zeedefd���Zedd	��Zy
)rOz3Typed version of the return of open() in text mode.r�r�c��yr�r�r's rw�bufferz
TextIO.buffer�r�ryc��yr�r�r's rw�encodingzTextIO.encoding�r�ryc��yr�r�r's rw�errorsz
TextIO.errors�r�ryc��yr�r�r's rw�line_bufferingzTextIO.line_buffering�r�ryc��yr�r�r's rw�newlineszTextIO.newlines�r�ryc��yr�r�r's rwr�zTextIO.__enter__�rryN)r�rO)r�r�r�rrr]rrKr�rur�rr�r�r�rr�r�r�ryrwrOrO�s���=��I�
��
��
���
���
�#�
���
���
���
�
���
���
��
���
���
�#�
���
��
��
ryrOc���eZdZ�fd�Z�xZS)�_DeprecatedTypec���|dvrD||jvr6tj|j�d|j�d�td��t
�|�|�S)N>rr�r�z5 is deprecated, import directly from typing instead. z  will be removed in Python 3.13.r�re)r�r2rgr�rhrH�__getattribute__)r�rerIs  �rwr�z _DeprecatedType.__getattribute__�s^����<�<�����AU��M�M��<�<�.�!(�(+���~�6"�"�#��
��w�'��-�-ry)r�r�r�r�rKrLs@rwr�r��s
���	.�	.ryr�c�$�eZdZdZgd�ZeZeZeZy)�ioz)Wrapper namespace for IO generic classes.)rLrOrKN)r�r�r�r�__all__rLrOrKr�ryrwr�r��s��3�*�G�	�B�
�F��Hryr�z.ioc� �eZdZdZddgZeZeZy)�rez&Wrapper namespace for re type aliases.rNrMN)r�r�r�rr�rNrMr�ryrwr�r��s��0��'�"�G��G��Eryr�z.rec� �d�x}fd|d|fd�c�S)r�r�r�c�h�tdt|�j��tj��|S)a�Ask a static type checker to reveal the inferred type of an expression.

    When a static type checker encounters a call to ``reveal_type()``,
    it will emit the inferred type of the argument::

        x: int = 1
        reveal_type(x)

    Running a static type checker (e.g., mypy) on this example
    will produce output similar to 'Revealed type is "builtins.int"'.

    At runtime, the function prints the runtime type of the
    argument and returns the argument unchanged.
    zRuntime type is )�file)�printrsr�r��stderrr�s rwrfrf�s*��
��T�#�Y�/�/�2�
3�#�*�*�E��Jryr�)�	.defaultsr�s  rw�#<generic parameters of reveal_type>r��s�������ryc�*��eZdZW��fd��Z�Zy)�_IdentityCallablec�"��d�x}fd|d|fd�c�S)r�rvr�c��yr�r�r�s  rwr.z_IdentityCallable.__call__	
s��ryr�)r�r��
__classdict__s  �rwz <generic parameters of __call__>z2_IdentityCallable.<generic parameters of __call__>	
s�����q���ryN)r�r�r�r.�__classdictcell__)r�s@rwr�r�
s
����ryr�)�
eq_default�
order_default�kw_only_default�frozen_default�field_specifiersr�r�r�r�r�.rQc�&�������������fd�}|S)asDecorator to mark an object as providing dataclass-like behaviour.

    The decorator can be applied to a function, class, or metaclass.

    Example usage with a decorator function::

        @dataclass_transform()
        def create_model[T](cls: type[T]) -> type[T]:
            ...
            return cls

        @create_model
        class CustomerModel:
            id: int
            name: str

    On a base class::

        @dataclass_transform()
        class ModelBase: ...

        class CustomerModel(ModelBase):
            id: int
            name: str

    On a metaclass::

        @dataclass_transform()
        class ModelMeta(type): ...

        class ModelBase(metaclass=ModelMeta): ...

        class CustomerModel(ModelBase):
            id: int
            name: str

    The ``CustomerModel`` classes defined above will
    be treated by type checkers similarly to classes created with
    ``@dataclasses.dataclass``.
    For example, type checkers will assume these classes have
    ``__init__`` methods that accept ``id`` and ``name``.

    The arguments to this decorator can be used to customize this behavior:
    - ``eq_default`` indicates whether the ``eq`` parameter is assumed to be
        ``True`` or ``False`` if it is omitted by the caller.
    - ``order_default`` indicates whether the ``order`` parameter is
        assumed to be True or False if it is omitted by the caller.
    - ``kw_only_default`` indicates whether the ``kw_only`` parameter is
        assumed to be True or False if it is omitted by the caller.
    - ``frozen_default`` indicates whether the ``frozen`` parameter is
        assumed to be True or False if it is omitted by the caller.
    - ``field_specifiers`` specifies a static list of supported classes
        or functions that describe fields, similar to ``dataclasses.field()``.
    - Arbitrary other keyword arguments are accepted in order to allow for
        possible future extensions.

    At runtime, this decorator records its arguments in the
    ``__dataclass_transform__`` attribute on the decorated object.
    It has no other runtime effect.

    See PEP 681 for more details.
    c�$��������d�|_|S)N)r�r�r�r�r�rQ)�__dataclass_transform__)�	cls_or_fnr�r�r�r�rQr�s ������rwr�z&dataclass_transform.<locals>.decoratorT
s'���$�*�.�,� 0��
-
�	�)��ryr�)r�r�r�r�r�rQr�s`````` rwrUrU

s���N	�	��ry�_Funcc� �tdtfSr�)rrr�ryrwr�r�a
s��X�c�3�h�
�ryc�$�dd��x}fd|d|fd�c�S)�Fc��tSr�)r�r�ryrwr�r�d
s���Xry�methodr�c�B�	d|_|S#ttf$rY|SwxYw)aIndicate that a method is intended to override a method in a base class.

    Usage::

        class Base:
            def method(self) -> None:
                pass

        class Child(Base):
            @override
            def method(self) -> None:
                super().method()

    When this decorator is applied to a method, the type checker will
    validate that it overrides a method or attribute with the same name on a
    base class.  This helps prevent bugs that may occur when a base class is
    changed without an equivalent change to a child class.

    There is no runtime checking of this property. The decorator attempts to
    set the ``__override__`` attribute to ``True`` on the decorated object to
    allow runtime introspection.

    See PEP 698 for details.
    T)�__override__rr)r�s rwrdrdd
s6��2
�"����M��
�I�&�
�	
��M�
�r�r�)r�r�s  rw� <generic parameters of override>r�d
s��X� �q� �� ryr�r�)rc�__main__)r�)NNF)r�)�rr�rrr�r�collections.abc�copyregr�r�rr��	stdlib_rer�r�r2rrrr	�_typingr
rrr
rrrrr�rxr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rIr�rrr�rCrsrFrrar]rhr\rrrrjrrrkrrlrr�r�r�r�r�r�r�r�r�r�r�r�r}rr-r5r9rAr�ror�r�rmrWr�_TYPING_INTERNALS�_SPECIAL_NAMESrlrprrr{r}r�r�r�r�r�r��pickler�r�r>r�rr�rrgrSrQr��BuiltinFunctionTyper�r�r�rZr�rXrWr[r�rRr_r`r��partialr�r�rcrYrTrVr�r�r�r�r�r�r�r�rrurP�_aliasr#r0r3r2r1r%r&r7r.r!r4rrFrr,r(r*r-r+r r�rr�rD�dequerAr�rGr)r'r$r/rr"r�r6rBrCrEr@r?rJr5rr=r;r:r9r<r8r>r.r?r@r7rHrOr:rKr"r�rIrkrerbr^rirjrLrKrOr�r�r�r�rNrMrfr�rUr�rdr�ryrw�<module>r�s����*(��#�������
���^�^�	�	�	�o��l�5���PU��B@�
�0�2�B
<��16�/��	�
A� �
�	�
���U��<6?�[�
�DF�F���((/�6�<�t�(/�V0�,�d�0�	"�t�	"�$�H�$�$�4��4�(�4��4�0�4��4�&�4��4�4�(��(�*�(��(�*�)0��)0�V��"��"�
�
���2���2�B�
4��
4� �6��6�2�1(��1(�hQD��t�QD�hF��F��F�
O��O��O����"�J���-&��-&�`#&�L9�BT��d�BT�`V�%�T�V�z)!�<�):�$�)!�X/�2�$�/�2�L�-�t�2�"&�(��&�B&�%�T�&�"#��}�D�"#�J.�D�=��D�)�}�D�)��/:��/:�d:�-�t�:�83�3���������(�.�8�<U�;V�V���"(�:	�8��,�-J�K���������
���*�6�6�7�/�����}�n�-�3������ 0�1��$�S�G�S�l
��
��.24�w�-�24�j1"�l�M��1"�hK
�K
�\'�T�
� �$�$�e�&?�&?��"�"�E�$4�$4�'�):�<P�R��
`]�F
�2�<�4*�$!$��O�e�O�5�O�2!�H�:�!�!2��!2�!2�;��!E�F��&�R	3��
!
�N�C�L���T�]���T�]���v��&���v��&����4�(���:�T�2����4�t�4��

��5�#�	&��
���+�/�/�*�*�A�.���;�?�?�,�,�a�0�	��;�?�?�,�,�a�0�	��{���4�4�a�8�
��{���4�4�a�8�
��+�/�/�*�*�A�.���+�/�/�*�*�A�.��
�K�O�O�.�.��
2�
��{���$�$�a�(���;�?�?�,�,�a�0�	�
�K�O�O�.�.��
2�
�����1�1�1�5���	���[�_�_�(�(�!�-�@��
�K�O�O�.�.��
2�
�
����(�(�!�
,������6�6��:���+�/�/�*�*�A�.������8�8�!�<��
$��O�O����7��
�	�5�"�5�w�7��	��
��d�A�E��/���{� � �!�'�2���S�!�%�e�,���9�a�e�+�>�	��[�_�_�0�0�!�4���+�/�/�*�*�A�.���;�?�?�,�,�a�0�	�
�K�O�O�.�.��
2�
��
�9�9�1�CS�T���Z�C�C�Q�Mb�c��
�d�A�E��/���[�,�,�a�m�D���[�,�,�a�0��
��$�$�a�
(���+�&�&��*���;�?�?�,�,�a�0�	�����6�6��:��
�d�A�E��/�����2�
�(�
��
��
�H�
��
��
�h�
��
��
�H�
��
��
�H�
��
��
��
��
��
���D�E���B�C��!�T�!�H�:�l�l�>�<��R�@���5�
��U*�T�U*�pE��E�N�\�\�.�+�r�2�
>�
�7�	���(��(�.�(��(�$;"�;"�~���
�`
����`
�F
�r�%�y�
� 
�R��W� 
�F
.�d�
.��?�����������B�K�K��
��"�"�A�
&���y����"���?�����������B�K�K���&�����!� �CE�
Q��Q��Q��	Q�
�Q��D��I���c��(:�:�C�?�@�
Q��Q��Q�h � � ry

Zerion Mini Shell 1.0