Code Duplication    Length = 30-33 lines in 4 locations

gvm/protocols/gmpv7/gmpv7.py 3 locations

@@ 3887-3917 (lines=31) @@
3884
        cmd.set_attribute("role_id", role_id)
3885
        return self._send_xml_command(cmd)
3886
3887
    def get_scanners(
3888
        self,
3889
        *,
3890
        filter: Optional[str] = None,
3891
        filter_id: Optional[str] = None,
3892
        trash: Optional[bool] = None,
3893
        details: Optional[bool] = None
3894
    ) -> Any:
3895
        """Request a list of scanners
3896
3897
        Arguments:
3898
            filter: Filter term to use for the query
3899
            filter_id: UUID of an existing filter to use for the query
3900
            trash: Whether to get the trashcan scanners instead
3901
            details:  Whether to include extra details like tasks using this
3902
                scanner
3903
3904
        Returns:
3905
            The response. See :py:meth:`send_command` for details.
3906
        """
3907
        cmd = XmlCommand("get_scanners")
3908
3909
        _add_filter(cmd, filter, filter_id)
3910
3911
        if trash is not None:
3912
            cmd.set_attribute("trash", _to_bool(trash))
3913
3914
        if details is not None:
3915
            cmd.set_attribute("details", _to_bool(details))
3916
3917
        return self._send_xml_command(cmd)
3918
3919
    def get_scanner(self, scanner_id: str) -> Any:
3920
        """Request a single scanner
@@ 3404-3433 (lines=30) @@
3401
3402
        return self._send_xml_command(cmd)
3403
3404
    def get_overrides(
3405
        self,
3406
        *,
3407
        filter: Optional[str] = None,
3408
        filter_id: Optional[str] = None,
3409
        details: Optional[bool] = None,
3410
        result: Optional[bool] = None
3411
    ) -> Any:
3412
        """Request a list of overrides
3413
3414
        Arguments:
3415
            filter: Filter term to use for the query
3416
            filter_id: UUID of an existing filter to use for the query
3417
            details: Whether to include full details
3418
            result: Whether to include results using the override
3419
3420
        Returns:
3421
            The response. See :py:meth:`send_command` for details.
3422
        """
3423
        cmd = XmlCommand("get_overrides")
3424
3425
        _add_filter(cmd, filter, filter_id)
3426
3427
        if details is not None:
3428
            cmd.set_attribute("details", _to_bool(details))
3429
3430
        if result is not None:
3431
            cmd.set_attribute("result", _to_bool(result))
3432
3433
        return self._send_xml_command(cmd)
3434
3435
    def get_override(self, override_id: str) -> Any:
3436
        """Request a single override
@@ 3253-3282 (lines=30) @@
3250
3251
        return self._send_xml_command(cmd)
3252
3253
    def get_notes(
3254
        self,
3255
        *,
3256
        filter: Optional[str] = None,
3257
        filter_id: Optional[str] = None,
3258
        details: Optional[bool] = None,
3259
        result: Optional[bool] = None
3260
    ) -> Any:
3261
        """Request a list of notes
3262
3263
        Arguments:
3264
            filter: Filter term to use for the query
3265
            filter_id: UUID of an existing filter to use for the query
3266
            details: Add info about connected results and tasks
3267
            result: Return the details of possible connected results.
3268
3269
        Returns:
3270
            The response. See :py:meth:`send_command` for details.
3271
        """
3272
        cmd = XmlCommand("get_notes")
3273
3274
        _add_filter(cmd, filter, filter_id)
3275
3276
        if details is not None:
3277
            cmd.set_attribute("details", _to_bool(details))
3278
3279
        if result is not None:
3280
            cmd.set_attribute("result", _to_bool(result))
3281
3282
        return self._send_xml_command(cmd)
3283
3284
    def get_note(self, note_id: str) -> Any:
3285
        """Request a single note

gvm/protocols/gmpv9/gmpv9.py 1 location

@@ 467-499 (lines=33) @@
464
465
        return self._send_xml_command(cmd)
466
467
    def get_tls_certificates(
468
        self,
469
        *,
470
        filter: Optional[str] = None,
471
        filter_id: Optional[str] = None,
472
        include_certificate_data: Optional[bool] = None,
473
        details: Optional[bool] = None
474
    ) -> Any:
475
        """Request a list of TLS certificates
476
477
        Arguments:
478
            filter: Filter term to use for the query
479
            filter_id: UUID of an existing filter to use for the query
480
            include_certificate_data: Whether to include the certificate data in
481
                the response
482
483
        Returns:
484
            The response. See :py:meth:`send_command` for details.
485
        """
486
487
        cmd = XmlCommand("get_tls_certificates")
488
489
        _add_filter(cmd, filter, filter_id)
490
491
        if details is not None:
492
            cmd.set_attribute("details", _to_bool(details))
493
494
        if include_certificate_data is not None:
495
            cmd.set_attribute(
496
                "include_certificate_data", _to_bool(include_certificate_data)
497
            )
498
499
        return self._send_xml_command(cmd)
500
501
    def get_tls_certificate(self, tls_certificate_id: str) -> Any:
502
        """Request a single TLS certificate