class Params(object): def __init__(self, params=None): self.params = FancyDict(params or {}) def to_dict(self): base = {} for key, value in self.params.items(): base[key] = value.to_dict() if isinstance(value, Var) else value return base
class Data(object): def __init__(self, inputs=None, outputs=None): self.inputs = FancyDict(inputs or {}) self.outputs = outputs or [] def to_dict(self): base = {'inputs': {}, 'outputs': self.outputs} for key, value in self.inputs.items(): base['inputs'][key] = value.to_dict() if isinstance(value, Var) else value return base