Code Duplication    Length = 28-32 lines in 2 locations

gvm/protocols/gmpv208/gmpv208.py 2 locations

@@ 1915-1942 (lines=28) @@
1912
1913
        return self._send_xml_command(cmd)
1914
1915
    def get_report_format(
1916
        self, report_format_id: Union[str, ReportFormatType]
1917
    ) -> Any:
1918
        """Request a single report format
1919
1920
        Arguments:
1921
            report_format_id: UUID of an existing report format
1922
                              or ReportFormatType (enum)
1923
1924
        Returns:
1925
            The response. See :py:meth:`send_command` for details.
1926
        """
1927
        cmd = XmlCommand("get_report_formats")
1928
1929
        if not report_format_id:
1930
            raise RequiredArgument(
1931
                function=self.get_report_format.__name__,
1932
                argument='report_format_id',
1933
            )
1934
1935
        if isinstance(report_format_id, ReportFormatType):
1936
            report_format_id = report_format_id.value
1937
1938
        cmd.set_attribute("report_format_id", report_format_id)
1939
1940
        # for single entity always request all details
1941
        cmd.set_attribute("details", "1")
1942
        return self._send_xml_command(cmd)
1943
1944
    def get_roles(
1945
        self,
@@ 2601-2632 (lines=32) @@
2598
        """
2599
        return self._send_xml_command(XmlCommand("sync_scap"))
2600
2601
    def verify_report_format(
2602
        self, report_format_id: Union[str, ReportFormatType]
2603
    ) -> Any:
2604
        """Verify an existing report format
2605
2606
        Verifies the trust level of an existing report format. It will be
2607
        checked whether the signature of the report format currently matches the
2608
        report format. This includes the script and files used to generate
2609
        reports of this format. It is *not* verified if the report format works
2610
        as expected by the user.
2611
2612
        Arguments:
2613
            report_format_id: UUID of the report format to be verified
2614
                              or ReportFormatType (enum)
2615
2616
        Returns:
2617
            The response. See :py:meth:`send_command` for details.
2618
        """
2619
        if not report_format_id:
2620
            raise RequiredArgument(
2621
                function=self.verify_report_format.__name__,
2622
                argument='report_format_id',
2623
            )
2624
2625
        cmd = XmlCommand("verify_report_format")
2626
2627
        if isinstance(report_format_id, ReportFormatType):
2628
            report_format_id = report_format_id.value
2629
2630
        cmd.set_attribute("report_format_id", report_format_id)
2631
2632
        return self._send_xml_command(cmd)
2633