2020-01-20 15:19:53 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2020-01-20 16:03:59 +00:00
|
|
|
from __future__ import absolute_import
|
|
|
|
|
2020-01-20 15:19:53 +00:00
|
|
|
from benedict.serializers.abstract import AbstractSerializer
|
|
|
|
|
|
|
|
import toml
|
|
|
|
|
|
|
|
|
|
|
|
class TOMLSerializer(AbstractSerializer):
|
|
|
|
|
2020-02-19 14:16:23 +00:00
|
|
|
@staticmethod
|
|
|
|
def decode(s, **kwargs):
|
2020-01-20 15:19:53 +00:00
|
|
|
data = toml.loads(s, **kwargs)
|
|
|
|
return data
|
|
|
|
|
2020-02-19 14:16:23 +00:00
|
|
|
@staticmethod
|
|
|
|
def encode(d, **kwargs):
|
2020-01-20 15:19:53 +00:00
|
|
|
data = toml.dumps(d, **kwargs)
|
|
|
|
return data
|