Code Duplication    Length = 13-13 lines in 2 locations

gvm/protocols/gmpv208/gmpv208.py 1 location

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

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):