本文整理汇总了Python中mypy.types.Instance.type方法的典型用法代码示例。如果您正苦于以下问题:Python Instance.type方法的具体用法?Python Instance.type怎么用?Python Instance.type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mypy.types.Instance
的用法示例。
在下文中一共展示了Instance.type方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: visit_instance
# 需要导入模块: from mypy.types import Instance [as 别名]
# 或者: from mypy.types.Instance import type [as 别名]
def visit_instance(self, inst: Instance) -> None:
# TODO: Combine Instances that are exactly the same?
type_ref = inst.type_ref
if type_ref is None:
return # We've already been here.
del inst.type_ref
node = lookup_qualified(self.modules, type_ref, self.quick_and_dirty)
if isinstance(node, TypeInfo):
inst.type = node
# TODO: Is this needed or redundant?
# Also fix up the bases, just in case.
for base in inst.type.bases:
if base.type is NOT_READY:
base.accept(self)
else:
# Looks like a missing TypeInfo in quick mode, put something there
assert self.quick_and_dirty, "Should never get here in normal mode"
inst.type = stale_info(self.modules)
for a in inst.args:
a.accept(self)
示例2: visit_instance
# 需要导入模块: from mypy.types import Instance [as 别名]
# 或者: from mypy.types.Instance import type [as 别名]
def visit_instance(self, inst: Instance) -> None:
# TODO: Combine Instances that are exactly the same?
type_ref = inst.type_ref
if type_ref is None:
return # We've already been here.
del inst.type_ref
node = lookup_qualified(self.modules, type_ref)
if isinstance(node, TypeInfo):
inst.type = node
# TODO: Is this needed or redundant?
# Also fix up the bases, just in case.
for base in inst.type.bases:
if base.type is None:
base.accept(self)
for a in inst.args:
a.accept(self)
示例3: visit_instance
# 需要导入模块: from mypy.types import Instance [as 别名]
# 或者: from mypy.types.Instance import type [as 别名]
def visit_instance(self, inst: Instance) -> None:
# TODO: Combine Instances that are exactly the same?
type_ref = inst.type_ref
if type_ref is None:
return # We've already been here.
inst.type_ref = None
inst.type = lookup_qualified_typeinfo(self.modules, type_ref, self.quick_and_dirty)
# TODO: Is this needed or redundant?
# Also fix up the bases, just in case.
for base in inst.type.bases:
if base.type is NOT_READY:
base.accept(self)
for a in inst.args:
a.accept(self)
if inst.final_value is not None:
inst.final_value.accept(self)
示例4: visit_instance
# 需要导入模块: from mypy.types import Instance [as 别名]
# 或者: from mypy.types.Instance import type [as 别名]
def visit_instance(self, typ: Instance) -> None:
typ.type = self.fixup(typ.type)
for arg in typ.args:
arg.accept(self)
if typ.last_known_value:
typ.last_known_value.accept(self)
示例5: visit_instance
# 需要导入模块: from mypy.types import Instance [as 别名]
# 或者: from mypy.types.Instance import type [as 别名]
def visit_instance(self, typ: Instance) -> None:
typ.type = self.fixup(typ.type)
for arg in typ.args:
arg.accept(self)