Code Duplication    Length = 28-32 lines in 2 locations

gvm/protocols/gmpv208/gmpv208.py 2 locations

@@ 4672-4699 (lines=28) @@
4669
4670
        return self._send_xml_command(cmd)
4671
4672
    def get_report_format(
4673
        self, report_format_id: Union[str, ReportFormatType]
4674
    ) -> Any:
4675
        """Request a single report format
4676
4677
        Arguments:
4678
            report_format_id: UUID of an existing report format
4679
                              or ReportFormatType (enum)
4680
4681
        Returns:
4682
            The response. See :py:meth:`send_command` for details.
4683
        """
4684
        cmd = XmlCommand("get_report_formats")
4685
4686
        if not report_format_id:
4687
            raise RequiredArgument(
4688
                function=self.get_report_format.__name__,
4689
                argument='report_format_id',
4690
            )
4691
4692
        if isinstance(report_format_id, ReportFormatType):
4693
            report_format_id = report_format_id.value
4694
4695
        cmd.set_attribute("report_format_id", report_format_id)
4696
4697
        # for single entity always request all details
4698
        cmd.set_attribute("details", "1")
4699
        return self._send_xml_command(cmd)
4700
4701
    def get_roles(
4702
        self,
@@ 6066-6097 (lines=32) @@
6063
6064
        return self._send_xml_command(cmd)
6065
6066
    def verify_report_format(
6067
        self, report_format_id: Union[str, ReportFormatType]
6068
    ) -> Any:
6069
        """Verify an existing report format
6070
6071
        Verifies the trust level of an existing report format. It will be
6072
        checked whether the signature of the report format currently matches the
6073
        report format. This includes the script and files used to generate
6074
        reports of this format. It is *not* verified if the report format works
6075
        as expected by the user.
6076
6077
        Arguments:
6078
            report_format_id: UUID of the report format to be verified
6079
                              or ReportFormatType (enum)
6080
6081
        Returns:
6082
            The response. See :py:meth:`send_command` for details.
6083
        """
6084
        if not report_format_id:
6085
            raise RequiredArgument(
6086
                function=self.verify_report_format.__name__,
6087
                argument='report_format_id',
6088
            )
6089
6090
        cmd = XmlCommand("verify_report_format")
6091
6092
        if isinstance(report_format_id, ReportFormatType):
6093
            report_format_id = report_format_id.value
6094
6095
        cmd.set_attribute("report_format_id", report_format_id)
6096
6097
        return self._send_xml_command(cmd)
6098
6099
    def verify_scanner(self, scanner_id: str) -> Any:
6100
        """Verify an existing scanner