Code Duplication    Length = 61-62 lines in 2 locations

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

@@ 11-72 (lines=62) @@
8
from .interfaces import INISerializable
9
10
11
@zope.interface.implementer(INISerializable)
12
class Other(Model):
13
    difficulty = IntType(
14
        min_value=0,
15
        default=193791,
16
        required=True,
17
    )
18
    display_custom_skins = BooleanType(
19
        default=True,
20
        required=True,
21
    )
22
    allow_custom_sounds = BooleanType(
23
        default=True,
24
        required=True,
25
    )
26
    filter_user_names = BooleanType(
27
        default=False,
28
        required=True,
29
    )
30
    small_way_point_labels = BooleanType(
31
        default=True,
32
        required=True,
33
    )
34
    skip_paratrooper_views = BooleanType(
35
        default=False,
36
        required=True,
37
    )
38
    new_clouds = BooleanType(
39
        default=True,
40
        required=True,
41
    )
42
43
    @classmethod
44
    def from_ini(cls, ini):
45
        return cls({
46
            'difficulty': ini.getint(
47
                'NET', 'difficulty',
48
                fallback=cls.difficulty.default,
49
            ),
50
            'display_custom_skins': ini.getboolean(
51
                'NET', 'SkinDownload',
52
                fallback=cls.display_custom_skins.default,
53
            ),
54
            'allow_custom_sounds': ini.getboolean(
55
                'NET', 'allowCustomSounds',
56
                fallback=cls.allow_custom_sounds.default,
57
            ),
58
            'filter_user_names': ini.getboolean(
59
                'NET', 'filterUserNames',
60
                fallback=cls.filter_user_names.default,
61
            ),
62
            'small_way_point_labels': ini.getboolean(
63
                'game', 'SmallMapWPLabels',
64
                fallback=cls.small_way_point_labels.default,
65
            ),
66
            'skip_paratrooper_views': ini.getboolean(
67
                'game', 'SkipParatrooperViews',
68
                fallback=cls.skip_paratrooper_views.default,
69
            ),
70
            'new_clouds': ini.getboolean(
71
                'game', 'TypeClouds',
72
                fallback=cls.new_clouds.default,
73
            ),
74
        })
75

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

@@ 12-72 (lines=61) @@
9
from .interfaces import INISerializable
10
11
12
@zope.interface.implementer(INISerializable)
13
class Users(Model):
14
    show_number = BooleanType(
15
        default=True,
16
        required=True,
17
    )
18
    show_ping = BooleanType(
19
        default=True,
20
        required=True,
21
    )
22
    show_name = BooleanType(
23
        default=True,
24
        required=True,
25
    )
26
    show_belligerent = BooleanType(
27
        default=True,
28
        required=True,
29
    )
30
    show_aircraft_designation = BooleanType(
31
        default=True,
32
        required=True,
33
    )
34
    show_aircraft_type = BooleanType(
35
        default=True,
36
        required=True,
37
    )
38
    show_score = BooleanType(
39
        default=True,
40
        required=True,
41
    )
42
43
    @classmethod
44
    def from_ini(cls, ini):
45
        return cls({
46
            'show_number': ini.getboolean(
47
                'NET', 'showPilotNumber',
48
                fallback=cls.show_number.default,
49
            ),
50
            'show_ping': ini.getboolean(
51
                'NET', 'showPilotPing',
52
                fallback=cls.show_ping.default,
53
            ),
54
            'show_name': ini.getboolean(
55
                'NET', 'showPilotName',
56
                fallback=cls.show_name.default,
57
            ),
58
            'show_belligerent': ini.getboolean(
59
                'NET', 'showPilotArmy',
60
                fallback=cls.show_belligerent.default,
61
            ),
62
            'show_aircraft_designation': ini.getboolean(
63
                'NET', 'showPilotACDesignation',
64
                fallback=cls.show_aircraft_designation.default,
65
            ),
66
            'show_aircraft_type': ini.getboolean(
67
                'NET', 'showPilotACType',
68
                fallback=cls.show_aircraft_type.default,
69
            ),
70
            'show_score': ini.getboolean(
71
                'NET', 'showPilotScore',
72
                fallback=cls.show_score.default,
73
            ),
74
        })
75