Code Duplication    Length = 13-13 lines in 2 locations

gvm/protocols/gmpv7.py 2 locations

@@ 3039-3051 (lines=13) @@
3036
            _xmlftime.add_element('month', str(first_time_month))
3037
            _xmlftime.add_element('year', str(first_time_year))
3038
3039
        if duration:
3040
            if not duration_unit:
3041
                raise RequiredArgument(
3042
                    'Setting duration requires duration_unit argument')
3043
3044
            if not duration_unit in TIME_UNITS:
3045
                raise InvalidArgument(
3046
                    'duration_unit must be one of {units} but {actual} has '
3047
                    'been passed'.format(
3048
                        units=', '.join(TIME_UNITS), actual=duration_unit))
3049
3050
            _xmlduration = cmd.add_element('duration', str(duration))
3051
            _xmlduration.add_element('unit', duration_unit)
3052
3053
        if period:
3054
            if not period_unit:
@@ 1091-1103 (lines=13) @@
1088
            _xmlftime.add_element('month', str(first_time_month))
1089
            _xmlftime.add_element('year', str(first_time_year))
1090
1091
        if duration:
1092
            if not duration_unit:
1093
                raise RequiredArgument(
1094
                    'Setting duration requires duration_unit argument')
1095
1096
            if not duration_unit in TIME_UNITS:
1097
                raise InvalidArgument(
1098
                    'duration_unit must be one of {units} but {actual} has '
1099
                    'been passed'.format(
1100
                        units=', '.join(TIME_UNITS), actual=duration_unit))
1101
1102
            _xmlduration = cmd.add_element('duration', str(duration))
1103
            _xmlduration.add_element('unit', duration_unit)
1104
1105
        if period:
1106
            if not period_unit: