+
    i1C                      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
 ^ RIHtHt ^ RIHt ^ RIHtHtHt ^ R	IHtHtHt ^ R
IHtHtHtHt ^ RIHt ^ RIH t  RR0t!0 R8mt"R]#R&   RR0t$R]#R&   Rt%]&! ]'! ]R. 4      4      t(])! R94      t*Rt+R R lt,R:R R llt-R R lt.R:R R llt/R R  lt0R:R! R" llt1R# R$ lt2R:R% R& llt3R' R( lt4R) R* lt5R:R+ R, llt6R- R. lt7R:R/ R0 llt8R1 R2 lt9R:R3 R4 llt:R5 t;R6 R7 lt<R# );z$Astroid hooks for typing.py support.)annotationsN)Iterator)partial)Final)contextnodes)register_module_extender)AstroidBuilder_extract_single_nodeextract_node)
PY312_PLUS
PY313_PLUS
PY314_PLUS)AstroidSyntaxErrorAttributeInferenceErrorInferenceErrorUseInferenceDefault)inference_tip)AstroidManagerTypeVarNewTyper   TYPING_TYPEVARS_QUALIFIEDztyping.TypedDictztyping_extensions.TypedDictTYPING_TYPEDDICT_QUALIFIEDz
class Meta(type):
    def __getitem__(self, item):
        return self

    @property
    def __args__(self):
        return ()

class {0}(metaclass=Meta):
    pass
__all__z?
@classmethod
def __class_getitem__(cls, item):
    return cls
c                   V ^8  d   QhRR/#    returnbool )formats   "</usr/lib/python3/dist-packages/astroid/brain/brain_typing.py__annotate__r"   e   s      $     c                    V P                   p\        V\        P                  4      '       d   VP                  \
        9   # \        V\        P                  4      '       d   VP                  \
        9   # R # )F)func
isinstancer   	AttributeattrnameTYPING_TYPEVARSNamename)noder%   s   & r!   $looks_like_typing_typevar_or_newtyper-   e   sN    99D$((}}//$

##yyO++r#   c               $    V ^8  d   QhRRRRRR/# )r   r,   
nodes.Callcontext_ittoncontext.InferenceContext | Noner   Iterator[nodes.ClassDef]r   )r    s   "r!   r"   r"   n   s$     - -
-%D--r#   c                `    \        V P                  P                  VR7      4      pTP                  4       \        9  d   \
        hT P                  '       g   \
        h\        T P                  ^ ,          \        P                  4      '       d   \
        hT P                  ^ ,          P                  4       P                  R4      p \        \        P!                  T4      4      p T P                  TR7      #   \        \        3 d   p\
        ThRp?ii ; i  \"         d   p\        ThRp?ii ; i)z8Infer a typing.TypeVar(...) or typing.NewType(...) call.r   N')nextr%   inferr   StopIterationr   qnamer   argsr&   r   	JoinedStr	as_stringstripr   TYPING_TYPE_TEMPLATEr    r   )r,   r0   r%   exctypenames   &&   r!   infer_typing_typevar_or_newtyperA   n   s    +DIIOOMO:; zz|44!!999!!$))A,00!!yy|%%'--c2H&077AB ::m:,,! M* +!s*+  &#%&s/   %C6 D 6DDDD-!D((D-c                   V ^8  d   QhRR/# r   r   )r    s   "r!   r"   r"      s      $ r#   c                <   \        V \        P                  4      '       d   V P                  \        9   # \        V \        P
                  4      '       d   V P                  \        9   # \        V \        P                  4      '       d   \        V P                  4      # R# )zLTry to figure out if a Subscript node *might* be a typing-related subscript.F)
r&   r   r*   r+   TYPING_MEMBERSr'   r(   	Subscript_looks_like_typing_subscriptvaluer,   s   &r!   rF   rF      se    $

##yyN**$((}}..$((+DJJ77r#   c               $    V ^8  d   QhRRRRRR/# )r   r,   znodes.Subscriptctxr1   r   r2   r   )r    s   "r!   r"   r"      s$     /# /#
/# ?/#/#r#   c                  a  \        V P                  P                  4       4      oSP                  4       P                  R4      '       d   SP                  4       \        9   d   \
        h\        '       dM   \        S\        P                  4      '       d-   SP                  4       R8X  d   T3R lT n        \        S.4      # \        S\        P                  4      '       Ed    SP                  4       R
9   d   \!        \"        4      pT.SP$                  R&   \        T P&                  \        P                  4      '       d   Y P&                  P(                  9   dq   \+        T P&                  RR4      '       dT   T P&                  P,                  pTP/                  T P&                  P0                  4      e   Y@P&                  P0                   T3R lT n        \        S.4      # \3        \4        P7                  SP                  4       P9                  R4      R,          4      4      p T P                  TR	7      #   \        \        3 d   p\
        ThRp?ii ; i)z Infer a typing.X[...] subscript.Nztyping.typing.Annotatedc                   < \        S.4      # Niterr,   r   rG   s   &&r!   <lambda>#infer_typing_attr.<locals>.<lambda>       ugr#   __class_getitem____cachec                   < \        S.4      # rN   rO   rQ   s   &&r!   rR   rS      rT   r#   .r4   >   typing.GenericrL   typing_extensions.Annotated)r6   rG   r7   r   r8   r   r9   
startswithTYPING_ALIASr   r&   r   FunctionDef_explicit_inferencerP   ClassDefr
   CLASS_GETITEM_TEMPLATElocalsparentbasesgetattrrV   getslotsr   r>   r    split)r,   rJ   r?   func_to_addcacherG   s   &&   @r!   infer_typing_attrrk      s   +TZZ%%'( ;;=##I..%++-<2O!! 	
ue//00KKM// $G UG}%((U[[] ? . ++AB-8M()t{{ENN33)))Y55 KK''Eyy**+7++++,#F UG},33EKKM4G4G4LR4PQRD::c:""S M* +!s*+s   #H6 6IIIc                    V ^8  d   QhRRRR/# )r   r,   nodes.ClassDefr   r   r   )r    s   "r!   r"   r"      s     % %> %d %r#   c                2    \        V P                  4      ^ 8  # )z5Check if class is using type parameter. Python 3.12+.)lentype_paramsrH   s   &r!    _looks_like_generic_class_pep695rq      s    t 1$$r#   c               $    V ^8  d   QhRRRRRR/# )r   r,   rm   rJ   r1   r   r2   r   )r    s   "r!   r"   r"      s$      
>r#   c                X    \        \        4      pV.V P                  R&   \        V .4      # )z8Add __class_getitem__ for generic classes. Python 3.12+.rU   )r
   ra   rb   rP   )r,   rJ   ri   s   && r!   !infer_typing_generic_class_pep695rt      s,     ''=>K(3}DKK#$<r#   c                    V ^8  d   QhRRRR/# )r   r,   z"nodes.FunctionDef | nodes.ClassDefr   r   r   )r    s   "r!   r"   r"      s     6 6
,6	6r#   c                0    V P                  4       \        9   # )z'Check if node is TypedDict FunctionDef.)r9   r   rH   s   &r!   _looks_like_typedDictrw      s     ::<555r#   c               $    V ^8  d   QhRRRRRR/# )r   r,   znodes.FunctionDefrJ   r1   r   r2   r   )r    s   "r!   r"   r"      s$      
"Ar#   c           	     (   \         P                  ! RV P                  V P                  V P                  V P
                  V P                  R7      pVP                  \        R4      .. RR7       \        R4      pV.VP                  R&   \        V.4      # )z,Replace TypedDict FunctionDef with ClassDef.	TypedDictr+   lineno
col_offsetrc   
end_linenoend_col_offsetdictNrd   body
decorators__call__)r   r`   r|   r}   rc   r~   r   postinitr   r
   rb   rP   )r,   rJ   	class_defri   s   &&  r!   infer_typedDictr      s     {{??{{??**I l623"N&v.K$/=IZ r#   c                    V ^8  d   QhRRRR/# r   r,   r/   r   r   r   )r    s   "r!   r"   r"      s      : $ r#   c                R   \        V P                  \        P                  4      ;'       d}    V P                  P                  R9   ;'       d\    \        V P                  4      ^8H  ;'       d<    \        V P                  ^ ,          \        P                  \        P                  34      # )z
Returns True if the node corresponds to a call to _alias function.

For example :

MutableSet = _alias(collections.abc.MutableSet, T)

:param node: call node
>   _alias_DeprecatedGenericAlias)r&   r%   r   r*   r+   ro   r:   r'   rH   s   &r!   _looks_like_typing_aliasr      s}     	499ejj) 	
 	
IINNCC	
 	
 		Na	
 	
 tyy|eoouzz%BC	r#   c                    V ^8  d   QhRRRR/# )r   r,   rm   r   Noner   )r    s   "r!   r"   r"     s      ~ $ r#   c                    R p V P                  R4       \        WP                   4      pW n         R#   \         d     R# i ; i)zJDisable the access to __class_getitem__ method for the node in parameters.c                >    VR8X  d   \        R4      hV ! V.VO5/ VB # )zt
Raises an AttributeInferenceError in case of access to __class_getitem__ method.
Otherwise, just call origin_func.
rU   z'__class_getitem__ access is not allowed)r   )origin_funcattrr:   kwargss   &&*,r!   full_raiser1_forbid_class_getitem_access.<locals>.full_raiser  s.    
 &&)*STT41$1&11r#   rU   N)re   r   r   )r,   r   partial_raisers   &  r!   _forbid_class_getitem_accessr     s@    2	()
 !ll;%" s   ,3 AAc               $    V ^8  d   QhRRRRRR/# r   r,   r/   rJ   r1   r   r2   r   )r    s   "r!   r"   r"     s$     4 4
4:44r#   c           	     @  a \        V P                  \        P                  4      '       d`   \	        V P                  P
                  4      ^8X  d<   \        V P                  P
                  ^ ,          \        P                  4      '       g   \        h \        V P                  ^ ,          P                  VR7      4      pT P                  P
                  ^ ,          p\        P                  ! TP                  TP                  TP                   T P                  TP"                  TP$                  R7      o\        T\        P                  4      '       d   SP'                  T.. RR7       T P                  ^,          p\        T\        P(                  4      '       d2   TP*                  ^ 8  d!   \-        \.        4      pT.SP0                  R&   M\3        S4       T3R lT n        \7        S.4      #   \         d%   p\        T P                  ^ ,          TR7      ThRp?ii ; i)z
Infers the call to _alias function
Insert ClassDef, with same name as aliased class,
in mro to simulate _GenericAlias.

:param node: call node
:param context: inference context

# TODO: evaluate if still necessary when Py3.12 is minimum
r4   r,   r   Nr{   r   rU   c                   < \        S.4      # rN   rO   r,   r   r   s   &&r!   rR   $infer_typing_alias.<locals>.<lambda>L      T9+5Fr#   )r&   rc   r   Assignro   targets
AssignNamer   r6   r:   r7   r8   r   r`   r+   r|   r}   r~   r   r   ConstrG   r
   ra   rb   r   r_   rP   )r,   rJ   reseassign_namemaybe_type_varri   r   s   &&     @r!   infer_typing_aliasr     s    	4;;--##$)t{{**1-u/?/?@@!!D499Q<%%c%23 ++%%a(K!!)){{))"11I #u~~&& 	#RDAYYq\N.%++..>3G3G!3K*+AB1<	,-
 	%Y/  GD?  D$))A,<!CDs   ,G. .H9HHc                    V ^8  d   QhRRRR/# r   r   )r    s   "r!   r"   r"   P  s      J 4 r#   c                l   \        V P                  \        P                  4      ;'       Ed	    V P                  ;'       d    V P                  P
                  R8H  ;'       d\    \        V P                  ^ ,          \        P                  4      ;'       d)    V P                  ^ ,          P
                  R8H  ;'       gy    V P                  P
                  R8H  ;'       dX    \        V P                  ^ ,          \        P                  4      ;'       d%    V P                  ^ ,          P                  4       R8H  # )a  Return True if call is for Tuple or Callable alias.

In PY37 and PY38 the call is to '_VariadicGenericAlias' with 'tuple' as
first argument. In PY39+ it is replaced by a call to '_TupleType'.

PY37: Tuple = _VariadicGenericAlias(tuple, (), inst=False, special=True)
PY39: Tuple = _TupleType(tuple, -1, inst=False, name='Tuple')

PY37: Callable = _VariadicGenericAlias(collections.abc.Callable, (), special=True)
PY39: Callable = _CallableType(collections.abc.Callable, 2)

_TupleTypetuple_CallableTypezcollections.abc.Callable)r&   r%   r   r*   r:   r+   r'   r<   rH   s   &r!   _looks_like_special_aliasr   P  s     	499ejj) 	
 	
II	
 	
 		,. 1 1tyy|UZZ81 1IIaL%%0	 	 		/1 K Ktyy|U__=K KIIaL**,0JJr#   c               $    V ^8  d   QhRRRRRR/# r   r   )r    s   "r!   r"   r"   n  s$      
:r#   c           	     `  a \        V P                  \        P                  4      '       d`   \	        V P                  P
                  4      ^8X  d<   \        V P                  P
                  ^ ,          \        P                  4      '       g   \        h \        V P                  ^ ,          P                  VR7      4      pT P                  P
                  ^ ,          p\        P                  ! TP                  T P                  TP                  TP                   TP"                  TP$                  R7      oSP'                  T.. RR7       \)        \*        4      pT.SP,                  R&   T3R lT n        \1        S.4      #   \         d%   p\        T P                  ^ ,          TR7      ThRp?ii ; i)zBInfer call to tuple alias as new subscriptable class typing.Tuple.r4   r   N)r+   rc   r|   r}   r~   r   r   rU   c                   < \        S.4      # rN   rO   r   s   &&r!   rR   %infer_special_alias.<locals>.<lambda>  r   r#   )r&   rc   r   r   ro   r   r   r   r6   r:   r7   r8   r   r`   r+   r|   r}   r~   r   r   r
   ra   rb   r_   rP   )r,   rJ   r   r   r   ri   r   s   &&    @r!   infer_special_aliasr   n  sN   
 	4;;--##$)t{{**1-u/?/?@@!!D499Q<%%c%23 ++%%a(K{{!!))))"11I cU=&'=>K-8MI()FD#  D$))A,<!CDs   ,E> >F-	F((F-c                    V ^8  d   QhRRRR/# r   r   )r    s   "r!   r"   r"     s      *  r#   c                &   \        V P                  \        P                  4      ;'       d"    V P                  P                  R 8H  ;'       gF    \        V P                  \        P
                  4      ;'       d    V P                  P                  R 8H  # )cast)r&   r%   r   r*   r+   r'   r(   rH   s   &r!   _looks_like_typing_castr     sa    tyy%**-JJ$))..F2J  499eoo.OO4993E3E3Or#   c               $    V ^8  d   QhRRRRRR/# )r   r,   r/   rJ   r1   r   zIterator[nodes.NodeNG]r   )r    s   "r!   r"   r"     s$     + +
+:++r#   c                   \        V P                  \        P                  \        P                  34      '       g   \
        h \        V P                  P                  VR7      4      p\        T\        P                  4      '       d0   TP                  4       R8X  d   \        T P                  4      ^8X  g   \
        hT P                  ^,          P                  TR7      #   \        \        3 d   p\
        ThRp?ii ; i)z<Infer call to cast() returning same type as casted-from var.r4   Nztyping.cast)r&   r%   r   r*   r'   r   r6   r7   r   r8   r^   r9   ro   r:   )r,   rJ   r%   r?   s   &&  r!   infer_typing_castr     s     dii%**eoo!>??!!+DIIOOCO01 	4**++JJLM)		Na!!99Q<c** M* +!s*+s   %C C<0C77C<c                     \         P                  ! R 4      p \        '       d   V \         P                  ! R4      ,          p \        \	        4       4      P                  V 4      # )a  
    class Generic:
        @classmethod
        def __class_getitem__(cls, item):  return cls
    class ParamSpec:
        @property
        def args(self):
            return ParamSpecArgs(self)
        @property
        def kwargs(self):
            return ParamSpecKwargs(self)
    class ParamSpecArgs: ...
    class ParamSpecKwargs: ...
    class TypeAlias: ...
    class Type:
        @classmethod
        def __class_getitem__(cls, item):  return cls
    class TypeVar:
        @classmethod
        def __class_getitem__(cls, item):  return cls
    class TypeVarTuple: ...
    class ContextManager:
        @classmethod
        def __class_getitem__(cls, item):  return cls
    class AsyncContextManager:
        @classmethod
        def __class_getitem__(cls, item):  return cls
    class Pattern:
        @classmethod
        def __class_getitem__(cls, item):  return cls
    class Match:
        @classmethod
        def __class_getitem__(cls, item):  return cls
    z
    from annotationlib import ForwardRef
    class Union:
        @classmethod
        def __class_getitem__(cls, item): return cls
    )textwrapdedentr   r	   r   string_build)codes    r!   _typing_transformr     sR    ?? ! !	DD z ! 	 		 .*+88>>r#   c                    V ^8  d   QhRRRR/# )r   managerr   r   r   r   )r    s   "r!   r"   r"     s     
 
n 
 
r#   c                    V P                  \        P                  \        \        4      \
        4       V P                  \        P                  \        \        4      \        4       V P                  \        P                  \        \        4      \        4       V P                  \        P                  \        \        4      \        4       V P                  \        P                  \        \        4      \        4       V P                  \        P                  \        \         4      \"        4       \$        '       dF   \'        V R \(        4       V P                  \        P*                  \        \,        4      \.        4       R# R# )typingN)register_transformr   Callr   rA   r-   rE   rk   rF   r   r   r^   r   rw   r   r   r   r   r   r   r   r`   rt   rq   )r   s   &r!   registerr     s   

56,
 '89;W 

M"346M =9;P 

M"457O 

M"568Q z (4EF""NN;<,	
 r#   >   typing.NewTypetyping.TypeVartyping_extensions.TypeVar)(ztyping.Hashableztyping.Awaitableztyping.Coroutineztyping.AsyncIterableztyping.AsyncIteratorztyping.Iterableztyping.Iteratorztyping.Reversibleztyping.Sizedztyping.Containerztyping.Collectionztyping.Callableztyping.AbstractSetztyping.MutableSetztyping.Mappingztyping.MutableMappingztyping.Sequenceztyping.MutableSequenceztyping.ByteStringztyping.Tupleztyping.Listztyping.Dequez
typing.Setztyping.FrozenSetztyping.MappingViewztyping.KeysViewztyping.ItemsViewztyping.ValuesViewztyping.ContextManagerztyping.AsyncContextManagerztyping.Dictztyping.DefaultDictztyping.OrderedDictztyping.Counterztyping.ChainMapztyping.Generatorztyping.AsyncGeneratorztyping.Typeztyping.Patternztyping.MatchrN   )=__conditional_annotations____doc__
__future__r   r   r   collections.abcr   	functoolsr   r   astroidr   r   astroid.brain.helpersr   astroid.builderr	   r
   r   astroid.constr   r   r   astroid.exceptionsr   r   r   r   astroid.inference_tipr   astroid.managerr   r)   r   __annotations__r   r>   setre   rD   	frozensetr]   ra   r-   rA   rF   rk   rq   rt   rw   r   r   r   r   r   r   r   r   r   r   )r   s   @r!   <module>r      s   
 + "   $   " : N N < <  0 *i($ 5 
 &89V$W E W  WVY34)+Z -2/#d%
6$,04n<@+**?Z
r#   