本文整理匯總了Python中mypy.types.Instance.type_ref方法的典型用法代碼示例。如果您正苦於以下問題:Python Instance.type_ref方法的具體用法?Python Instance.type_ref怎麽用?Python Instance.type_ref使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類mypy.types.Instance
的用法示例。
在下文中一共展示了Instance.type_ref方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: visit_instance
# 需要導入模塊: from mypy.types import Instance [as 別名]
# 或者: from mypy.types.Instance import type_ref [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)