python-benedict/benedict/serializers/toml.py

23 lines
465 B
Python
Raw Normal View History

# -*- coding: utf-8 -*-
from benedict.serializers.abstract import AbstractSerializer
import toml
class TOMLSerializer(AbstractSerializer):
2022-02-13 10:56:44 +00:00
"""
This class describes a toml serializer.
"""
def __init__(self):
super(TOMLSerializer, self).__init__()
def decode(self, s, **kwargs):
data = toml.loads(s, **kwargs)
return data
def encode(self, d, **kwargs):
data = toml.dumps(d, **kwargs)
return data