Code Duplication    Length = 35-36 lines in 3 locations

gvm/protocols/gmpv7/gmpv7.py 2 locations

@@ 4266-4301 (lines=36) @@
4263
4264
        return self._send_xml_command(cmd)
4265
4266
    def get_tasks(
4267
        self,
4268
        *,
4269
        filter: Optional[str] = None,
4270
        filter_id: Optional[str] = None,
4271
        trash: Optional[bool] = None,
4272
        details: Optional[bool] = None,
4273
        schedules_only: Optional[bool] = None,
4274
    ) -> Any:
4275
        """Request a list of tasks
4276
4277
        Arguments:
4278
            filter: Filter term to use for the query
4279
            filter_id: UUID of an existing filter to use for the query
4280
            trash: Whether to get the trashcan tasks instead
4281
            details: Whether to include full task details
4282
            schedules_only: Whether to only include id, name and schedule
4283
                details
4284
4285
        Returns:
4286
            The response. See :py:meth:`send_command` for details.
4287
        """
4288
        cmd = XmlCommand("get_tasks")
4289
4290
        _add_filter(cmd, filter, filter_id)
4291
4292
        if trash is not None:
4293
            cmd.set_attribute("trash", _to_bool(trash))
4294
4295
        if details is not None:
4296
            cmd.set_attribute("details", _to_bool(details))
4297
4298
        if schedules_only is not None:
4299
            cmd.set_attribute("schedules_only", _to_bool(schedules_only))
4300
4301
        return self._send_xml_command(cmd)
4302
4303
    def get_task(self, task_id: str) -> Any:
4304
        """Request a single task
@@ 3567-3601 (lines=35) @@
3564
        cmd.set_attribute("permission_id", permission_id)
3565
        return self._send_xml_command(cmd)
3566
3567
    def get_port_lists(
3568
        self,
3569
        *,
3570
        filter: Optional[str] = None,
3571
        filter_id: Optional[str] = None,
3572
        details: Optional[bool] = None,
3573
        targets: Optional[bool] = None,
3574
        trash: Optional[bool] = None,
3575
    ) -> Any:
3576
        """Request a list of port lists
3577
3578
        Arguments:
3579
            filter: Filter term to use for the query
3580
            filter_id: UUID of an existing filter to use for the query
3581
            details: Whether to include full port list details
3582
            targets: Whether to include targets using this port list
3583
            trash: Whether to get port lists in the trashcan instead
3584
3585
        Returns:
3586
            The response. See :py:meth:`send_command` for details.
3587
        """
3588
        cmd = XmlCommand("get_port_lists")
3589
3590
        _add_filter(cmd, filter, filter_id)
3591
3592
        if details is not None:
3593
            cmd.set_attribute("details", _to_bool(details))
3594
3595
        if targets is not None:
3596
            cmd.set_attribute("targets", _to_bool(targets))
3597
3598
        if trash is not None:
3599
            cmd.set_attribute("trash", _to_bool(trash))
3600
3601
        return self._send_xml_command(cmd)
3602
3603
    def get_port_list(self, port_list_id: str):
3604
        """Request a single port list

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 5233-5267 (lines=35) @@
5230
        cmd.set_attribute("permission_id", permission_id)
5231
        return self._send_xml_command(cmd)
5232
5233
    def get_port_lists(
5234
        self,
5235
        *,
5236
        filter: Optional[str] = None,
5237
        filter_id: Optional[str] = None,
5238
        details: Optional[bool] = None,
5239
        targets: Optional[bool] = None,
5240
        trash: Optional[bool] = None,
5241
    ) -> Any:
5242
        """Request a list of port lists
5243
5244
        Arguments:
5245
            filter: Filter term to use for the query
5246
            filter_id: UUID of an existing filter to use for the query
5247
            details: Whether to include full port list details
5248
            targets: Whether to include targets using this port list
5249
            trash: Whether to get port lists in the trashcan instead
5250
5251
        Returns:
5252
            The response. See :py:meth:`send_command` for details.
5253
        """
5254
        cmd = XmlCommand("get_port_lists")
5255
5256
        _add_filter(cmd, filter, filter_id)
5257
5258
        if details is not None:
5259
            cmd.set_attribute("details", _to_bool(details))
5260
5261
        if targets is not None:
5262
            cmd.set_attribute("targets", _to_bool(targets))
5263
5264
        if trash is not None:
5265
            cmd.set_attribute("trash", _to_bool(trash))
5266
5267
        return self._send_xml_command(cmd)
5268
5269
    def get_port_list(self, port_list_id: str):
5270
        """Request a single port list