def getattr(self, name, context=None): """this method doesn't look in the instance_attrs dictionary since it's done by an Instance proxy at inference time. It may return a YES object if the attribute has not been actually found but a __getattr__ or __getattribute__ method is defined """ if name in self.locals: return self.locals[name] if name == '__bases__': return tuple(self.ancestors(recurs=False)) # XXX need proper meta class handling + MRO implementation if name == '__mro__': return tuple(self.ancestors(recurs=True)) for classnode in self.ancestors(recurs=False, context=context): try: return classnode.getattr(name, context) except NotFoundError: continue raise NotFoundError(name)
def getattr(self, name, context=None): try: return self.locals[name] except KeyError: raise NotFoundError(name)