Ë
    pPêjÍ  ã                  ó°   — d Z ddlmZ ddlmZmZmZmZmZm	Z	m
Z
 ddlmZmZ ddlmZ ddlmZmZmZmZmZmZmZ ddlmZ 	 	 	 	 	 	 dd„Zdd	„Zdd
„Zdd„Zy)zGSimple type inference for decorated functions during semantic analysis.é    )Úannotations)ÚARG_POSÚCallExprÚ	DecoratorÚ
ExpressionÚFuncDefÚRefExprÚVar)ÚSemanticAnalyzerInterfaceÚset_callable_name)Úfunction_type)ÚAnyTypeÚCallableTypeÚ
ProperTypeÚTypeÚ	TypeOfAnyÚTypeVarTypeÚget_proper_type)Úhas_no_typevarsc           	     ód  — | j                   j                  rÙ| j                  j                  €yt	        t        t        j                  «      gt        gdgt        t        j                  «      |j                  d«      | j                   j                  ¬«      | j                   _        yt        | j                  j                  t        «      r%| j                  j                  | j                   _        yd}| j                  D ]|  }d}t        |t        «      rbt        |j                  t        «      rH|j                   dk(  r y|j                  j                  r!t#        |j                  j                  «      rd}|rŒzd} n |rJt%        | j                  |j                  d«      «      }t'        || j                  «      | j                   _        | j                  rÜt)        | j                  d   «      }|r:t        |t
        «      r*t        t        j*                  |¬«      | j                   _        t-        | j                  d   «      }|rmt%        | j                  |j                  d«      «      }|j.                  d   j                  |_
        || j                   _        t        |t        «      r| |_        yyyy)	a³  Try to infer the type of the decorated function.

    This lets us resolve additional references to decorated functions
    during type checking. Otherwise, the type might not be available
    when we need it, since module top levels can't be deferred.

    This basically uses a simple special-purpose type inference
    engine just for decorators. Logic here should be kept in sync with
    visit_decorator() in mypy/checker.py.
    Nzbuiltins.function)ÚnameTFztyping.no_type_checkr   )Ú
source_any)ÚvarÚis_propertyÚfuncÚtyper   r   r   Úspecial_formr   Ú
named_typer   Ú
isinstanceÚ
decoratorsr	   Únoder   ÚfullnameÚis_identity_signaturer   r   Úcalculate_return_typeÚfrom_another_anyÚfind_fixed_callable_returnÚitemsÚ
definition)ÚdecÚanalyzerÚdecorator_preserves_typeÚexprÚpreserve_typeÚsigÚreturn_typeÚorig_sigs           úW/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/mypy/semanal_infer.pyÚ#infer_decorator_signature_if_simpler2      s  € ð ‡w�w×Òð �8‰8�=‰=Ð Ü'Üœ×/Ñ/Ó0Ð1Ü�	Ø�Üœ	×.Ñ.Ó/Ø×#Ñ#Ð$7Ó8Ø—W‘W—\‘\ôˆC�G‰GŒLð 	ô ˜Ÿ™Ÿ™¤|Ô4ØŸ8™8Ÿ=™=ˆC�G‰GŒLØØ#ÐØ—‘ò 	ˆØˆÜ�dœGÔ$¬°D·I±I¼wÔ)GØ�}‰}Ð 6Ò6ÙØ�y‰y�~Š~Ô"7¸¿	¹	¿¹Ô"GØ $�ÚØ',Ð$Ùð	ñ  ô ˜CŸH™H h×&9Ñ&9Ð:MÓ&NÓOˆÜ(¨¨c¯h©hÓ7ˆ�‰ŒØ
‡~‚~Ü+¨C¯N©N¸1Ñ,=Ó>ˆÙœ: k´7Ô;ô #¤9×#=Ñ#=È+ÔVˆC�G‰GŒLÜ(¨¯©¸Ñ):Ó;ˆÙô % S§X¡X¨x×/BÑ/BÐCVÓ/WÓXˆHØ—~‘~ aÑ(×-Ñ-ˆCŒHØˆC�G‰GŒLÜ˜#œ|Ô,Ø!$�•ð -ð ð ó    c                ó0  — t        | «      } t        | t        «      r{| j                  t        gk(  rgt        | j
                  d   t        «      rJt        | j                  t        «      r0| j
                  d   j                  | j                  j                  k(  S y)z?Is type a callable of form T -> T (where T is a type variable)?r   F)	r   r   r   Ú	arg_kindsr   Ú	arg_typesr   Úret_typeÚid)r.   s    r1   r#   r#   Q   si   € ä
˜#Ó
€CÜ�#”|Ô$¨¯©¼7¸)Ò)CÜ�c—m‘m AÑ&¬Ô4¼ÀCÇLÁLÔR]Ô9^Ø—=‘= Ñ#×&Ñ&¨#¯,©,¯/©/Ñ9Ð9Ør3   c                óÄ  — t        | t        «      r«t        | j                  t        «      rW| j                  j                  }|€t        t        j                  «      S t        |t        «      rt        |j                  «      S yt        | j                  t        «      rt        | j                  j                  «      S yt        | t        «      rt        | j                  «      S y)zéReturn the return type if we can calculate it.

    This only uses information available during semantic analysis so this
    will sometimes return None because of insufficient information (as
    type inference hasn't run yet).
    N)r   r	   r!   r   r   r   r   Úunannotatedr   r   r7   r
   r   r$   Úcallee)r,   Útyps     r1   r$   r$   Z   sŸ   € ô �$œÔ Ü�d—i‘i¤Ô)Ø—)‘)—.‘.ˆCØˆ{äœy×4Ñ4Ó5Ð5ä˜#œ|Ô,Ü& s§|¡|Ó4Ð4ØÜ˜Ÿ	™	¤3Ô'Ü" 4§9¡9§>¡>Ó2Ð2ð ô 
�Dœ(Ô	#Ü$ T§[¡[Ó1Ð1Ør3   c                ó¾  — t        | t        «      rt        | j                  t        «      rd| j                  j                  }|rLt        |t
        «      r<t        |j                  «      r't        |j                  «      }t        |t
        «      r|S yt        | t        «      r>t        | j                  «      }|r't        |j                  «      }t        |t
        «      r|S y)a=  Return the return type, if expression refers to a callable that returns a callable.

    But only do this if the return type has no type variables. Return None otherwise.
    This approximates things a lot as this is supposed to be called before type checking
    when full type information is not available yet.
    N)r   r	   r!   r   r   r   r   r7   r   r   r&   r;   )r,   r<   r7   Úts       r1   r&   r&   r   s    € ô �$œÔ Ü�d—i‘i¤Ô)Ø—)‘)—.‘.ˆCÙÜ˜c¤<Ô0´_ÀSÇ\Á\Ô5RÜ.¨s¯|©|Ó<�HÜ! (¬LÔ9Ø'˜ð ô 
�Dœ(Ô	#Ü& t§{¡{Ó3ˆÙÜ& q§z¡zÓ2ˆHÜ˜(¤LÔ1Ø�Ør3   N)r)   r   r*   r   ÚreturnÚNone)r.   r   r?   Úbool)r,   r   r?   zProperType | None)r,   r   r?   zCallableType | None)Ú__doc__Ú
__future__r   Ú
mypy.nodesr   r   r   r   r   r	   r
   Úmypy.semanal_sharedr   r   Úmypy.typeopsr   Ú
mypy.typesr   r   r   r   r   r   r   Úmypy.typevarsr   r2   r#   r$   r&   © r3   r1   ú<module>rJ      s[   ðÙ Må "ç V× VÑ Vß LÝ &÷÷ ñ õ *ð:%Ø	ð:%Ø7ð:%à	ó:%ózóô0r3   