Code Duplication    Length = 13-13 lines in 2 locations

gvm/protocols/gmpv7.py 2 locations

@@ 4045-4057 (lines=13) @@
4042
            _xmlduration = cmd.add_element('duration', str(duration))
4043
            _xmlduration.add_element('unit', duration_unit)
4044
4045
        if period:
4046
            if not period_unit:
4047
                raise RequiredArgument(
4048
                    'Setting period requires period_unit argument')
4049
4050
            if not period_unit in TIME_UNITS:
4051
                raise InvalidArgument(
4052
                    'period_unit must be one of {units} but {actual} has '
4053
                    'been passed'.format(
4054
                        units=', '.join(TIME_UNITS), actual=period_unit))
4055
4056
            _xmlperiod = cmd.add_element('period', str(period))
4057
            _xmlperiod.add_element('unit', period_unit)
4058
4059
        if timezone:
4060
            cmd.add_element('timezone', str(timezone))
@@ 1215-1227 (lines=13) @@
1212
            _xmlduration = cmd.add_element('duration', str(duration))
1213
            _xmlduration.add_element('unit', duration_unit)
1214
1215
        if period:
1216
            if not period_unit:
1217
                raise RequiredArgument(
1218
                    'Setting period requires period_unit argument')
1219
1220
            if not period_unit in TIME_UNITS:
1221
                raise InvalidArgument(
1222
                    'period_unit must be one of {units} but {actual} has '
1223
                    'been passed'.format(
1224
                        units=', '.join(TIME_UNITS), actual=period_unit))
1225
1226
            _xmlperiod = cmd.add_element('period', str(period))
1227
            _xmlperiod.add_element('unit', period_unit)
1228
1229
        if timezone:
1230
            cmd.add_element('timezone', timezone)