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

@@ 441-453 (lines=13) @@
438
                for alert in alert_ids:
439
                    cmd.add_element("alert", attrs={"id": str(alert)})
440
441
        if schedule_id:
442
            cmd.add_element("schedule", attrs={"id": schedule_id})
443
444
            if schedule_periods is not None:
445
                if (
446
                    not isinstance(schedule_periods, numbers.Integral)
447
                    or schedule_periods < 0
448
                ):
449
                    raise InvalidArgument(
450
                        "schedule_periods must be an integer greater or equal "
451
                        "than 0"
452
                    )
453
                cmd.add_element("schedule_periods", str(schedule_periods))
454
455
        if observers is not None:
456
            if not _is_list_like(observers):