def notify_new_object(self, sender, cls, code): #print 'New object ', sender, ' created by ', cls fact = {'type': 'objcreation', 'sender': sender, # or 'Main', 'receiver': cls, 'code': code} DCL.notify_fact(fact)
def notify_function_call(self, sender, obj, method_name, code): #print 'Func call ', method_name, ' of object ', (obj or 'Main'), ' by ', (sender or 'Main') fact = {'type': 'methodcall', 'sender': sender.__class__, 'receiver': obj.__class__, # or 'Main', 'method': method_name, 'code': code} DCL.notify_fact(fact)
def notify_inheritance(self, parents, subclass, code): # print 'Inheritance ', subclass, ' of class ', parent # NOTE: python has multiple inheritance for parent in parents: fact = {'type': 'inheritance', 'sender': subclass, 'receiver': parent, 'code': code} DCL.notify_fact(fact)