Code Duplication    Length = 35-36 lines in 2 locations

gvm/protocols/gmpv208/entities/credentials.py 1 location

@@ 418-453 (lines=36) @@
415
416
        return self._send_xml_command(cmd)
417
418
    def get_credentials(
419
        self,
420
        *,
421
        filter_string: Optional[str] = None,
422
        filter_id: Optional[str] = None,
423
        scanners: Optional[bool] = None,
424
        trash: Optional[bool] = None,
425
        targets: Optional[bool] = None,
426
    ) -> Any:
427
        """Request a list of credentials
428
429
        Arguments:
430
            filter_string: Filter term to use for the query
431
            filter_id: UUID of an existing filter to use for the query
432
            scanners: Whether to include a list of scanners using the
433
                credentials
434
            trash: Whether to get the trashcan credentials instead
435
            targets: Whether to include a list of targets using the credentials
436
437
        Returns:
438
            The response. See :py:meth:`send_command` for details.
439
        """
440
        cmd = XmlCommand("get_credentials")
441
442
        add_filter(cmd, filter_string, filter_id)
443
444
        if scanners is not None:
445
            cmd.set_attribute("scanners", to_bool(scanners))
446
447
        if trash is not None:
448
            cmd.set_attribute("trash", to_bool(trash))
449
450
        if targets is not None:
451
            cmd.set_attribute("targets", to_bool(targets))
452
453
        return self._send_xml_command(cmd)
454
455
    def get_credential(
456
        self,

gvm/protocols/gmpv208/entities/port_lists.py 1 location

@@ 205-239 (lines=35) @@
202
203
        return self._send_xml_command(cmd)
204
205
    def get_port_lists(
206
        self,
207
        *,
208
        filter_string: Optional[str] = None,
209
        filter_id: Optional[str] = None,
210
        details: Optional[bool] = None,
211
        targets: Optional[bool] = None,
212
        trash: Optional[bool] = None,
213
    ) -> Any:
214
        """Request a list of port lists
215
216
        Arguments:
217
            filter_string: Filter term to use for the query
218
            filter_id: UUID of an existing filter to use for the query
219
            details: Whether to include full port list details
220
            targets: Whether to include targets using this port list
221
            trash: Whether to get port lists in the trashcan instead
222
223
        Returns:
224
            The response. See :py:meth:`send_command` for details.
225
        """
226
        cmd = XmlCommand("get_port_lists")
227
228
        add_filter(cmd, filter_string, filter_id)
229
230
        if details is not None:
231
            cmd.set_attribute("details", to_bool(details))
232
233
        if targets is not None:
234
            cmd.set_attribute("targets", to_bool(targets))
235
236
        if trash is not None:
237
            cmd.set_attribute("trash", to_bool(trash))
238
239
        return self._send_xml_command(cmd)
240
241
    def get_port_list(self, port_list_id: str):
242
        """Request a single port list