Code Duplication    Length = 38-40 lines in 3 locations

il2fb/config/ds/schemas/anticheat/speedhack.py 1 location

@@ 11-50 (lines=40) @@
8
from ..interfaces import INISerializable
9
10
11
@zope.interface.implementer(INISerializable)
12
class Speedhack(Model):
13
    check_server_time_speed = BooleanType(
14
        default=True,
15
        required=True,
16
    )
17
    check_client_time_speed = BooleanType(
18
        default=False,
19
        required=True,
20
    )
21
    max_time_difference = FloatType(
22
        min_value=0.01,
23
        default=0.2,
24
        required=True,
25
    )
26
    max_time_difference_period = FloatType(
27
        min_value=1,
28
        max_value=1000,
29
        default=17,
30
        required=True,
31
    )
32
33
    @classmethod
34
    def from_ini(cls, ini):
35
        return cls({
36
            'check_server_time_speed': ini.getboolean(
37
                'NET', 'checkServerTimeSpeed',
38
                fallback=cls.check_server_time_speed.default,
39
            ),
40
            'check_client_time_speed': ini.getboolean(
41
                'NET', 'checkClientTimeSpeed',
42
                fallback=cls.check_client_time_speed.default,
43
            ),
44
            'max_time_difference': ini.getfloat(
45
                'NET', 'checkTimeSpeedDifferense',
46
                fallback=cls.max_time_difference.default,
47
            ),
48
            'max_time_difference_period': ini.getfloat(
49
                'NET', 'checkTimeSpeedInterval',
50
                fallback=cls.max_time_difference_period.default,
51
            ),
52
        })
53

il2fb/config/ds/schemas/refly.py 1 location

@@ 11-50 (lines=40) @@
8
from .interfaces import INISerializable
9
10
11
@zope.interface.implementer(INISerializable)
12
class Refly(Model):
13
    is_disabled = BooleanType(
14
        default=False,
15
        required=True,
16
    )
17
    kia_delay = IntType(
18
        min_value=0,
19
        default=0,
20
        required=True,
21
    )
22
    kia_delay_multiplier = FloatType(
23
        min_value=0.0,
24
        default=0.0,
25
        required=True,
26
    )
27
    max_kia = IntType(
28
        min_value=-1,
29
        default=-1,
30
        required=True,
31
    )
32
33
    @classmethod
34
    def from_ini(cls, ini):
35
        return cls({
36
            'is_disabled': ini.getboolean(
37
                'NET', 'reflyDisabled',
38
                fallback=cls.is_disabled.default,
39
            ),
40
            'kia_delay': ini.getint(
41
                'NET', 'reflyKIADelay',
42
                fallback=cls.kia_delay.default,
43
            ),
44
            'kia_delay_multiplier': ini.getfloat(
45
                'NET', 'reflyKIADelayMultiplier',
46
                fallback=cls.kia_delay_multiplier.default,
47
            ),
48
            'max_kia': ini.getint(
49
                'NET', 'maxAllowedKIA',
50
                fallback=cls.max_kia.default,
51
            ),
52
        })
53

il2fb/config/ds/schemas/console.py 1 location

@@ 46-83 (lines=38) @@
43
        })
44
45
46
@zope.interface.implementer(INISerializable)
47
class Logging(Model):
48
    is_enabled = BooleanType(
49
        default=False,
50
        required=True,
51
    )
52
    file_name = StringType(
53
        default="log.lst",
54
        min_length=1,
55
        required=True,
56
    )
57
    keep = BooleanType(
58
        default=True,
59
        required=True,
60
    )
61
    log_time = BooleanType(
62
        default=False,
63
        required=True,
64
    )
65
66
    @classmethod
67
    def from_ini(cls, ini):
68
        return cls({
69
            'is_enabled': ini.getboolean(
70
                'Console', 'LOG',
71
                fallback=cls.is_enabled.default,
72
            ),
73
            'file_name': ini.get(
74
                'Console', 'LOGFILE',
75
                fallback=cls.file_name.default,
76
            ),
77
            'log_time': ini.getboolean(
78
                'Console', 'LOGTIME',
79
                fallback=cls.log_time.default,
80
            ),
81
            'keep': ini.getboolean(
82
                'Console', 'LOGKEEP',
83
                fallback=cls.keep.default,
84
            ),
85
        })
86