@classmethod
def from_json(cls, json_obj):
"""initialize object from json"""
return cls(json.loads(json_obj))
def update_state(self, next_s="NONE"):
"""state <- next_state, next_state <- "NONE" or a string that is passed as a parameter"""
self.state = self.next_state
After Change
def from_json(cls, json_obj):
"""initialize object from json"""
obj_dict = json.loads(json_obj)
return cls(obj_dict["endpoint_data"], obj_dict["state"], obj_dict["next_state"])
def update_state(self, next_s="NONE"):
"""state <- next_state, next_state <- "NONE" or a string that is passed as a parameter"""