Code Duplication    Length = 13-13 lines in 2 locations

gvm/protocols/gmpv7.py 2 locations

@@ 3053-3065 (lines=13) @@
3050
            _xmlduration = cmd.add_element('duration', str(duration))
3051
            _xmlduration.add_element('unit', duration_unit)
3052
3053
        if period:
3054
            if not period_unit:
3055
                raise RequiredArgument(
3056
                    'Setting period requires period_unit argument')
3057
3058
            if not period_unit in TIME_UNITS:
3059
                raise InvalidArgument(
3060
                    'period_unit must be one of {units} but {actual} has '
3061
                    'been passed'.format(
3062
                        units=', '.join(TIME_UNITS), actual=period_unit))
3063
3064
            _xmlperiod = cmd.add_element('period', str(period))
3065
            _xmlperiod.add_element('unit', period_unit)
3066
3067
        if timezone:
3068
            cmd.add_element('timezone', str(timezone))
@@ 1105-1117 (lines=13) @@
1102
            _xmlduration = cmd.add_element('duration', str(duration))
1103
            _xmlduration.add_element('unit', duration_unit)
1104
1105
        if period:
1106
            if not period_unit:
1107
                raise RequiredArgument(
1108
                    'Setting period requires period_unit argument')
1109
1110
            if not period_unit in TIME_UNITS:
1111
                raise InvalidArgument(
1112
                    'period_unit must be one of {units} but {actual} has '
1113
                    'been passed'.format(
1114
                        units=', '.join(TIME_UNITS), actual=period_unit))
1115
1116
            _xmlperiod = cmd.add_element('period', str(period))
1117
            _xmlperiod.add_element('unit', period_unit)
1118
1119
        if timezone:
1120
            cmd.add_element('timezone', timezone)