Completed
Push — master ( b95acc...a5fbcd )
by Oleksandr
01:06
created

About   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 83.33%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 1
c 2
b 0
f 0
dl 0
loc 21
ccs 5
cts 6
cp 0.8333
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A from_ini() 0 10 1
1
# coding: utf-8
2
3 1
import zope.interface
4
5 1
from schematics.models import Model
6 1
from schematics.types import StringType
7
8 1
from .interfaces import INISerializable
9
10
11 1
@zope.interface.implementer(INISerializable)
12 1
class About(Model):
13 1
    name = StringType(
14
        default="",
15
        required=True,
16
    )
17 1
    description = StringType(
18
        default="",
19
        required=True,
20
    )
21
22 1
    @classmethod
23
    def from_ini(cls, ini):
24
        return cls({
25
            'name': ini.get(
26
                'NET', 'serverName',
27
                fallback=cls.name.default,
28
            ),
29
            'description': ini.get(
30
                'NET', 'serverDescription',
31
                fallback=cls.description.default,
32
            ),
33
        })
34