Code Duplication    Length = 13-13 lines in 2 locations

gvm/protocols/gmpv7.py 2 locations

@@ 1198-1210 (lines=13) @@
1195
            _xmlduration = cmd.add_element('duration', str(duration))
1196
            _xmlduration.add_element('unit', duration_unit)
1197
1198
        if period:
1199
            if not period_unit:
1200
                raise RequiredArgument(
1201
                    'Setting period requires period_unit argument')
1202
1203
            if not period_unit in TIME_UNITS:
1204
                raise InvalidArgument(
1205
                    'period_unit must be one of {units} but {actual} has '
1206
                    'been passed'.format(
1207
                        units=', '.join(TIME_UNITS), actual=period_unit))
1208
1209
            _xmlperiod = cmd.add_element('period', str(period))
1210
            _xmlperiod.add_element('unit', period_unit)
1211
1212
        if timezone:
1213
            cmd.add_element('timezone', timezone)
@@ 4028-4040 (lines=13) @@
4025
            _xmlduration = cmd.add_element('duration', str(duration))
4026
            _xmlduration.add_element('unit', duration_unit)
4027
4028
        if period:
4029
            if not period_unit:
4030
                raise RequiredArgument(
4031
                    'Setting period requires period_unit argument')
4032
4033
            if not period_unit in TIME_UNITS:
4034
                raise InvalidArgument(
4035
                    'period_unit must be one of {units} but {actual} has '
4036
                    'been passed'.format(
4037
                        units=', '.join(TIME_UNITS), actual=period_unit))
4038
4039
            _xmlperiod = cmd.add_element('period', str(period))
4040
            _xmlperiod.add_element('unit', period_unit)
4041
4042
        if timezone:
4043
            cmd.add_element('timezone', str(timezone))