
    %^g	                        d Z ddlmZ ddlmZmZ ddlmZmZm	Z	m
Z
 ddlmZ ddlmZ ddlmZmZmZmZ  G d d	e      Z	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd
Z	 	 d	 	 	 	 	 	 	 	 	 	 	 ddZy)z&Utilities for type argument inference.    )annotations)
NamedTupleSequence)
SUBTYPE_OFSUPERTYPE_OFinfer_constraintsinfer_constraints_for_callable)ArgKind)solve_constraints)CallableTypeInstanceTypeTypeVarLikeTypec                  &    e Zd ZU dZded<   ded<   y)ArgumentInferContexta  Type argument inference context.

    We need this because we pass around ``Mapping`` and ``Iterable`` types.
    These types are only known by ``TypeChecker`` itself.
    It is required for ``*`` and ``**`` argument inference.

    https://github.com/python/mypy/issues/11144
    r   mapping_typeiterable_typeN)__name__
__module____qualname____doc____annotations__     *lib/python3.12/site-packages/mypy/infer.pyr   r      s     r   r   c                V    t        | |||||      }| j                  }	t        |	|||      S )a)  Infer the type arguments of a generic function.

    Return an array of lower bound types for the type variables -1 (at
    index 0), -2 (at index 1), etc. A lower bound is None if a value
    could not be inferred.

    Arguments:
      callee_type: the target generic function
      arg_types: argument types at the call site (each optional; if None,
                 we are not considering this argument in the current pass)
      arg_kinds: nodes.ARG_* values for arg_types
      formal_to_actual: mapping from formal to actual variable indices
    )r	   	variablesr   )
callee_type	arg_types	arg_kinds	arg_namesformal_to_actualcontextstrictallow_polymorphicconstraints	type_varss
             r   infer_function_type_argumentsr(       s;    0 1Y	96FK
 %%IYV=NOOr   c                V    t        |||rt        nt              }t        | ||      d   S )N)skip_unsatisfiedr   )r   r   r   r   )r'   templateactualis_supertyper*   r&   s         r   infer_type_argumentsr.   A   s-     $HfllXbcKYFVWXYZZr   N)TF)r   r   r   zSequence[Type | None]r    zlist[ArgKind]r!   zSequence[str | None] | Noner"   zlist[list[int]]r#   r   r$   boolr%   r/   returnz/tuple[list[Type | None], list[TypeVarLikeType]])FF)r'   zSequence[TypeVarLikeType]r+   r   r,   r   r-   r/   r*   r/   r0   zlist[Type | None])r   
__future__r   typingr   r   mypy.constraintsr   r   r   r	   
mypy.nodesr
   
mypy.solver   
mypy.typesr   r   r   r   r   r(   r.   r   r   r   <module>r7      s    , " '   ( D D: * #PP$P P +	P
 &P "P P P 5PJ "
[(
[
[ 
[ 	
[
 
[ 
[r   