Code Duplication    Length = 13-13 lines in 2 locations

gvm/protocols/gmpv7.py 2 locations

@@ 1225-1237 (lines=13) @@
1222
            _xmlftime.add_element('month', str(first_time_month))
1223
            _xmlftime.add_element('year', str(first_time_year))
1224
1225
        if duration:
1226
            if not duration_unit:
1227
                raise RequiredArgument(
1228
                    'Setting duration requires duration_unit argument')
1229
1230
            if not duration_unit in TIME_UNITS:
1231
                raise InvalidArgument(
1232
                    'duration_unit must be one of {units} but {actual} has '
1233
                    'been passed'.format(
1234
                        units=', '.join(TIME_UNITS), actual=duration_unit))
1235
1236
            _xmlduration = cmd.add_element('duration', str(duration))
1237
            _xmlduration.add_element('unit', duration_unit)
1238
1239
        if period:
1240
            if not period_unit:
@@ 4058-4070 (lines=13) @@
4055
            _xmlftime.add_element('month', str(first_time_month))
4056
            _xmlftime.add_element('year', str(first_time_year))
4057
4058
        if duration:
4059
            if not duration_unit:
4060
                raise RequiredArgument(
4061
                    'Setting duration requires duration_unit argument')
4062
4063
            if not duration_unit in TIME_UNITS:
4064
                raise InvalidArgument(
4065
                    'duration_unit must be one of {units} but {actual} has '
4066
                    'been passed'.format(
4067
                        units=', '.join(TIME_UNITS), actual=duration_unit))
4068
4069
            _xmlduration = cmd.add_element('duration', str(duration))
4070
            _xmlduration.add_element('unit', duration_unit)
4071
4072
        if period:
4073
            if not period_unit: