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

@@ 1474-1486 (lines=13) @@
1471
                for alert in alert_ids:
1472
                    cmd.add_element("alert", attrs={"id": str(alert)})
1473
1474
        if schedule_id:
1475
            cmd.add_element("schedule", attrs={"id": schedule_id})
1476
1477
            if schedule_periods is not None:
1478
                if (
1479
                    not isinstance(schedule_periods, Integral)
1480
                    or schedule_periods < 0
1481
                ):
1482
                    raise InvalidArgument(
1483
                        "schedule_periods must be an integer greater or equal "
1484
                        "than 0"
1485
                    )
1486
                cmd.add_element("schedule_periods", str(schedule_periods))
1487
1488
        if observers is not None:
1489
            if not is_list_like(observers):