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


Python MessageBuilder.not_implemented方法代码示例

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


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