+
    }iX                    8  a  0 t $ R t^ RIHt ^ RIt^ RIt^ RIHt ^ RIH	t	 ^ RI
HtHtHt ^ RIHtHtHtHt ^ RIHtHtHtHt ^RIHt R)t]P6                  R*8  g   ]P6                  R+8  d   R R ltMR R ltR R ltRRRR/R R llt]R,,          tR] R&    ]!! ]! ]4      4      t"R] R&    ! R R	]4      t# ! R R
]$4      t% ! R R]4      t&]&PN                  t' ]]&PN                  ,          t(R] R &     ! R! R]4      t)RR"/R# R$ llt*R% R& lt+RR/R' R( llt,R# )-zEHigh-level introspection utilities, used to inspect type annotations.)annotationsN)	Generator)InitVar)EnumIntEnumauto)AnyLiteral
NamedTuplecast)	TypeAliasassert_neverget_args
get_origin)typing_objectsAnnotationSourceForbiddenQualifierInspectedAnnotation	Qualifierc                    V ^8  d   QhRRRR/#    objr   returnbool )formats   "q/Users/ahmad/.openclaw/workspace/my-crawler/.venv/lib/python3.14/site-packages/typing_inspection/introspection.py__annotate__r      s     , ,S , ,    c               .    \         P                  ! V 4      # a8  Return whether the provided origin is the union form.

```pycon
>>> is_union_origin(typing.Union)
True
>>> is_union_origin(get_origin(int | str))
True
>>> is_union_origin(types.UnionType)
True
```

!!! note
    Since Python 3.14, both `Union[<t1>, <t2>, ...]` and `<t1> | <t2> | ...` forms create instances
    of the same [`typing.Union`][] class. As such, it is recommended to not use this function
    anymore (provided that you only support Python 3.14 or greater), and instead use the
    [`typing_objects.is_union()`][typing_inspection.typing_objects.is_union] function directly:

    ```python
    from typing import Union, get_origin

    from typing_inspection import typing_objects

    typ = int | str  # Or Union[int, str]
    origin = get_origin(typ)
    if typing_objects.is_union(origin):
        ...
    ```
)r   is_unionr   s   "r   is_union_originr$      s    : &&s++r   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   r   >   s     F FS F Fr   c               b    \         P                  ! V 4      ;'       g    V \        P                  J # r!   )r   r"   types	UnionTyper#   s   "r   r$   r$   >   s&    : &&s+EEseoo/EEr   c                    V ^8  d   QhRRRR/# )r   valuer   r   Noner   )r   s   "r   r   r   ^   s     o os o$ or   c          	         \        V \        \        \        \        \
        \        P                  34      '       g%   V \        P                  Jd   \        V  R24      hR# R# )zCType check the provided literal value against the legal parameters.zK is not a valid literal value, must be one of: int, bytes, str, Enum, None.N)	
isinstanceintbytesstrr   r   r   NoneType	TypeError)r*   s   "r   _literal_type_checkr3   ^   sP     usE3dN<S<STUU0005'!lmnn 1 Vr   
type_checkFunpack_type_aliaseseagerc               (    V ^8  d   QhRRRRRRRR/# )	r   
annotationr   r4   r   r5   #Literal['skip', 'lenient', 'eager']r   zGenerator[Any]r   )r   s   "r   r   r   g   s8     m+ m+m+ 	m+
 =m+ m+r   c            #    "   VR8X  dW   RpV P                    FB  pV'       d   \        V4       Ve   V\        P                  J d   V'       g   Rx  RpK>  Vx  KD  	  R# . pV P                    F  p\        P                  ! V4      '       d5    VP
                  p\        WaVR7      pVP                  R V 4       4       KS  V'       d   \        V4       V\        P                  J d$   VP                  R\        P                  34       K  VP                  V\        V4      34       K  	   \        P                  V4      pR V 4        Rj  xL
  R#   \         d=    TR8X  d   h T'       d   \        T4       TP                  T\        T4      34        EK,  i ; i LP  \         d    R	 T 4        Rj  xL 
   R# i ; i5i)
a  Yield the values contained in the provided [`Literal`][typing.Literal] [special form][].

Args:
    annotation: The [`Literal`][typing.Literal] [special form][] to unpack.
    type_check: Whether to check if the literal values are [legal parameters][literal-legal-parameters].
        Raises a [`TypeError`][] otherwise.
    unpack_type_aliases: What to do when encountering [PEP 695](https://peps.python.org/pep-0695/)
        [type aliases][type-aliases]. Can be one of:

        - `'skip'`: Do not try to parse type aliases. Note that this can lead to incorrect results:
          ```pycon
          >>> type MyAlias = Literal[1, 2]
          >>> list(get_literal_values(Literal[MyAlias, 3], unpack_type_aliases="skip"))
          [MyAlias, 3]
          ```

        - `'lenient'`: Try to parse type aliases, and fallback to `'skip'` if the type alias can't be inspected
          (because of an undefined forward reference).

        - `'eager'`: Parse type aliases and raise any encountered [`NameError`][] exceptions (the default):
          ```pycon
          >>> type MyAlias = Literal[1, 2]
          >>> list(get_literal_values(Literal[MyAlias, 3], unpack_type_aliases="eager"))
          [1, 2, 3]
          ```

Note:
    While `None` is [equivalent to][none] `type(None)`, the runtime implementation of [`Literal`][typing.Literal]
    does not de-duplicate them. This function makes sure this de-duplication is applied:

    ```pycon
    >>> list(get_literal_values(Literal[NoneType, None]))
    [None]
    ```

Example:
    ```pycon
    >>> type Ints = Literal[1, 2]
    >>> list(get_literal_values(Literal[1, Ints], unpack_type_alias="skip"))
    ["a", Ints]
    >>> list(get_literal_values(Literal[1, Ints]))
    [1, 2]
    >>> list(get_literal_values(Literal[1.0], type_check=True))
    Traceback (most recent call last):
    ...
    TypeError: 1.0 is not a valid literal value, must be one of: int, bytes, str, Enum, None.
    ```
skipFNT)r4   r5   c              3  :   "   T F  q\        V4      3x  K  	  R # 5iN)type).0as   & r   	<genexpr>%get_literal_values.<locals>.<genexpr>   s     *JAtAw<s   r6   c              3  *   "   T F	  w  rVx  K  	  R # 5ir=   r   r?   p_s   &  r   rA   rB      s     *cdac   c              3  *   "   T F	  w  rVx  K  	  R # 5ir=   r   rD   s   &  r   rA   rB      s     6odaorG   )__args__r3   r   r1   is_typealiastype	__value__get_literal_valuesextend	NameErrorappendr>   dictfromkeysr2   )	r8   r4   r5   	_has_noneargvalues_and_typealias_valuesub_argsdcts	   "$$      r   rL   rL   g   s    t f$	 &&C#C({c^%<%<< J 		 ' 8:&&C
 ..s33K"%--K  2#Pc H $***J*JJ',.111#**D.2I2I+JK#**Cc+;<5 '8	+--0C
 +c***5 ! =*g5!+C0#**Cc+;<<=4 +	  	76o666	7sy   AG?GE.G	A"G,F  GFGF/'FGFG G7F:8G=G GGr   set[Qualifier]_all_qualifiersc                      ] tR t^tRt]! 4       t ]! 4       t ]! 4       t ]! 4       t	 ]! 4       t
 ]! 4       t ]! 4       t ]! 4       t ]R R l4       tRtR# )r   zThe source of an annotation, e.g. a class or a function.

Depending on the source, different [type qualifiers][type qualifier] may be (dis)allowed.
c                   V ^8  d   QhRR/# )r   r   rX   r   )r   s   "r   r   AnnotationSource.__annotate__=  s      N r   c                   V \         P                  J d   R0# V \         P                  J d   RR0# V \         P                  J d   0 Rm# V \         P                  J d   0 Rm# V \         P
                  \         P                  \         P                  39   d   \        4       # V \         P                  J d   \        # \        V 4       R# )zIThe allowed [type qualifiers][type qualifier] for this annotation source.final	class_varN>   r^   init_varr_   >   required	read_onlynot_required)r   ASSIGNMENT_OR_VARIABLECLASS	DATACLASS
TYPED_DICTNAMED_TUPLEFUNCTIONBAREsetANYrY   r   selfs   &r   allowed_qualifiers#AnnotationSource.allowed_qualifiers<  s     #:::9%+++[))%///55%000<<&224D4M4MO_OdOdee5L%)))""r   r   N)__name__
__module____qualname____firstlineno____doc__r   rd   re   rf   rg   rh   ri   rl   rj   propertyro   __static_attributes__r   r   r   r   r      s    
 "V FE	 I
 J
 &K	 vH &C
 6D
  r   c                  4    ] tR tRt$ RtR]R&    R R ltRtR# )	r   iP  z-The provided [type qualifier][] is forbidden.r   	qualifierc                    V ^8  d   QhRRRR/# )r   ry   r   r   r+   r   )r   s   "r   r   ForbiddenQualifier.__annotate__V  s     # #) #4 #r   c               	    Wn         R # r=   ry   )rn   ry   s   ""r   __init__ForbiddenQualifier.__init__V  s    "r   r}   N)rq   rr   rs   rt   ru   __annotations__r~   rw   r   r   r   r   r   P  s    7"# #r   c                  <    ] tR tRt]! 4       tR R ltR R ltRtR# )_UnknownTypeEnumiZ  c                   V ^8  d   QhRR/# r   r   r0   r   )r   s   "r   r   _UnknownTypeEnum.__annotate__]  s       r   c                	    R # )UNKNOWNr   rm   s   &r   __str___UnknownTypeEnum.__str__]  s    r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r   `  s      # r   c                	    R # )z	<UNKNOWN>r   rm   s   &r   __repr___UnknownTypeEnum.__repr__`  s    r   r   N)	rq   rr   rs   rt   r   r   r   r   rw   r   r   r   r   r   Z  s    fG r   r   _UnkownTypec                  >    ] tR tRt$ RtR]R&    R]R&    R]R&   R	tR
# )r   ik  z'The result of the inspected annotation.zAny | _UnkownTyper>   rX   
qualifiersz	list[Any]metadatar   N)rq   rr   rs   rt   ru   r   rw   r   r   r   r   r   k  s$    1
 J!r   r;   c               (    V ^8  d   QhRRRRRRRR/# )	r   r8   r   annotation_sourcer   r5   r9   r   r   r   )r   s   "r   r   r     s>     yA yAyA (	yA
 =yA yAr   c              (   VP                   p\        4       p. p \        WR7      w  rV'       d   We,           pK!  \        V 4      pVEe   \        P
                  ! V4      '       d9   RV9  d   \        R4      hVP                  R4       V P                  ^ ,          p K  \        P                  ! V4      '       d9   RV9  d   \        R4      hVP                  R4       V P                  ^ ,          p K  \        P                  ! V4      '       d:   RV9  d   \        R4      hVP                  R4       V P                  ^ ,          p EK.  \        P                  ! V4      '       d:   RV9  d   \        R4      hVP                  R4       V P                  ^ ,          p EK  \        P                  ! V4      '       d:   RV9  d   \        R4      hVP                  R4       V P                  ^ ,          p EK  MW\        V \        4      '       dA   RV9  d   \        R4      hVP                  R4       \        \         V P"                  4      p EK/   \        P                  ! V 4      '       d+   RV9  d   \        R4      hVP                  R4       \$        p My\        P
                  ! V 4      '       d+   RV9  d   \        R4      hVP                  R4       \$        p M3V \        J d*   RV9  d   \        R4      hVP                  R4       \$        p \'        WV4      # )ay	  Inspect an [annotation expression][], extracting any [type qualifier][] and metadata.

An [annotation expression][] is a [type expression][] optionally surrounded by one or more
[type qualifiers][type qualifier] or by [`Annotated`][typing.Annotated]. This function will:

- Unwrap the type expression, keeping track of the type qualifiers.
- Unwrap [`Annotated`][typing.Annotated] forms, keeping track of the annotated metadata.

Args:
    annotation: The annotation expression to be inspected.
    annotation_source: The source of the annotation. Depending on the source (e.g. a class), different type
        qualifiers may be (dis)allowed. To allow any type qualifier, use
        [`AnnotationSource.ANY`][typing_inspection.introspection.AnnotationSource.ANY].
    unpack_type_aliases: What to do when encountering [PEP 695](https://peps.python.org/pep-0695/)
        [type aliases][type-aliases]. Can be one of:

        - `'skip'`: Do not try to parse type aliases (the default):
          ```pycon
          >>> type MyInt = Annotated[int, 'meta']
          >>> inspect_annotation(MyInt, annotation_source=AnnotationSource.BARE, unpack_type_aliases='skip')
          InspectedAnnotation(type=MyInt, qualifiers={}, metadata=[])
          ```

        - `'lenient'`: Try to parse type aliases, and fallback to `'skip'` if the type alias
          can't be inspected (because of an undefined forward reference):
          ```pycon
          >>> type MyInt = Annotated[Undefined, 'meta']
          >>> inspect_annotation(MyInt, annotation_source=AnnotationSource.BARE, unpack_type_aliases='lenient')
          InspectedAnnotation(type=MyInt, qualifiers={}, metadata=[])
          >>> Undefined = int
          >>> inspect_annotation(MyInt, annotation_source=AnnotationSource.BARE, unpack_type_aliases='lenient')
          InspectedAnnotation(type=int, qualifiers={}, metadata=['meta'])
          ```

        - `'eager'`: Parse type aliases and raise any encountered [`NameError`][] exceptions.

Returns:
    The result of the inspected annotation, where the type expression, used qualifiers and metadata is stored.

Example:
    ```pycon
    >>> inspect_annotation(
    ...     Final[Annotated[ClassVar[Annotated[int, 'meta_1']], 'meta_2']],
    ...     annotation_source=AnnotationSource.CLASS,
    ... )
    ...
    InspectedAnnotation(type=int, qualifiers={'class_var', 'final'}, metadata=['meta_1', 'meta_2'])
    ```
)r5   r_   r^   ra   rc   rb   r`   )ro   rk   _unpack_annotatedr   r   is_classvarr   addrI   is_finalis_requiredis_notrequiredis_readonlyr-   r   r   r   r>   r   r   )r8   r   r5   ro   r   r   _metaorigins   "$$     r   inspect_annotationr     s}   p +==!$JH
-jb
'HJ'))&11&88,[99{+'003
((00"44,W55w''003
++F33%77,Z88z*'003
..v66!);;,^<<~.'003
++F33&88,^<<{+'003
 
G,,!33(44NN:&c:??3J z**,,$W--w
		#	#J	/	/00$[11{#
	w	//$Z00z"
zx@@r   c               (    V ^8  d   QhRRRRRRRR/# )	r   r8   r   r5   zLiteral['lenient', 'eager']check_annotatedr   r   tuple[Any, list[Any]]r   )r   s   "r   r   r     s,     ? ??*E?X\??r   c                   \        V 4      pV'       dX   \        P                  ! V4      '       d<   V P                  p\	        V P
                  4      p\        WAR R7      w  rFWe,           pWE3# \        P                  ! V 4      '       d,    V P                  p\        WqRR7      w  rV'       d   W3# V . 3# \        P                  ! V4      '       d?    VP                  p WpP                  ,          p\        WqRR7      w  rV'       d   W3# V . 3# V . 3#   \         d    TR8X  d   h  T . 3# i ; i  \         d     LKi ; i  \         d    TR8X  d   h  T . 3# i ; i)Fr5   r   Tr6   )r   r   is_annotated
__origin__list__metadata___unpack_annotated_innerrJ   rK   rN   rI   r2   )	r8   r5   r   r   annotated_typer   sub_metar*   typs	   &&&      r   r   r     s    
#F>66v>>#..
//0
 $;UZ$
  &''		(	(	4	4	"((E
 4PTMC  }$r>!		(	(	0	0	"$$E 112
 4PTMC }$r>!r>Y  	"g- .V r>Y	B     	"g- .0 r>3	s6   D D= D, D)(D),D:9D:=EEc               $    V ^8  d   QhRRRRRR/# )r   r8   r   r5   r9   r   r   r   )r   s   "r   r   r   B  s)     	n 	n	n0S	n	nr   c                  VR 8X  dK   \         P                  ! \        V 4      4      '       d"   V P                  \	        V P
                  4      3# V . 3# \        WRR7      # )r;   Tr   )r   r   r   r   r   r   r   )r8   r5   s   "$r   r   r   B  sV     f$&&z*'=>>(($z/F/F*GGGr>!":hlmmr   )r   r   r   r   rL   r   r$   )      )r   
   )ra   rc   rb   r_   r`   r^   )-__conditional_annotations__ru   
__future__r   sysr'   collections.abcr   dataclassesr   enumr   r   r   typingr   r	   r
   r   typing_extensionsr   r   r   r    r   __all__version_infor$   r3   rL   r   r   rk   rY   r   	Exceptionr   r   r   r   r   r   r   r   )r   s   @r   <module>r      s9   K " 
  %  $ $ 1 1 K K  w#"2"2W"<,DF@om+ 	m+
 @Gm+` hi	9 i "%hy&9": :
nw nb# #t  
"
" C !1!9!9:Y : Z"* "0yA
 @FyAx?F	nV]	n 	nr   