Code Duplication    Length = 13-13 lines in 2 locations

gvm/protocols/gmpv7.py 2 locations

@@ 4065-4077 (lines=13) @@
4062
            _xmlduration = cmd.add_element('duration', str(duration))
4063
            _xmlduration.add_element('unit', duration_unit)
4064
4065
        if period:
4066
            if not period_unit:
4067
                raise RequiredArgument(
4068
                    'Setting period requires period_unit argument')
4069
4070
            if not period_unit in TIME_UNITS:
4071
                raise InvalidArgument(
4072
                    'period_unit must be one of {units} but {actual} has '
4073
                    'been passed'.format(
4074
                        units=', '.join(TIME_UNITS), actual=period_unit))
4075
4076
            _xmlperiod = cmd.add_element('period', str(period))
4077
            _xmlperiod.add_element('unit', period_unit)
4078
4079
        if timezone:
4080
            cmd.add_element('timezone', str(timezone))
@@ 1232-1244 (lines=13) @@
1229
            _xmlduration = cmd.add_element('duration', str(duration))
1230
            _xmlduration.add_element('unit', duration_unit)
1231
1232
        if period:
1233
            if not period_unit:
1234
                raise RequiredArgument(
1235
                    'Setting period requires period_unit argument')
1236
1237
            if not period_unit in TIME_UNITS:
1238
                raise InvalidArgument(
1239
                    'period_unit must be one of {units} but {actual} has '
1240
                    'been passed'.format(
1241
                        units=', '.join(TIME_UNITS), actual=period_unit))
1242
1243
            _xmlperiod = cmd.add_element('period', str(period))
1244
            _xmlperiod.add_element('unit', period_unit)
1245
1246
        if timezone:
1247
            cmd.add_element('timezone', timezone)