
    X-Ph	                        d Z ddlmZ ddlmZ ddl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d'S ),z&Utilities for type argument inference.    )annotations)Sequence)
NamedTuple)
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<   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__     J/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/mypy/infer.pyr   r      s6           r   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                \    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_varss
             r   infer_function_type_argumentsr/   !   s@    0 1Y	96F K
 %IYV=NOOOr   r.   Sequence[TypeVarLikeType]templater   actualis_supertypeskip_unsatisfiedlist[Type | None]c                p    t          |||rt          nt                    }t          | ||          d         S )N)r4   r   )r   r   r   r   )r.   r1   r2   r3   r4   r-   s         r   infer_type_argumentsr7   B   s;     $Hfl6bllXbccKYFVWWWXYZZr   N)TF)r   r   r   r   r   r    r!   r"   r#   r$   r%   r   r&   r'   r(   r'   r)   r*   )FF)r.   r0   r1   r   r2   r   r3   r'   r4   r'   r)   r5   )r   
__future__r   collections.abcr   typingr   mypy.constraintsr   r   r   r	   
mypy.nodesr
   
mypy.solver   
mypy.typesr   r   r   r   r   r/   r7   r   r   r   <module>r?      sJ   , , " " " " " " $ $ $ $ $ $                        ( ( ( ( ( ( D D D D D D D D D D D D    :   * #P P P P PJ "
[ 
[ 
[ 
[ 
[ 
[ 
[r   