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

@@ 5201-5235 (lines=35) @@
5198
        cmd.set_attribute("permission_id", permission_id)
5199
        return self._send_xml_command(cmd)
5200
5201
    def get_port_lists(
5202
        self,
5203
        *,
5204
        filter: Optional[str] = None,
5205
        filter_id: Optional[str] = None,
5206
        details: Optional[bool] = None,
5207
        targets: Optional[bool] = None,
5208
        trash: Optional[bool] = None,
5209
    ) -> Any:
5210
        """Request a list of port lists
5211
5212
        Arguments:
5213
            filter: Filter term to use for the query
5214
            filter_id: UUID of an existing filter to use for the query
5215
            details: Whether to include full port list details
5216
            targets: Whether to include targets using this port list
5217
            trash: Whether to get port lists in the trashcan instead
5218
5219
        Returns:
5220
            The response. See :py:meth:`send_command` for details.
5221
        """
5222
        cmd = XmlCommand("get_port_lists")
5223
5224
        _add_filter(cmd, filter, filter_id)
5225
5226
        if details is not None:
5227
            cmd.set_attribute("details", _to_bool(details))
5228
5229
        if targets is not None:
5230
            cmd.set_attribute("targets", _to_bool(targets))
5231
5232
        if trash is not None:
5233
            cmd.set_attribute("trash", _to_bool(trash))
5234
5235
        return self._send_xml_command(cmd)
5236
5237
    def get_port_list(self, port_list_id: str):
5238
        """Request a single port list