Code Duplication    Length = 30-33 lines in 4 locations

gvm/protocols/gmpv7/gmpv7.py 3 locations

@@ 3316-3345 (lines=30) @@
3313
3314
        return self._send_xml_command(cmd)
3315
3316
    def get_notes(
3317
        self,
3318
        *,
3319
        filter: Optional[str] = None,
3320
        filter_id: Optional[str] = None,
3321
        details: Optional[bool] = None,
3322
        result: Optional[bool] = None,
3323
    ) -> Any:
3324
        """Request a list of notes
3325
3326
        Arguments:
3327
            filter: Filter term to use for the query
3328
            filter_id: UUID of an existing filter to use for the query
3329
            details: Add info about connected results and tasks
3330
            result: Return the details of possible connected results.
3331
3332
        Returns:
3333
            The response. See :py:meth:`send_command` for details.
3334
        """
3335
        cmd = XmlCommand("get_notes")
3336
3337
        _add_filter(cmd, filter, filter_id)
3338
3339
        if details is not None:
3340
            cmd.set_attribute("details", _to_bool(details))
3341
3342
        if result is not None:
3343
            cmd.set_attribute("result", _to_bool(result))
3344
3345
        return self._send_xml_command(cmd)
3346
3347
    def get_note(self, note_id: str) -> Any:
3348
        """Request a single note
@@ 3962-3992 (lines=31) @@
3959
        cmd.set_attribute("role_id", role_id)
3960
        return self._send_xml_command(cmd)
3961
3962
    def get_scanners(
3963
        self,
3964
        *,
3965
        filter: Optional[str] = None,
3966
        filter_id: Optional[str] = None,
3967
        trash: Optional[bool] = None,
3968
        details: Optional[bool] = None,
3969
    ) -> Any:
3970
        """Request a list of scanners
3971
3972
        Arguments:
3973
            filter: Filter term to use for the query
3974
            filter_id: UUID of an existing filter to use for the query
3975
            trash: Whether to get the trashcan scanners instead
3976
            details:  Whether to include extra details like tasks using this
3977
                scanner
3978
3979
        Returns:
3980
            The response. See :py:meth:`send_command` for details.
3981
        """
3982
        cmd = XmlCommand("get_scanners")
3983
3984
        _add_filter(cmd, filter, filter_id)
3985
3986
        if trash is not None:
3987
            cmd.set_attribute("trash", _to_bool(trash))
3988
3989
        if details is not None:
3990
            cmd.set_attribute("details", _to_bool(details))
3991
3992
        return self._send_xml_command(cmd)
3993
3994
    def get_scanner(self, scanner_id: str) -> Any:
3995
        """Request a single scanner
@@ 3469-3498 (lines=30) @@
3466
3467
        return self._send_xml_command(cmd)
3468
3469
    def get_overrides(
3470
        self,
3471
        *,
3472
        filter: Optional[str] = None,
3473
        filter_id: Optional[str] = None,
3474
        details: Optional[bool] = None,
3475
        result: Optional[bool] = None,
3476
    ) -> Any:
3477
        """Request a list of overrides
3478
3479
        Arguments:
3480
            filter: Filter term to use for the query
3481
            filter_id: UUID of an existing filter to use for the query
3482
            details: Whether to include full details
3483
            result: Whether to include results using the override
3484
3485
        Returns:
3486
            The response. See :py:meth:`send_command` for details.
3487
        """
3488
        cmd = XmlCommand("get_overrides")
3489
3490
        _add_filter(cmd, filter, filter_id)
3491
3492
        if details is not None:
3493
            cmd.set_attribute("details", _to_bool(details))
3494
3495
        if result is not None:
3496
            cmd.set_attribute("result", _to_bool(result))
3497
3498
        return self._send_xml_command(cmd)
3499
3500
    def get_override(self, override_id: str) -> Any:
3501
        """Request a single override

gvm/protocols/gmpv9/gmpv9.py 1 location

@@ 826-858 (lines=33) @@
823
824
        return self._send_xml_command(cmd)
825
826
    def get_tls_certificates(
827
        self,
828
        *,
829
        filter: Optional[str] = None,
830
        filter_id: Optional[str] = None,
831
        include_certificate_data: Optional[bool] = None,
832
        details: Optional[bool] = None,
833
    ) -> Any:
834
        """Request a list of TLS certificates
835
836
        Arguments:
837
            filter: Filter term to use for the query
838
            filter_id: UUID of an existing filter to use for the query
839
            include_certificate_data: Whether to include the certificate data in
840
                the response
841
842
        Returns:
843
            The response. See :py:meth:`send_command` for details.
844
        """
845
846
        cmd = XmlCommand("get_tls_certificates")
847
848
        _add_filter(cmd, filter, filter_id)
849
850
        if details is not None:
851
            cmd.set_attribute("details", _to_bool(details))
852
853
        if include_certificate_data is not None:
854
            cmd.set_attribute(
855
                "include_certificate_data", _to_bool(include_certificate_data)
856
            )
857
858
        return self._send_xml_command(cmd)
859
860
    def get_tls_certificate(self, tls_certificate_id: str) -> Any:
861
        """Request a single TLS certificate