Code Duplication    Length = 13-13 lines in 2 locations

gvm/protocols/gmpv7.py 2 locations

@@ 3925-3937 (lines=13) @@
3922
            _xmlduration = cmd.add_element('duration', str(duration))
3923
            _xmlduration.add_element('unit', duration_unit)
3924
3925
        if period:
3926
            if not period_unit:
3927
                raise RequiredArgument(
3928
                    'Setting period requires period_unit argument')
3929
3930
            if not period_unit in TIME_UNITS:
3931
                raise InvalidArgument(
3932
                    'period_unit must be one of {units} but {actual} has '
3933
                    'been passed'.format(
3934
                        units=', '.join(TIME_UNITS), actual=period_unit))
3935
3936
            _xmlperiod = cmd.add_element('period', str(period))
3937
            _xmlperiod.add_element('unit', period_unit)
3938
3939
        if timezone:
3940
            cmd.add_element('timezone', str(timezone))
@@ 1118-1130 (lines=13) @@
1115
            _xmlduration = cmd.add_element('duration', str(duration))
1116
            _xmlduration.add_element('unit', duration_unit)
1117
1118
        if period:
1119
            if not period_unit:
1120
                raise RequiredArgument(
1121
                    'Setting period requires period_unit argument')
1122
1123
            if not period_unit in TIME_UNITS:
1124
                raise InvalidArgument(
1125
                    'period_unit must be one of {units} but {actual} has '
1126
                    'been passed'.format(
1127
                        units=', '.join(TIME_UNITS), actual=period_unit))
1128
1129
            _xmlperiod = cmd.add_element('period', str(period))
1130
            _xmlperiod.add_element('unit', period_unit)
1131
1132
        if timezone:
1133
            cmd.add_element('timezone', timezone)