Total Complexity | 3 |
Total Lines | 49 |
Duplicated Lines | 0 % |
Coverage | 81.82% |
Changes | 3 | ||
Bugs | 0 | Features | 1 |
1 | # coding: utf-8 |
||
12 | 1 | @zope.interface.implementer(INISerializable) |
|
13 | 1 | @zope.interface.implementer(DefaultProvider) |
|
14 | 1 | class Refly(Model): |
|
15 | 1 | is_disabled = BooleanType( |
|
16 | default=False, |
||
17 | required=True, |
||
18 | ) |
||
19 | 1 | kia_delay = IntType( |
|
20 | min_value=0, |
||
21 | default=0, |
||
22 | required=True, |
||
23 | ) |
||
24 | 1 | kia_delay_multiplier = FloatType( |
|
25 | min_value=0.0, |
||
26 | default=0.0, |
||
27 | required=True, |
||
28 | ) |
||
29 | 1 | max_kia = IntType( |
|
30 | min_value=-1, |
||
31 | default=-1, |
||
32 | required=True, |
||
33 | ) |
||
34 | |||
35 | 1 | @classmethod |
|
36 | def from_ini(cls, ini): |
||
37 | return cls({ |
||
38 | 'is_disabled': field_from_ini( |
||
39 | cls.is_disabled, ini, |
||
40 | 'NET', 'reflyDisabled', |
||
41 | ), |
||
42 | 'kia_delay': field_from_ini( |
||
43 | cls.kia_delay, ini, |
||
44 | 'NET', 'reflyKIADelay', |
||
45 | ), |
||
46 | 'kia_delay_multiplier': field_from_ini( |
||
47 | cls.kia_delay_multiplier, ini, |
||
48 | 'NET', 'reflyKIADelayMultiplier', |
||
49 | ), |
||
50 | 'max_kia': field_from_ini( |
||
51 | cls.max_kia, ini, |
||
52 | 'NET', 'maxAllowedKIA', |
||
53 | ), |
||
54 | }) |
||
55 | |||
56 | 1 | @classmethod |
|
57 | def default(cls): |
||
58 | return cls({ |
||
59 | field_name: field.default |
||
60 | for field_name, field in cls.fields.items() |
||
61 | }) |
||
62 |