Code Duplication    Length = 13-13 lines in 2 locations

gvm/protocols/gmpv7.py 2 locations

@@ 3992-4004 (lines=13) @@
3989
            _xmlduration = cmd.add_element('duration', str(duration))
3990
            _xmlduration.add_element('unit', duration_unit)
3991
3992
        if period:
3993
            if not period_unit:
3994
                raise RequiredArgument(
3995
                    'Setting period requires period_unit argument')
3996
3997
            if not period_unit in TIME_UNITS:
3998
                raise InvalidArgument(
3999
                    'period_unit must be one of {units} but {actual} has '
4000
                    'been passed'.format(
4001
                        units=', '.join(TIME_UNITS), actual=period_unit))
4002
4003
            _xmlperiod = cmd.add_element('period', str(period))
4004
            _xmlperiod.add_element('unit', period_unit)
4005
4006
        if timezone:
4007
            cmd.add_element('timezone', str(timezone))
@@ 1162-1174 (lines=13) @@
1159
            _xmlduration = cmd.add_element('duration', str(duration))
1160
            _xmlduration.add_element('unit', duration_unit)
1161
1162
        if period:
1163
            if not period_unit:
1164
                raise RequiredArgument(
1165
                    'Setting period requires period_unit argument')
1166
1167
            if not period_unit in TIME_UNITS:
1168
                raise InvalidArgument(
1169
                    'period_unit must be one of {units} but {actual} has '
1170
                    'been passed'.format(
1171
                        units=', '.join(TIME_UNITS), actual=period_unit))
1172
1173
            _xmlperiod = cmd.add_element('period', str(period))
1174
            _xmlperiod.add_element('unit', period_unit)
1175
1176
        if timezone:
1177
            cmd.add_element('timezone', timezone)