Code Duplication    Length = 13-13 lines in 2 locations

gvm/protocols/gmpv7/__init__.py 1 location

@@ 1902-1914 (lines=13) @@
1899
                for alert in alert_ids:
1900
                    cmd.add_element("alert", attrs={"id": str(alert)})
1901
1902
        if schedule_id:
1903
            cmd.add_element("schedule", attrs={"id": schedule_id})
1904
1905
            if schedule_periods is not None:
1906
                if (
1907
                    not isinstance(schedule_periods, numbers.Integral)
1908
                    or schedule_periods < 0
1909
                ):
1910
                    raise InvalidArgument(
1911
                        "schedule_periods must be an integer greater or equal "
1912
                        "than 0"
1913
                    )
1914
                cmd.add_element("schedule_periods", str(schedule_periods))
1915
1916
        if observers is not None:
1917
            if not _is_list_like(observers):

gvm/protocols/gmpv9/__init__.py 1 location

@@ 416-428 (lines=13) @@
413
                for alert in alert_ids:
414
                    cmd.add_element("alert", attrs={"id": str(alert)})
415
416
        if schedule_id:
417
            cmd.add_element("schedule", attrs={"id": schedule_id})
418
419
            if schedule_periods is not None:
420
                if (
421
                    not isinstance(schedule_periods, numbers.Integral)
422
                    or schedule_periods < 0
423
                ):
424
                    raise InvalidArgument(
425
                        "schedule_periods must be an integer greater or equal "
426
                        "than 0"
427
                    )
428
                cmd.add_element("schedule_periods", str(schedule_periods))
429
430
        if observers is not None:
431
            if not _is_list_like(observers):