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

@@ 1293-1305 (lines=13) @@
1290
                for alert in alert_ids:
1291
                    cmd.add_element("alert", attrs={"id": str(alert)})
1292
1293
        if schedule_id:
1294
            cmd.add_element("schedule", attrs={"id": schedule_id})
1295
1296
            if schedule_periods is not None:
1297
                if (
1298
                    not isinstance(schedule_periods, Integral)
1299
                    or schedule_periods < 0
1300
                ):
1301
                    raise InvalidArgument(
1302
                        "schedule_periods must be an integer greater or equal "
1303
                        "than 0"
1304
                    )
1305
                cmd.add_element("schedule_periods", str(schedule_periods))
1306
1307
        if observers is not None:
1308
            if not is_list_like(observers):