def __init__( self, app=None, validator=None, mime_type=None, skip_depth=0, ignore_uncap=False, # these are yaml specific safe=True, **kwargs): HierDictDocument.__init__(self, app, validator, mime_type, skip_depth, ignore_uncap) self.in_kwargs = dict(kwargs) self.out_kwargs = dict(kwargs) self.in_kwargs['Loader'] = Loader self.out_kwargs['Dumper'] = Dumper if safe: self.in_kwargs['Loader'] = SafeLoader self.out_kwargs['Dumper'] = SafeDumper if not 'indent' in self.out_kwargs: self.out_kwargs['indent'] = 4 if not 'default_flow_style' in self.out_kwargs: self.out_kwargs['default_flow_style'] = False
def __init__(self, app=None, validator=None, mime_type=None, skip_depth=0, ignore_uncap=False, # these are yaml specific safe=True, **kwargs): HierDictDocument.__init__(self, app, validator, mime_type, skip_depth, ignore_uncap) self.in_kwargs = dict(kwargs) self.out_kwargs = dict(kwargs) self.in_kwargs['Loader'] = Loader self.out_kwargs['Dumper'] = Dumper if safe: self.in_kwargs['Loader'] = SafeLoader self.out_kwargs['Dumper'] = SafeDumper if not 'indent' in self.out_kwargs: self.out_kwargs['indent'] = 4 if not 'default_flow_style' in self.out_kwargs: self.out_kwargs['default_flow_style'] = False
def get_object_as_dict(o, cls, wrapper_name=None, skip_depth=0): return list( HierDictDocument._object_to_doc(cls, o, wrapper_name, skip_depth))[0]
def get_dict_as_object(d, cls, skip_depth=0): if issubclass(cls, Array): d = list(d.values())[0] # FIXME: Hack! return HierDictDocument._doc_to_object(cls, d, skip_depth)
def get_object_as_dict(o, cls, wrapper_name=None, skip_depth=0): return list(HierDictDocument._object_to_doc(cls, o, wrapper_name, skip_depth))[0]