本文整理汇总了Python中mypy.nodes.MypyFile.is_package_init_file方法的典型用法代码示例。如果您正苦于以下问题:Python MypyFile.is_package_init_file方法的具体用法?Python MypyFile.is_package_init_file怎么用?Python MypyFile.is_package_init_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mypy.nodes.MypyFile
的用法示例。
在下文中一共展示了MypyFile.is_package_init_file方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: visit_mypy_file
# 需要导入模块: from mypy.nodes import MypyFile [as 别名]
# 或者: from mypy.nodes.MypyFile import is_package_init_file [as 别名]
def visit_mypy_file(self, o: MypyFile) -> None:
self.scope.enter_file(o.fullname())
self.is_package_init_file = o.is_package_init_file()
self.add_type_alias_deps(self.scope.current_target())
for trigger, targets in o.plugin_deps.items():
self.map.setdefault(trigger, set()).update(targets)
super().visit_mypy_file(o)
self.scope.leave()
示例2: create_indirect_imported_name
# 需要导入模块: from mypy.nodes import MypyFile [as 别名]
# 或者: from mypy.nodes.MypyFile import is_package_init_file [as 别名]
def create_indirect_imported_name(file_node: MypyFile,
module: str,
relative: int,
imported_name: str) -> Optional[SymbolTableNode]:
"""Create symbol table entry for a name imported from another module.
These entries act as indirect references.
"""
target_module, ok = correct_relative_import(
file_node.fullname(),
relative,
module,
file_node.is_package_init_file())
if not ok:
return None
target_name = '%s.%s' % (target_module, imported_name)
link = ImportedName(target_name)
# Use GDEF since this refers to a module-level definition.
return SymbolTableNode(GDEF, link)
示例3: visit_mypy_file
# 需要导入模块: from mypy.nodes import MypyFile [as 别名]
# 或者: from mypy.nodes.MypyFile import is_package_init_file [as 别名]
def visit_mypy_file(self, o: MypyFile) -> None:
self.scope.enter_file(o.fullname())
self.is_package_init_file = o.is_package_init_file()
self.add_type_alias_deps(self.scope.current_target())
super().visit_mypy_file(o)
self.scope.leave()