本文整理汇总了Python中mypy.messages.MessageBuilder.not_implemented方法的典型用法代码示例。如果您正苦于以下问题:Python MessageBuilder.not_implemented方法的具体用法?Python MessageBuilder.not_implemented怎么用?Python MessageBuilder.not_implemented使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mypy.messages.MessageBuilder
的用法示例。
在下文中一共展示了MessageBuilder.not_implemented方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TypeChecker
# 需要导入模块: from mypy.messages import MessageBuilder [as 别名]
# 或者: from mypy.messages.MessageBuilder import not_implemented [as 别名]
#.........这里部分代码省略.........
return
ctor = typ.get_method('__init__')
if ctor is None:
return
self.msg.interface_has_constructor(ctor)
def check_unique_interface_implementations(self, typ):
"""Check that each interface is implemented only once."""
ifaces = typ.interfaces[:]
dup = find_duplicate(ifaces)
if dup:
self.msg.duplicate_interfaces(typ, dup)
return
base = typ.base
while base:
# Avoid duplicate error messages.
if find_duplicate(base.interfaces):
return
ifaces.extend(base.interfaces)
dup = find_duplicate(ifaces)
if dup:
self.msg.duplicate_interfaces(typ, dup)
return
base = base.base
def check_interface_errors(self, typ):
interfaces = typ.all_directly_implemented_interfaces()
for iface in interfaces:
for n in iface.methods.keys():
if not typ.has_method(n):
self.msg.interface_member_not_implemented(typ, iface, n)
#
# Statements
#
def visit_block(self, b):
for s in b.body:
self.accept(s)
def visit_assignment_stmt(self, s):
"""Type check an assignment statement.
Handle all kinds of assignment statements (simple, indexed, multiple).
"""
# TODO support chained assignment x = y = z
if len(s.lvalues) > 1:
self.msg.not_implemented('chained assignment', s)
self.check_assignments(self.expand_lvalues(s.lvalues[0]), s.rvalue)
def check_assignments(self, lvalues, rvalue):
# Collect lvalue types. Index lvalues require special consideration,
# since we cannot typecheck them until we know the rvalue type.
# For each lvalue, one of lvalue_types[i] or index_lvalues[i] is not
# None.
lvalue_types = [] # Each may be None
index_lvalues = [] # Each may be None
inferred = []
is_inferred = False
for lv in lvalues:
if self.is_definition(lv):