Exemple #1
0
 def _graphattr(store=False, *largs, **kargs):
     default = len(largs) + len(kargs) == 0
     try:
         if not default:
             raise NotImplementedError
         return lookup(self._props, name)
     except (KeyError, NotImplementedError):
         a = Graph.__getattribute__(self, name)(*largs, **kargs)
         if default and store:
             update(self._props, attr, d)
         return a
Exemple #2
0
    def __getattribute__(self, name):
        def _graphattr(store=False, *largs, **kargs):
            default = len(largs) + len(kargs) == 0
            try:
                if not default:
                    raise NotImplementedError
                return lookup(self._props, name)
            except (KeyError, NotImplementedError):
                a = Graph.__getattribute__(self, name)(*largs, **kargs)
                if default and store:
                    update(self._props, attr, d)
                return a

        attr = Graph.__getattribute__(self, name)
        cl = type(self)
        while cl is not None:
            if name in cl._spec["fields"] and name not in cl._spec["skip"] and name not in cl._spec["special"]:
                _graphattr.func_name = name
                _graphattr.func_doc = attr.func_doc
                return _graphattr
            cl = cl._parent
        return attr