o
    2g	                     @  s   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	 d	eZ	
	d)d*ddZ		d+d,d&d'Zd(S )-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                   @  s"   e Zd ZU dZded< ded< dS )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__ r   r   B/home/garg/my-data/venv/lib/python3.10/site-packages/mypy/infer.pyr      s   
 	r   TFcallee_typer   	arg_typesSequence[Type | None]	arg_kindslist[ArgKind]	arg_namesSequence[str | None] | Noneformal_to_actuallist[list[int]]contextstrictboolallow_polymorphicreturn/tuple[list[Type | None], list[TypeVarLikeType]]c           
      C  s&   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
   )
r   r   r   r   r    r"   r#   r%   constraints	type_varsr   r   r   infer_function_type_arguments    s
   r+   r*   Sequence[TypeVarLikeType]templater   actualis_supertypeskip_unsatisfiedlist[Type | None]c                 C  s&   t |||rtnt}t| ||dd S )N)r0   r   )r   r   r   r
   )r*   r-   r.   r/   r0   r)   r   r   r   infer_type_argumentsA   s   	r2   N)TF)r   r   r   r   r   r   r   r   r    r!   r"   r   r#   r$   r%   r$   r&   r'   )FF)r*   r,   r-   r   r.   r   r/   r$   r0   r$   r&   r1   )r   
__future__r   typingr   r   mypy.constraintsr   r   r   r   
mypy.nodesr	   
mypy.solver
   
mypy.typesr   r   r   r   r   r+   r2   r   r   r   r   <module>   s    %