예제 #1
0
파일: RenamePlan.py 프로젝트: goc9000/baon
    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)
예제 #2
0
 def __init__(self, from_path, to_path):
     RenamePlanAction.__init__(self)
     self.from_path = from_path
     self.to_path = to_path
예제 #3
0
 def __init__(self, path):
     RenamePlanAction.__init__(self)
     self.path = path