mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Improve toml docs
This commit is contained in:
parent
ed79b663c0
commit
37db1d0f4e
1 changed files with 5 additions and 11 deletions
|
@ -1,22 +1,16 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
salt.serializers.toml
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Implements TOML serializer.
|
||||
|
||||
It's just a wrapper around pytoml module.
|
||||
It's just a wrapper around the python toml module.
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
# Import 3rd-party libs
|
||||
from salt.ext import six
|
||||
|
||||
# Import Salt libs
|
||||
from salt.serializers import DeserializationError, SerializationError
|
||||
|
||||
# Import pytoml
|
||||
# Import toml
|
||||
try:
|
||||
import toml
|
||||
|
||||
|
@ -33,11 +27,11 @@ def deserialize(stream_or_string, **options):
|
|||
Deserialize from TOML into Python data structure.
|
||||
|
||||
:param stream_or_string: toml stream or string to deserialize.
|
||||
:param options: options given to lower pytoml module.
|
||||
:param options: options given to the python toml module.
|
||||
"""
|
||||
|
||||
try:
|
||||
if not isinstance(stream_or_string, (bytes, six.string_types)):
|
||||
if not isinstance(stream_or_string, (bytes, str)):
|
||||
return toml.load(stream_or_string, **options)
|
||||
|
||||
if isinstance(stream_or_string, bytes):
|
||||
|
@ -53,7 +47,7 @@ def serialize(obj, **options):
|
|||
Serialize Python data to TOML.
|
||||
|
||||
:param obj: the data structure to serialize.
|
||||
:param options: options given to lower pytoml module.
|
||||
:param options: options given to the python toml module.
|
||||
"""
|
||||
|
||||
try:
|
||||
|
|
Loading…
Add table
Reference in a new issue