Code Duplication    Length = 13-13 lines in 2 locations

gvm/protocols/gmpv7.py 2 locations

@@ 4174-4186 (lines=13) @@
4171
            _xmlftime.add_element('month', str(first_time_month))
4172
            _xmlftime.add_element('year', str(first_time_year))
4173
4174
        if duration:
4175
            if not duration_unit:
4176
                raise RequiredArgument(
4177
                    'Setting duration requires duration_unit argument')
4178
4179
            if not duration_unit in TIME_UNITS:
4180
                raise InvalidArgument(
4181
                    'duration_unit must be one of {units} but {actual} has '
4182
                    'been passed'.format(
4183
                        units=', '.join(TIME_UNITS), actual=duration_unit))
4184
4185
            _xmlduration = cmd.add_element('duration', str(duration))
4186
            _xmlduration.add_element('unit', duration_unit)
4187
4188
        if period:
4189
            if not period_unit:
@@ 1328-1340 (lines=13) @@
1325
            _xmlftime.add_element('month', str(first_time_month))
1326
            _xmlftime.add_element('year', str(first_time_year))
1327
1328
        if duration:
1329
            if not duration_unit:
1330
                raise RequiredArgument(
1331
                    'Setting duration requires duration_unit argument')
1332
1333
            if not duration_unit in TIME_UNITS:
1334
                raise InvalidArgument(
1335
                    'duration_unit must be one of {units} but {actual} has '
1336
                    'been passed'.format(
1337
                        units=', '.join(TIME_UNITS), actual=duration_unit))
1338
1339
            _xmlduration = cmd.add_element('duration', str(duration))
1340
            _xmlduration.add_element('unit', duration_unit)
1341
1342
        if period:
1343
            if not period_unit: