salt.serializers.yaml#
salt.serializers.yaml#
Implements YAML serializer.
Underneath, it is based on pyyaml and use the safe dumper and loader. It also use C bindings if they are available.
- salt.serializers.yaml.BaseDumper
alias of
CSafeDumper
- salt.serializers.yaml.BaseLoader
alias of
CSafeLoader
- exception salt.serializers.yaml.ConstructorError(context=None, context_mark=None, problem=None, problem_mark=None, note=None)
- exception salt.serializers.yaml.DeserializationError(message, line_num=None, buf='', marker=' <======================', trace=None)
Raised when stream of string failed to be deserialized
- class salt.serializers.yaml.Dumper(stream, default_style=None, default_flow_style=False, canonical=None, indent=None, width=None, allow_unicode=None, line_break=None, encoding=None, explicit_start=None, explicit_end=None, version=None, tags=None, sort_keys=True)
Overwrites Dumper as not for pollute legacy Dumper
- yaml_multi_representers = {<class 'salt.serializers.yaml.EncryptedString'>: <function EncryptedString.yaml_dumper>, <class 'NoneType'>: <function SafeRepresenter.represent_none>, <class 'str'>: <function SafeRepresenter.represent_str>, <class 'bool'>: <function SafeRepresenter.represent_bool>, <class 'int'>: <function SafeRepresenter.represent_int>, <class 'float'>: <function SafeRepresenter.represent_float>, <class 'list'>: <function SafeRepresenter.represent_list>, <class 'tuple'>: <function SafeRepresenter.represent_list>, <class 'dict'>: <function SafeRepresenter.represent_dict>, <class 'set'>: <function SafeRepresenter.represent_set>, <class 'datetime.date'>: <function SafeRepresenter.represent_date>, <class 'datetime.datetime'>: <function SafeRepresenter.represent_datetime>, None: <function SafeRepresenter.represent_undefined>, <class 'collections.OrderedDict'>: <function SafeRepresenter.represent_dict>}
- class salt.serializers.yaml.EncryptedString
- static yaml_constructor(loader, tag, node)
- static yaml_dumper(dumper, data)
- yaml_tag = '!encrypted'
- class salt.serializers.yaml.Loader(stream)
Overwrites Loader as not for pollute legacy Loader
- yaml_multi_constructors = {'!encrypted': <function EncryptedString.yaml_constructor>, 'tag:yaml.org,2002:binary': <function SafeConstructor.construct_yaml_binary>, 'tag:yaml.org,2002:bool': <function SafeConstructor.construct_yaml_bool>, 'tag:yaml.org,2002:float': <function SafeConstructor.construct_yaml_float>, 'tag:yaml.org,2002:int': <function SafeConstructor.construct_yaml_int>, 'tag:yaml.org,2002:map': <function SafeConstructor.construct_yaml_map>, 'tag:yaml.org,2002:null': <function SafeConstructor.construct_yaml_null>, 'tag:yaml.org,2002:omap': <function SafeConstructor.construct_yaml_omap>, 'tag:yaml.org,2002:pairs': <function SafeConstructor.construct_yaml_pairs>, 'tag:yaml.org,2002:seq': <function SafeConstructor.construct_yaml_seq>, 'tag:yaml.org,2002:set': <function SafeConstructor.construct_yaml_set>, 'tag:yaml.org,2002:str': <function SafeConstructor.construct_yaml_str>, 'tag:yaml.org,2002:timestamp': <function SafeConstructor.construct_yaml_timestamp>}
- class salt.serializers.yaml.OrderedDict
Dictionary that remembers insertion order
- clear() None. Remove all items from od.
- copy() a shallow copy of od
- fromkeys(value=None)
Create a new ordered dictionary with keys from iterable and values set to value.
- items() a set-like object providing a view on D's items
- keys() a set-like object providing a view on D's keys
- move_to_end(key, last=True)
Move an existing element to the end (or beginning if last is false).
Raise KeyError if the element does not exist.
- pop(key[, default]) v, remove specified key and return the corresponding value.
If the key is not found, return the default if given; otherwise, raise a KeyError.
- popitem(last=True)
Remove and return a (key, value) pair from the dictionary.
Pairs are returned in LIFO order if last is true or FIFO order if false.
- setdefault(key, default=None)
Insert key with a value of default if key is not in the dictionary.
Return the value for key if key is in the dictionary, else default.
- update([E, ]**F) None. Update D from dict/iterable E and F.
If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
- values() an object providing a view on D's values
- exception salt.serializers.yaml.ScannerError(context=None, context_mark=None, problem=None, problem_mark=None, note=None)
- exception salt.serializers.yaml.SerializationError(message='')
Raised when stream of string failed to be serialized
- salt.serializers.yaml.deserialize(stream_or_string, **options)
Deserialize any string of stream like object into a Python data structure.
- Parameters:
stream_or_string -- stream or string to deserialize.
options -- options given to lower yaml module.
- salt.serializers.yaml.serialize(obj, **options)
Serialize Python data to YAML.
- Parameters:
obj -- the data structure to serialize
options -- options given to lower yaml module.