Esempio n. 1
0
def tryexcept_assigned_stmts(self, node, context=None, asspath=None):
    found = False
    for exc_type, exc_obj, body in self.handlers:
        if node is exc_obj:
            for assigned in unpack_infer(exc_type):
                if isinstance(assigned, nodes.Class):
                    assigned = Instance(assigned)
                yield assigned
                found = True
            break
    if not found:
        raise InferenceError()
Esempio n. 2
0
 def interfaces(self, herited=True, handler_func=_iface_hdlr):
     """return an iterator on interfaces implemented by the given
     class node
     """
     # FIXME: what if __implements__ = (MyIFace, MyParent.__implements__)...
     try:
         implements = Instance(self).getattr('__implements__')[0]
     except NotFoundError:
         return
     if not herited and not implements.frame() is self:
         return
     oneinf = False
     for iface in unpack_infer(implements):
         if iface is YES:
             continue
         if handler_func(iface):
             oneinf = True
             yield iface
     if not oneinf:
         raise InferenceError()
Esempio n. 3
0
 def interfaces(self, herited=True, handler_func=_iface_hdlr):
     """return an iterator on interfaces implemented by the given
     class node
     """
     # FIXME: what if __implements__ = (MyIFace, MyParent.__implements__)...
     try:
         implements = Instance(self).getattr('__implements__')[0]
     except NotFoundError:
         return
     if not herited and not implements.frame() is self:
         return
     oneinf = False
     for iface in unpack_infer(implements):
         if iface is YES:
             continue
         if handler_func(iface):
             oneinf = True
             yield iface
     if not oneinf:
         raise InferenceError()