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

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