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

Anticheat.from_ini()   A

Complexity

Conditions 1

Size

Total Lines 9

Duplication

Lines 9
Ratio 100 %

Code Coverage

Tests 1
CRAP Score 1.125

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 9
loc 9
ccs 1
cts 2
cp 0.5
rs 9.6666
cc 1
crap 1.125
1
# coding: utf-8
2
3 1
import zope.interface
4
5 1
from schematics.models import Model
6 1
from schematics.types import IntType
7 1
from schematics.types.compound import ModelType
8
9 1
from ..interfaces import INISerializable
10 1
from .lags import Lags
11 1
from .speedhack import Speedhack
12
13
14 1 View Code Duplication
@zope.interface.implementer(INISerializable)
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
15 1
class Anticheat(Model):
16 1
    version_check_level = IntType(
17
        min_value=0,
18
        max_value=2,
19
        default=0,
20
        required=True,
21
    )
22 1
    lags = ModelType(
23
        model_spec=Lags,
24
        required=True,
25
    )
26 1
    speedhack = ModelType(
27
        model_spec=Speedhack,
28
        required=True,
29
    )
30
31 1
    @classmethod
32
    def from_ini(cls, ini):
33
        return cls({
34
            'version_check_level': ini.getint(
35
                'NET', 'checkRuntime',
36
                fallback=cls.version_check_level.default,
37
            ),
38
            'lags': Lags.from_ini(ini),
39
            'speedhack': Speedhack.from_ini(ini),
40
        })
41