Completed
Push — master ( e6e2ec...0ced3f )
by Fabio
01:26
created

benedict.serializers.xml.XMLSerializer.__init__()   A

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nop 1
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
# -*- coding: utf-8 -*-
2
3
from benedict.serializers.abstract import AbstractSerializer
4
5
import xmltodict
6
7
8
class XMLSerializer(AbstractSerializer):
9
10
    def __init__(self):
11
        super(XMLSerializer, self).__init__()
12
13
    def decode(self, s, **kwargs):
14
        kwargs.setdefault('dict_constructor', dict)
15
        data = xmltodict.parse(s, **kwargs)
16
        return data
17
18
    def encode(self, d, **kwargs):
19
        data = xmltodict.unparse(d, **kwargs)
20
        return data
21