Code Duplication    Length = 13-13 lines in 2 locations

gvm/protocols/gmpv7.py 2 locations

@@ 1102-1114 (lines=13) @@
1099
            _xmlduration = cmd.add_element('duration', str(duration))
1100
            _xmlduration.add_element('unit', duration_unit)
1101
1102
        if period:
1103
            if not period_unit:
1104
                raise RequiredArgument(
1105
                    'Setting period requires period_unit argument')
1106
1107
            if not period_unit in TIME_UNITS:
1108
                raise InvalidArgument(
1109
                    'period_unit must be one of {units} but {actual} has '
1110
                    'been passed'.format(
1111
                        units=', '.join(TIME_UNITS), actual=period_unit))
1112
1113
            _xmlperiod = cmd.add_element('period', str(period))
1114
            _xmlperiod.add_element('unit', period_unit)
1115
1116
        if timezone:
1117
            cmd.add_element('timezone', timezone)
@@ 3786-3798 (lines=13) @@
3783
            _xmlduration = cmd.add_element('duration', str(duration))
3784
            _xmlduration.add_element('unit', duration_unit)
3785
3786
        if period:
3787
            if not period_unit:
3788
                raise RequiredArgument(
3789
                    'Setting period requires period_unit argument')
3790
3791
            if not period_unit in TIME_UNITS:
3792
                raise InvalidArgument(
3793
                    'period_unit must be one of {units} but {actual} has '
3794
                    'been passed'.format(
3795
                        units=', '.join(TIME_UNITS), actual=period_unit))
3796
3797
            _xmlperiod = cmd.add_element('period', str(period))
3798
            _xmlperiod.add_element('unit', period_unit)
3799
3800
        if timezone:
3801
            cmd.add_element('timezone', str(timezone))