Code Duplication    Length = 30-33 lines in 4 locations

gvm/protocols/gmpv208/gmpv208.py 4 locations

@@ 904-936 (lines=33) @@
901
902
        return self._send_xml_command(cmd)
903
904
    def get_tls_certificates(
905
        self,
906
        *,
907
        filter: Optional[str] = None,
908
        filter_id: Optional[str] = None,
909
        include_certificate_data: Optional[bool] = None,
910
        details: Optional[bool] = None,
911
    ) -> Any:
912
        """Request a list of TLS certificates
913
914
        Arguments:
915
            filter: Filter term to use for the query
916
            filter_id: UUID of an existing filter to use for the query
917
            include_certificate_data: Whether to include the certificate data in
918
                the response
919
920
        Returns:
921
            The response. See :py:meth:`send_command` for details.
922
        """
923
924
        cmd = XmlCommand("get_tls_certificates")
925
926
        add_filter(cmd, filter, filter_id)
927
928
        if details is not None:
929
            cmd.set_attribute("details", to_bool(details))
930
931
        if include_certificate_data is not None:
932
            cmd.set_attribute(
933
                "include_certificate_data", to_bool(include_certificate_data)
934
            )
935
936
        return self._send_xml_command(cmd)
937
938
    def get_tls_certificate(self, tls_certificate_id: str) -> Any:
939
        """Request a single TLS certificate
@@ 5460-5490 (lines=31) @@
5457
        cmd.set_attribute("role_id", role_id)
5458
        return self._send_xml_command(cmd)
5459
5460
    def get_scanners(
5461
        self,
5462
        *,
5463
        filter: Optional[str] = None,
5464
        filter_id: Optional[str] = None,
5465
        trash: Optional[bool] = None,
5466
        details: Optional[bool] = None,
5467
    ) -> Any:
5468
        """Request a list of scanners
5469
5470
        Arguments:
5471
            filter: Filter term to use for the query
5472
            filter_id: UUID of an existing filter to use for the query
5473
            trash: Whether to get the trashcan scanners instead
5474
            details:  Whether to include extra details like tasks using this
5475
                scanner
5476
5477
        Returns:
5478
            The response. See :py:meth:`send_command` for details.
5479
        """
5480
        cmd = XmlCommand("get_scanners")
5481
5482
        add_filter(cmd, filter, filter_id)
5483
5484
        if trash is not None:
5485
            cmd.set_attribute("trash", to_bool(trash))
5486
5487
        if details is not None:
5488
            cmd.set_attribute("details", to_bool(details))
5489
5490
        return self._send_xml_command(cmd)
5491
5492
    def get_scanner(self, scanner_id: str) -> Any:
5493
        """Request a single scanner
@@ 4967-4996 (lines=30) @@
4964
4965
        return self._send_xml_command(cmd)
4966
4967
    def get_overrides(
4968
        self,
4969
        *,
4970
        filter: Optional[str] = None,
4971
        filter_id: Optional[str] = None,
4972
        details: Optional[bool] = None,
4973
        result: Optional[bool] = None,
4974
    ) -> Any:
4975
        """Request a list of overrides
4976
4977
        Arguments:
4978
            filter: Filter term to use for the query
4979
            filter_id: UUID of an existing filter to use for the query
4980
            details: Whether to include full details
4981
            result: Whether to include results using the override
4982
4983
        Returns:
4984
            The response. See :py:meth:`send_command` for details.
4985
        """
4986
        cmd = XmlCommand("get_overrides")
4987
4988
        add_filter(cmd, filter, filter_id)
4989
4990
        if details is not None:
4991
            cmd.set_attribute("details", to_bool(details))
4992
4993
        if result is not None:
4994
            cmd.set_attribute("result", to_bool(result))
4995
4996
        return self._send_xml_command(cmd)
4997
4998
    def get_override(self, override_id: str) -> Any:
4999
        """Request a single override
@@ 4814-4843 (lines=30) @@
4811
        cmd.set_attribute("group_id", group_id)
4812
        return self._send_xml_command(cmd)
4813
4814
    def get_notes(
4815
        self,
4816
        *,
4817
        filter: Optional[str] = None,
4818
        filter_id: Optional[str] = None,
4819
        details: Optional[bool] = None,
4820
        result: Optional[bool] = None,
4821
    ) -> Any:
4822
        """Request a list of notes
4823
4824
        Arguments:
4825
            filter: Filter term to use for the query
4826
            filter_id: UUID of an existing filter to use for the query
4827
            details: Add info about connected results and tasks
4828
            result: Return the details of possible connected results.
4829
4830
        Returns:
4831
            The response. See :py:meth:`send_command` for details.
4832
        """
4833
        cmd = XmlCommand("get_notes")
4834
4835
        add_filter(cmd, filter, filter_id)
4836
4837
        if details is not None:
4838
            cmd.set_attribute("details", to_bool(details))
4839
4840
        if result is not None:
4841
            cmd.set_attribute("result", to_bool(result))
4842
4843
        return self._send_xml_command(cmd)
4844
4845
    def get_note(self, note_id: str) -> Any:
4846
        """Request a single note