def from_json_representation(json_repr): if not is_dictish(json_repr): raise ValueError("JSON representation of plan should be a dictionary") if 'steps' not in json_repr: raise ValueError("Missing top-level field 'steps'") steps_repr = json_repr['steps'] if not is_arrayish(steps_repr): raise ValueError("Expected vector for 'steps' field") steps = [RenamePlanAction.from_json_representation(action_repr) for action_repr in steps_repr] comment = None if 'comment' in json_repr: if not is_string(json_repr['comment']): raise ValueError("Expected string for 'comment' field") comment = json_repr['comment'] return RenamePlan(steps, comment)
def __init__(self, from_path, to_path): RenamePlanAction.__init__(self) self.from_path = from_path self.to_path = to_path
def __init__(self, path): RenamePlanAction.__init__(self) self.path = path