
    ÁjE                        U d Z ddlZddlZddlZddlZddlZddlZddlm	Z	 ddl
mZmZmZ ddlmZmZ ddlZddlmZmZmZmZ dZej,                  dd d	k(  Zd
ededefdZd
ededefdZ edd      Zde_          edd      Zde_          edd      Zde_          edd      Zde_          edd      Zde_          edd      Zd e_          ed!d"      Z d#e _          ed$d%      Z!d&e!_          ed'd(      Z"d)e"_          ed*d+      Z#d,e#_          ed-d.      Z$d/e$_          ed0d1      Z%d2e%_         d3ede&fd4Z' ed5d6      Z(d7e(_          ed8d9      Z)d:e)_          ed;d<      Z*d=e*_          ed>d?      Z+d@e+_          edAdB      Z,dCe,_          edDdE      Z-dFe-_          edGdH      Z.dIe._          edJdK      Z/dLe/_          edMdN      Z0dOe0_          edPdQ      Z1dRe1_          edSdT      Z2dUe2_          edVdW      Z3dXe3_          edYdZ      Z4d[e4_          ed\d]      Z5d^e5_          ed_d`      Z6dae6_          edbdc      Z7er	d3edddfdeZ8n	 edbdf      Z8dge8_          edhdi      Z9dje9_         ej,                  dkk\  r!ej(                  ej(                  fZ:d3eddlfdmZ;nej(                  Z<d3eddlfdnZ;doe;_         i ejz                  ej|                  jz                  ej~                  ej|                  j~                  ej                  ej|                  j                  ej                  ej|                  j                  ej                  ej|                  j                  ej                  ej|                  j                  ej                  ej|                  j                  ej                  ej|                  j                  ej                  ej|                  j                  ej                  ej|                  j                  ej                  ej|                  j                  ej                  ej|                  j                  ej                  ej|                  j                  ej                  ej|                  j                  ej                  ej|                  j                  ej                  ej|                  j                  ej                  ej|                  j                  i ej                  ej|                  j                  ej                  eRej                  eTej                  ej                  ej                  eWej                  eYej                  ej|                  j                  ej                  ej|                  j                  ej                  ej|                  j                  ej                  ej|                  j                  ej                  e_ej                  ej                  ej                  ej                  ej                  ej                  ej                  ej                  ej                  ej|                  j                  ej                  ej|                  j                  ej                  ehej                  ej                  ej                  ej                  ej                  ej                  ej                  ej                  iZoee_eehe   f      epdp<   	 eoj                         D  ci c]  \  } } er|       | c}} Zsee_etehe   f      epdq<   	  eTeoj                               D ]!  \  ZuZv eweeuj                  d      xZyeveoey<   # yc c}} w )rzLow-level introspection utilities for [`typing`][] members.

The provided functions in this module check against both the [`typing`][] and [`typing_extensions`][]
variants, if they exists and are different.
    N)dedent)FunctionTypeGenericAliasNoneType)AnyFinal)LiteralStringTypeAliasTypeTypeIs
deprecated)"DEPRECATED_ALIASESDEPRECATED_ALIASES_IDSr   is_annotatedis_anyis_classvaris_concatenateis_deprecatedis_finalis_forwardref
is_generic
is_literalis_literalstringis_namedtupleis_never
is_newtypeis_nodefaultis_noextraitemsis_noreturnis_notrequiredis_paramspecis_paramspecargsis_paramspeckwargsis_readonlyis_requiredis_selfis_typealiasis_typealiastypeis_typeguard	is_typeis
is_typevaris_typevartupleis_union	is_unpack   )   
   memberfunction_namereturnc                    t        t        |       }t        t        |       }dt        i}|r;|r9t	        t        |       }t	        t        |       }||u r||d<   d}nC||d<   ||d<   d}n6|r|st	        t        |       |d<   d}n|s|rt	        t        |       |d<   d}nd}t        d| d	| d
      }i }	t        |||	       |	|   S )as  Create a function checking that the function argument is the (unparameterized) typing `member`.

    The function will make sure to check against both the `typing` and `typing_extensions`
    variants as depending on the Python version, the `typing_extensions` variant might be different.
    For instance, on Python 3.9:

    ```pycon
    >>> from typing import Literal as t_Literal
    >>> from typing_extensions import Literal as te_Literal, get_origin

    >>> t_Literal is te_Literal
    False
    >>> get_origin(t_Literal[1])
    typing.Literal
    >>> get_origin(te_Literal[1])
    typing_extensions.Literal
    ```
    r   _objzobj is _obj_t_obj_te_objzobj is _t_obj or obj is _te_objFalse	
    def z&(obj: Any, /) -> bool:
        return 
    hasattrtypingtyping_extensionsr   getattrr   exec
r1   r2   	in_typingin_typing_extensionsglobals_t_objte_obj
check_code	func_codelocals_s
             G/tmp/pip-target-k_scjv0h/lib/python/typing_inspection/typing_objects.py _compile_identity_check_functionrK   =   s    & 'I"#4f= %s|H) '*F3F?$HV&J!&HX"(HY:J	/"662"
/"#4f="

 		 |  	I
 !GHg&=!!    c           	         t        t        |       }t        t        |       }dt        i}|r8|r6t	        t        |       }t	        t        |       }||u r||d<   d}n@||f|d<   d}n6|r|st	        t        |       |d<   d}n|s|rt	        t        |       |d<   d}nd}t        d| d|  d	| d
      }i }	t        |||	       |	|   S )a  Create a function checking that the function is an instance of the typing `member`.

    The function will make sure to check against both the `typing` and `typing_extensions`
    variants as depending on the Python version, the `typing_extensions` variant might be different.
    r   r5   zisinstance(obj, _obj)_objszisinstance(obj, _objs)r8   r9   z(obj: Any, /) -> 'TypeIs[z]':
        return r:   r;   rA   s
             rJ   "_compile_isinstance_check_functionrO   t   s     'I"#4f= %s|H) '*F3F?$HV0J!&HW1J	/"662,
/"#4f=,

 		0 9|  	I
 !GHg&=!!rL   	Annotatedr   z
Return whether the argument is the [`Annotated`][typing.Annotated] [special form][].

```pycon
>>> is_annotated(Annotated)
True
>>> is_annotated(Annotated[int, ...])
False
```
r   r   zm
Return whether the argument is the [`Any`][typing.Any] [special form][].

```pycon
>>> is_any(Any)
True
```
ClassVarr   z
Return whether the argument is the [`ClassVar`][typing.ClassVar] [type qualifier][].

```pycon
>>> is_classvar(ClassVar)
True
>>> is_classvar(ClassVar[int])
>>> False
```
Concatenater   z
Return whether the argument is the [`Concatenate`][typing.Concatenate] [special form][].

```pycon
>>> is_concatenate(Concatenate)
True
>>> is_concatenate(Concatenate[int, P])
False
```
r   r   z
Return whether the argument is the [`Final`][typing.Final] [type qualifier][].

```pycon
>>> is_final(Final)
True
>>> is_final(Final[int])
False
```

ForwardRefr   z
Return whether the argument is an instance of [`ForwardRef`][typing.ForwardRef].

```pycon
>>> is_forwardref(ForwardRef('T'))
True
```
Genericr   z
Return whether the argument is the [`Generic`][typing.Generic] [special form][].

```pycon
>>> is_generic(Generic)
True
>>> is_generic(Generic[T])
False
```
Literalr   z
Return whether the argument is the [`Literal`][typing.Literal] [special form][].

```pycon
>>> is_literal(Literal)
True
>>> is_literal(Literal["a"])
False
```
	ParamSpecr    z
Return whether the argument is an instance of [`ParamSpec`][typing.ParamSpec].

```pycon
>>> P = ParamSpec('P')
>>> is_paramspec(P)
True
```
TypeVarr*   z
Return whether the argument is an instance of [`TypeVar`][typing.TypeVar].

```pycon
>>> T = TypeVar('T')
>>> is_typevar(T)
True
```
TypeVarTupler+   z
Return whether the argument is an instance of [`TypeVarTuple`][typing.TypeVarTuple].

```pycon
>>> Ts = TypeVarTuple('Ts')
>>> is_typevartuple(Ts)
True
```
Unionr,   a  
Return whether the argument is the [`Union`][typing.Union] [special form][].

This function can also be used to check for the [`Optional`][typing.Optional] [special form][],
as at runtime, `Optional[int]` is equivalent to `Union[int, None]`.

```pycon
>>> is_union(Union)
True
>>> is_union(Union[int, str])
False
```

!!! warning
    This does not check for unions using the [new syntax][types-union] (e.g. `int | str`).
objc                b    t        | t              xr t        | t              xr t	        | d      S )a  Return whether the argument is a named tuple type.

    This includes [`NamedTuple`][typing.NamedTuple] subclasses and classes created from the
    [`collections.namedtuple`][] factory function.

    ```pycon
    >>> class User(NamedTuple):
    ...     name: str
    ...
    >>> is_namedtuple(User)
    True
    >>> City = collections.namedtuple('City', [])
    >>> is_namedtuple(City)
    True
    >>> is_namedtuple(NamedTuple)
    False
    ```
    _fields)
isinstancetype
issubclasstupler<   rZ   s    rJ   r   r   9  s)    & c4 WZU%;WY@WWrL   r	   r   z
Return whether the argument is the [`LiteralString`][typing.LiteralString] [special form][].

```pycon
>>> is_literalstring(LiteralString)
True
```
Neverr   zu
Return whether the argument is the [`Never`][typing.Never] [special form][].

```pycon
>>> is_never(Never)
True
```
NewTyper   z
Return whether the argument is a [`NewType`][typing.NewType].

```pycon
>>> UserId = NewType("UserId", int)
>>> is_newtype(UserId)
True
```
	NoDefaultr   z
Return whether the argument is the [`NoDefault`][typing.NoDefault] sentinel object.

```pycon
>>> is_nodefault(NoDefault)
True
```
NoExtraItemsr   zy
Return whether the argument is the `NoExtraItems` sentinel object.

```pycon
>>> is_noextraitems(NoExtraItems)
True
```
NoReturnr   z
Return whether the argument is the [`NoReturn`][typing.NoReturn] [special form][].

```pycon
>>> is_noreturn(NoReturn)
True
>>> is_noreturn(Never)
False
```
NotRequiredr   z
Return whether the argument is the [`NotRequired`][typing.NotRequired] [special form][].

```pycon
>>> is_notrequired(NotRequired)
True
```
ParamSpecArgsr!   z
Return whether the argument is an instance of [`ParamSpecArgs`][typing.ParamSpecArgs].

```pycon
>>> P = ParamSpec('P')
>>> is_paramspecargs(P.args)
True
```
ParamSpecKwargsr"   z
Return whether the argument is an instance of [`ParamSpecKwargs`][typing.ParamSpecKwargs].

```pycon
>>> P = ParamSpec('P')
>>> is_paramspeckwargs(P.kwargs)
True
```
ReadOnlyr#   z
Return whether the argument is the [`ReadOnly`][typing.ReadOnly] [special form][].

```pycon
>>> is_readonly(ReadOnly)
True
```
Requiredr$   z
Return whether the argument is the [`Required`][typing.Required] [special form][].

```pycon
>>> is_required(Required)
True
```
Selfr%   zq
Return whether the argument is the [`Self`][typing.Self] [special form][].

```pycon
>>> is_self(Self)
True
```
	TypeAliasr&   z
Return whether the argument is the [`TypeAlias`][typing.TypeAlias] [special form][].

```pycon
>>> is_typealias(TypeAlias)
True
```
	TypeGuardr(   z
Return whether the argument is the [`TypeGuard`][typing.TypeGuard] [special form][].

```pycon
>>> is_typeguard(TypeGuard)
True
```
r   r)   zy
Return whether the argument is the [`TypeIs`][typing.TypeIs] [special form][].

```pycon
>>> is_typeis(TypeIs)
True
```
r
   _is_typealiastype_innerzTypeIs[TypeAliasType]c                >    t        |       t        uxr t        |       S N)r^   r   ro   ra   s    rJ   r'   r'     s    Cy,M1H1MMrL   r'   a'  
Return whether the argument is a [`TypeAliasType`][typing.TypeAliasType] instance.

```pycon
>>> type MyInt = int
>>> is_typealiastype(MyInt)
True
>>> MyStr = TypeAliasType("MyStr", str)
>>> is_typealiastype(MyStr):
True
>>> type MyList[T] = list[T]
>>> is_typealiastype(MyList[int])
False
```
Unpackr-   z
Return whether the argument is the [`Unpack`][typing.Unpack] [special form][].

```pycon
>>> is_unpack(Unpack)
True
>>> is_unpack(Unpack[Ts])
False
```
)r/      zTypeIs[deprecated]c                "    t        | t              S rq   )r]   _deprecated_typesra   s    rJ   r   r     s    #011rL   c                "    t        | t              S rq   )r]   _deprecated_typera   s    rJ   r   r   #  s    #/00rL   a+  
Return whether the argument is a [`deprecated`][warnings.deprecated] instance.

This also includes the [`typing_extensions` backport][typing_extensions.deprecated].

```pycon
>>> is_deprecated(warnings.deprecated('message'))
True
>>> is_deprecated(typing_extensions.deprecated('message'))
True
```
r   r   )z__doc__collections.abccollections
contextlibresysr=   warningstextwrapr   typesr   r   r   r   r   r>   r	   r
   r   r   __all__version_info	_IS_PY310rK   rO   r   r   r   r   r   r   r   r   r    r*   r+   r,   boolr   r   r   r   r   r   r   r   r!   r"   r#   r$   r%   r&   r(   r)   ro   r'   r-   ru   r   rw   Hashableabc	Awaitable	CoroutineAsyncIterableAsyncIteratorIterableIterator
ReversibleSized	Container
CollectionCallableAbstractSetSet
MutableSetMappingMutableMappingSequenceMutableSequenceTupler`   ListlistDequedequeset	FrozenSet	frozensetMappingViewKeysView	ItemsView
ValuesViewDictdictDefaultDictdefaultdictOrderedDictCounterChainMap	GeneratorAsyncGeneratorTyper^   PatternMatchContextManagerAbstractContextManagerAsyncContextManagerAbstractAsyncContextManagerr   __annotations__itemsidr   intaliastargetr?   __name__te_alias)kvs   00rJ   <module>r      s`     	 
    6 6   N N#J Ra G+	4"] 4"= 4"]i 4"n&"} &"] &"_k &"V 0^L	  
*%	: /z=I	  2-AQR	  ,GZ@	  3<Q  .iF
	
  .iF
	
  2+~N  0	<H

  5^EVW  ,GZ@ $Xs X$ X4 4OEWX    ,GZ@  0	<H

  0^L  3>CTU  /z=I	  2-AQR  6oGYZ    88IK_`    /z=I  /z=I  +69
= 0^L  0^L  -X{C		  =_Ngh  
Nc N)@ N :/K]^    -X{C			  w!,,.?.J.JK23 2&: 2 )3313 1&: 1 +3
OO[__--+3
koo//+3 koo//+3 +//77	+3
 +//77+3 OO[__--+3 OO[__--+3 {11+3 LL+//''+3 koo//+3 {11+3 OO[__--+3 +++3 {11+3  NNKOO++!+3" ;??99#+3$ OO[__--%+3& KOO;;'+3( LL%)+3* KK++3, LL+##-+3. JJ/+30 i1+32 333+34 OO[__--5+36 koo//7+38 {119+3: KK;+3< //=+3> //?+3@ NNK''A+3B OO[))C+3D koo//E+3F ;??99G+3H KK
NNBJJ
LL"((
:<<

 F FS+3 E$sDI~./ +X A M_LdLdLf6gDAqr!uax6g d3S	>23 g W ,2245 .ME6-u~~tDDQ'-8$. 7hs   =] 