def __setattr__(self, name, value): """Uses __setattr__ to log changes and reset properties""" super(Agent, self).__setattr__(name, value) if name in self.all_params: set_log(self, name, value) reset_properties(self) reset_properties(self)
def log_changes(self, change): """A simple logger for changes not of type create or update that also resets properties""" if change["type"] not in ("create", "update"): set_log(self, change["name"], change["value"]) reset_properties(self)
def log_changes(self, change): """A simple logger for all changes and to reset properties""" if change["type"] != "create": set_log(self, change["name"], change["value"]) if change["type"] == "update": reset_properties(self)
def log_changes(self, change): """A simple logger for all changes and to reset properties""" if change["type"]!="create": set_log(self, change["name"], change["value"]) if change["type"]=="update": reset_properties(self)