def __init__(self, value): if isinstance(value, dict): super(DictData, self).__init__(value) else: d = data_eval.data_eval(value) assert isinstance(d, dict) super(DictData, self).__init__(d)
def __init__(self, value): if isinstance(value, basestring): self.value = value super(DictData, self).__init__(data_eval.data_eval(value)) elif isinstance(value, dict): self.value = None super(DictData, self).__init__(value) else: raise TypeError("init data is not from type basestring or dict (It's type: %r)" % type(value))
def deserialize(stream): return data_eval.data_eval(stream)