当前位置: 首页>>代码示例>>Python>>正文


Python Instance.type方法代码示例

本文整理汇总了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)
开发者ID:sixolet,项目名称:mypy,代码行数:22,代码来源:fixup.py

示例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)
开发者ID:cocoatomo,项目名称:mypy,代码行数:18,代码来源:fixup.py

示例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)
开发者ID:mananpal1997,项目名称:mypy,代码行数:18,代码来源:fixup.py

示例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)
开发者ID:python,项目名称:mypy,代码行数:8,代码来源:astmerge.py

示例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)
开发者ID:greatmazinger,项目名称:mypy,代码行数:6,代码来源:astmerge.py


注:本文中的mypy.types.Instance.type方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。