Ejemplo n.º 1
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
     found = set()
     missing = False
     for iface in unpack_infer(implements):
         if iface is YES:
             missing = True
             continue
         if not iface in found and handler_func(iface):
             found.add(iface)
             yield iface
     if missing:
         raise InferenceError()
Ejemplo 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
     found = set()
     missing = False
     for iface in unpack_infer(implements):
         if iface is YES:
             missing = True
             continue
         if not iface in found and handler_func(iface):
             found.add(iface)
             yield iface
     if missing:
         raise InferenceError()