Code Duplication    Length = 13-13 lines in 2 locations

gvm/protocols/gmpv7.py 2 locations

@@ 4188-4200 (lines=13) @@
4185
            _xmlduration = cmd.add_element('duration', str(duration))
4186
            _xmlduration.add_element('unit', duration_unit)
4187
4188
        if period:
4189
            if not period_unit:
4190
                raise RequiredArgument(
4191
                    'Setting period requires period_unit argument')
4192
4193
            if not period_unit in TIME_UNITS:
4194
                raise InvalidArgument(
4195
                    'period_unit must be one of {units} but {actual} has '
4196
                    'been passed'.format(
4197
                        units=', '.join(TIME_UNITS), actual=period_unit))
4198
4199
            _xmlperiod = cmd.add_element('period', str(period))
4200
            _xmlperiod.add_element('unit', period_unit)
4201
4202
        if timezone:
4203
            cmd.add_element('timezone', str(timezone))
@@ 1342-1354 (lines=13) @@
1339
            _xmlduration = cmd.add_element('duration', str(duration))
1340
            _xmlduration.add_element('unit', duration_unit)
1341
1342
        if period:
1343
            if not period_unit:
1344
                raise RequiredArgument(
1345
                    'Setting period requires period_unit argument')
1346
1347
            if not period_unit in TIME_UNITS:
1348
                raise InvalidArgument(
1349
                    'period_unit must be one of {units} but {actual} has '
1350
                    'been passed'.format(
1351
                        units=', '.join(TIME_UNITS), actual=period_unit))
1352
1353
            _xmlperiod = cmd.add_element('period', str(period))
1354
            _xmlperiod.add_element('unit', period_unit)
1355
1356
        if timezone:
1357
            cmd.add_element('timezone', timezone)