Code Duplication    Length = 30-33 lines in 4 locations

gvm/protocols/gmpv208/gmpv208.py 4 locations

@@ 853-885 (lines=33) @@
850
851
        return self._send_xml_command(cmd)
852
853
    def get_tls_certificates(
854
        self,
855
        *,
856
        filter: Optional[str] = None,
857
        filter_id: Optional[str] = None,
858
        include_certificate_data: Optional[bool] = None,
859
        details: Optional[bool] = None,
860
    ) -> Any:
861
        """Request a list of TLS certificates
862
863
        Arguments:
864
            filter: Filter term to use for the query
865
            filter_id: UUID of an existing filter to use for the query
866
            include_certificate_data: Whether to include the certificate data in
867
                the response
868
869
        Returns:
870
            The response. See :py:meth:`send_command` for details.
871
        """
872
873
        cmd = XmlCommand("get_tls_certificates")
874
875
        add_filter(cmd, filter, filter_id)
876
877
        if details is not None:
878
            cmd.set_attribute("details", to_bool(details))
879
880
        if include_certificate_data is not None:
881
            cmd.set_attribute(
882
                "include_certificate_data", to_bool(include_certificate_data)
883
            )
884
885
        return self._send_xml_command(cmd)
886
887
    def get_tls_certificate(self, tls_certificate_id: str) -> Any:
888
        """Request a single TLS certificate
@@ 5184-5214 (lines=31) @@
5181
        cmd.set_attribute("role_id", role_id)
5182
        return self._send_xml_command(cmd)
5183
5184
    def get_scanners(
5185
        self,
5186
        *,
5187
        filter: Optional[str] = None,
5188
        filter_id: Optional[str] = None,
5189
        trash: Optional[bool] = None,
5190
        details: Optional[bool] = None,
5191
    ) -> Any:
5192
        """Request a list of scanners
5193
5194
        Arguments:
5195
            filter: Filter term to use for the query
5196
            filter_id: UUID of an existing filter to use for the query
5197
            trash: Whether to get the trashcan scanners instead
5198
            details:  Whether to include extra details like tasks using this
5199
                scanner
5200
5201
        Returns:
5202
            The response. See :py:meth:`send_command` for details.
5203
        """
5204
        cmd = XmlCommand("get_scanners")
5205
5206
        add_filter(cmd, filter, filter_id)
5207
5208
        if trash is not None:
5209
            cmd.set_attribute("trash", to_bool(trash))
5210
5211
        if details is not None:
5212
            cmd.set_attribute("details", to_bool(details))
5213
5214
        return self._send_xml_command(cmd)
5215
5216
    def get_scanner(self, scanner_id: str) -> Any:
5217
        """Request a single scanner
@@ 4789-4818 (lines=30) @@
4786
4787
        return self._send_xml_command(cmd)
4788
4789
    def get_overrides(
4790
        self,
4791
        *,
4792
        filter: Optional[str] = None,
4793
        filter_id: Optional[str] = None,
4794
        details: Optional[bool] = None,
4795
        result: Optional[bool] = None,
4796
    ) -> Any:
4797
        """Request a list of overrides
4798
4799
        Arguments:
4800
            filter: Filter term to use for the query
4801
            filter_id: UUID of an existing filter to use for the query
4802
            details: Whether to include full details
4803
            result: Whether to include results using the override
4804
4805
        Returns:
4806
            The response. See :py:meth:`send_command` for details.
4807
        """
4808
        cmd = XmlCommand("get_overrides")
4809
4810
        add_filter(cmd, filter, filter_id)
4811
4812
        if details is not None:
4813
            cmd.set_attribute("details", to_bool(details))
4814
4815
        if result is not None:
4816
            cmd.set_attribute("result", to_bool(result))
4817
4818
        return self._send_xml_command(cmd)
4819
4820
    def get_override(self, override_id: str) -> Any:
4821
        """Request a single override
@@ 4636-4665 (lines=30) @@
4633
        cmd.set_attribute("group_id", group_id)
4634
        return self._send_xml_command(cmd)
4635
4636
    def get_notes(
4637
        self,
4638
        *,
4639
        filter: Optional[str] = None,
4640
        filter_id: Optional[str] = None,
4641
        details: Optional[bool] = None,
4642
        result: Optional[bool] = None,
4643
    ) -> Any:
4644
        """Request a list of notes
4645
4646
        Arguments:
4647
            filter: Filter term to use for the query
4648
            filter_id: UUID of an existing filter to use for the query
4649
            details: Add info about connected results and tasks
4650
            result: Return the details of possible connected results.
4651
4652
        Returns:
4653
            The response. See :py:meth:`send_command` for details.
4654
        """
4655
        cmd = XmlCommand("get_notes")
4656
4657
        add_filter(cmd, filter, filter_id)
4658
4659
        if details is not None:
4660
            cmd.set_attribute("details", to_bool(details))
4661
4662
        if result is not None:
4663
            cmd.set_attribute("result", to_bool(result))
4664
4665
        return self._send_xml_command(cmd)
4666
4667
    def get_note(self, note_id: str) -> Any:
4668
        """Request a single note