本文整理汇总了Python中mypy.types.CallableType.type_var_ids方法的典型用法代码示例。如果您正苦于以下问题:Python CallableType.type_var_ids方法的具体用法?Python CallableType.type_var_ids怎么用?Python CallableType.type_var_ids使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mypy.types.CallableType
的用法示例。
在下文中一共展示了CallableType.type_var_ids方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: infer_function_type_arguments
# 需要导入模块: from mypy.types import CallableType [as 别名]
# 或者: from mypy.types.CallableType import type_var_ids [as 别名]
def infer_function_type_arguments(callee_type: CallableType,
arg_types: List[Optional[Type]],
arg_kinds: List[int],
formal_to_actual: List[List[int]],
strict: bool = True) -> List[Type]:
"""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
"""
# Infer constraints.
constraints = infer_constraints_for_callable(
callee_type, arg_types, arg_kinds, formal_to_actual)
# Solve constraints.
type_vars = callee_type.type_var_ids()
return solve_constraints(type_vars, constraints, strict)