Code Duplication    Length = 28-34 lines in 2 locations

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

@@ 169-202 (lines=34) @@
166
        })
167
168
169
@zope.interface.implementer(INISerializable)
170
@zope.interface.implementer(DefaultProvider)
171
class Console(Model):
172
    connection = ModelType(
173
        model_spec=Connection,
174
        required=True,
175
    )
176
    logging = ModelType(
177
        model_spec=Logging,
178
        required=True,
179
    )
180
    history = ModelType(
181
        model_spec=History,
182
        required=True,
183
    )
184
185
    @classmethod
186
    def from_ini(cls, ini):
187
        return cls({
188
            'connection': Connection.from_ini(ini),
189
            'logging': Logging.from_ini(ini),
190
            'history': History.from_ini(ini),
191
        })
192
193
    def to_ini(self, ini):
194
        for field_name in self.iter():
195
            self[field_name].to_ini(ini)
196
197
    @classmethod
198
    def default(cls):
199
        return cls({
200
            'connection': Connection.default(),
201
            'logging': Logging.default(),
202
            'history': History.default(),
203
        })
204

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

@@ 119-146 (lines=28) @@
116
        })
117
118
119
@zope.interface.implementer(INISerializable)
120
@zope.interface.implementer(DefaultProvider)
121
class Lags(Model):
122
    max_time = ModelType(
123
        model_spec=MaxTime,
124
        required=True,
125
    )
126
    warnings = ModelType(
127
        model_spec=Warnings,
128
        required=True,
129
    )
130
131
    @classmethod
132
    def from_ini(cls, ini):
133
        return cls({
134
            'max_time': MaxTime.from_ini(ini),
135
            'warnings': Warnings.from_ini(ini),
136
        })
137
138
    def to_ini(self, ini):
139
        for field_name in self.iter():
140
            self[field_name].to_ini(ini)
141
142
    @classmethod
143
    def default(cls):
144
        return cls({
145
            'max_time': MaxTime.default(),
146
            'warnings': Warnings.default(),
147
        })
148