Code Duplication    Length = 13-13 lines in 2 locations

gvm/protocols/gmpv208/entities/tasks.py 1 location

@@ 149-161 (lines=13) @@
146
                for alert in alert_ids:
147
                    cmd.add_element("alert", attrs={"id": str(alert)})
148
149
        if schedule_id:
150
            cmd.add_element("schedule", attrs={"id": schedule_id})
151
152
            if schedule_periods is not None:
153
                if (
154
                    not isinstance(schedule_periods, Integral)
155
                    or schedule_periods < 0
156
                ):
157
                    raise InvalidArgument(
158
                        "schedule_periods must be an integer greater or equal "
159
                        "than 0"
160
                    )
161
                cmd.add_element("schedule_periods", str(schedule_periods))
162
163
        if observers is not None:
164
            if not is_list_like(observers):

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 1805-1817 (lines=13) @@
1802
                for alert in alert_ids:
1803
                    cmd.add_element("alert", attrs={"id": str(alert)})
1804
1805
        if schedule_id:
1806
            cmd.add_element("schedule", attrs={"id": schedule_id})
1807
1808
            if schedule_periods is not None:
1809
                if (
1810
                    not isinstance(schedule_periods, numbers.Integral)
1811
                    or schedule_periods < 0
1812
                ):
1813
                    raise InvalidArgument(
1814
                        "schedule_periods must be an integer greater or equal "
1815
                        "than 0"
1816
                    )
1817
                cmd.add_element("schedule_periods", str(schedule_periods))
1818
1819
        if observers is not None:
1820
            if not is_list_like(observers):