Code Duplication    Length = 13-13 lines in 2 locations

gvm/protocols/gmpv7.py 2 locations

@@ 1239-1251 (lines=13) @@
1236
            _xmlduration = cmd.add_element('duration', str(duration))
1237
            _xmlduration.add_element('unit', duration_unit)
1238
1239
        if period:
1240
            if not period_unit:
1241
                raise RequiredArgument(
1242
                    'Setting period requires period_unit argument')
1243
1244
            if not period_unit in TIME_UNITS:
1245
                raise InvalidArgument(
1246
                    'period_unit must be one of {units} but {actual} has '
1247
                    'been passed'.format(
1248
                        units=', '.join(TIME_UNITS), actual=period_unit))
1249
1250
            _xmlperiod = cmd.add_element('period', str(period))
1251
            _xmlperiod.add_element('unit', period_unit)
1252
1253
        if timezone:
1254
            cmd.add_element('timezone', timezone)
@@ 4072-4084 (lines=13) @@
4069
            _xmlduration = cmd.add_element('duration', str(duration))
4070
            _xmlduration.add_element('unit', duration_unit)
4071
4072
        if period:
4073
            if not period_unit:
4074
                raise RequiredArgument(
4075
                    'Setting period requires period_unit argument')
4076
4077
            if not period_unit in TIME_UNITS:
4078
                raise InvalidArgument(
4079
                    'period_unit must be one of {units} but {actual} has '
4080
                    'been passed'.format(
4081
                        units=', '.join(TIME_UNITS), actual=period_unit))
4082
4083
            _xmlperiod = cmd.add_element('period', str(period))
4084
            _xmlperiod.add_element('unit', period_unit)
4085
4086
        if timezone:
4087
            cmd.add_element('timezone', str(timezone))