
    ̺i                       % S SK Jr  S SKrS SKrS SKrS SKJrJrJrJr  S SK	J
r  S SKJrJrJrJrJr  SSKJr  SS	KJr  SS
KJr  SS jrSS jrSS jrSS jrSS jrSS jrSS jr\R>                  4r S\!S'   \RD                  S:  a  / \ Q\R>                  P7r SS jr#\" SS9SS j5       r$SS jr%SS.         S S jjr&g)!    )annotationsN)AnyTypeVarIterablecast)abc)TypeIsRequired	Annotatedget_args
get_origin   )	lru_cache   )InheritsGeneric)is_unionc                &    [        U 5      [        :H  $ N)r   r   typs    W/var/www/piano.thomer.com/venv/lib/python3.13/site-packages/anthropic/_utils/_typing.pyis_annotated_typer      s    c?i''    c                8    [        U 5      =(       d    U [        :H  $ r   )r   listr   s    r   is_list_typer      s    sO"st++r   c                    [        U 5      =(       d    U nU[        R                  :H  =(       d-    U[        R                  :H  =(       d    U[        R                  :H  $ r   )r   typing_extensionsSequencetyping_c_abcr   origins     r   is_sequence_typer$      sB    _#F&///i6V__3LiPVZ`ZiZiPiir   c                p    [        U 5      =(       d    U nU[        :H  =(       d    U[        R                  :H  $ )z)If the given type is `typing.Iterable[T]`)r   r   r!   r"   s     r   is_iterable_typer&   "   s)    _#FX:6??!::r   c                *    [        [        U 5      5      $ r   )	_is_unionr   r   s    r   is_union_typer)   (   s    Z_%%r   c                &    [        U 5      [        :H  $ r   )r   r
   r   s    r   is_required_typer+   ,   s    c?h&&r   c                &    [        U 5      [        :H  $ r   )typer   r   s    r   
is_typevarr.   0   s     9r   z1tuple[type[typing_extensions.TypeAliasType], ...]_TYPE_ALIAS_TYPES)      c               "    [        U [        5      $ )zReturn whether the provided argument is an instance of `TypeAliasType`.

```python
type Int = int
is_type_alias_type(Int)
# > True
Str = TypeAliasType("Str", str)
is_type_alias_type(Str)
# > True
```
)
isinstancer/   )tps    r   is_type_alias_typer5   ;   s     b+,,r   i  )maxsizec                    [        U 5      (       d  [        U 5      (       a%  [        [        [        [        U 5      S   5      5      $ U $ )Nr   )r+   r   strip_annotated_typer   r-   r   r   s    r   r8   r8   K   s8     1# 6 6#Dx}Q/?$@AAJr   c                    [        U 5      n [        [        X!   5      $ ! [         a  n[	        SU  SU S35      UeS nAff = f)NzExpected type z" to have a type argument at index z but it did not)r   r   r-   
IndexErrorRuntimeError)r   indexargserrs       r   extract_type_argr?   S   sS    C=DtD$+&& t^C50RSXRYYhijpssts    
A<A)failure_messagec                  [        [        [        U 5      =(       d    U 5      nXA;   a  [        X5      $ [	        U[
        5      (       af  SnUR                   H  nUR                  U;   d  M  Un  O   Uc  [        SU SU S35      e[        XR5      n[        U5      (       a  [        X5      $ U$ [        U=(       d    SU SU  35      e)a  Given a type like `Foo[T]`, returns the generic type variable `T`.

This also handles the case where a concrete subclass is given, e.g.
```py
class MyResponse(Foo[bytes]):
    ...

extract_type_var(MyResponse, bases=(Foo,), index=0) -> bytes
```

And where a generic subclass is given:
```py
_T = TypeVar('_T')
class MyResponse(Foo[_T]):
    ...

extract_type_var(MyResponse[bytes], bases=(Foo,), index=0) -> bytes
```
NzFCould not find the generic base class;
This should never happen;
Does z inherit from one of z ?z/Could not resolve inner type variable at index z for )
r   objectr   r?   r3   r   __orig_bases__
__origin__r;   r.   )r   generic_basesr<   r@   clstarget_base_classbase	extracteds           r   extract_type_var_from_baserJ   [   s    4 vz#-#
.C
++ #''(,&&D-/$(! '
 $u1-D  %%6>	i   $C//
m,[\a[bbghkgl*m
nnr   )r   r-   returnbool)r4   r   rK   z'TypeIs[typing_extensions.TypeAliasType])r   r-   rK   r-   )r   r-   r<   intrK   r-   )
r   r-   rE   ztuple[type, ...]r<   rM   r@   z
str | NonerK   r-   )'
__future__r   sysr    r   r   r   r   r   collectionsr   r!   r	   r
   r   r   r   _utilsr   _typesr   _compatr   r(   r   r   r$   r&   r)   r+   r.   TypeAliasTyper/   __annotations__version_infor5   r8   r?   rJ    r   r   <module>rX      s    " 
   / / %   $ *(,j
;&'  IZHgHgGi D iwB+BV-A-AB-  4 t #'Ao	Ao $Ao 	Ao
  Ao 
Aor   