Code Duplication    Length = 28-32 lines in 2 locations

gvm/protocols/gmpv208/gmpv208.py 2 locations

@@ 1540-1567 (lines=28) @@
1537
1538
        return self._send_xml_command(cmd)
1539
1540
    def get_report_format(
1541
        self, report_format_id: Union[str, ReportFormatType]
1542
    ) -> Any:
1543
        """Request a single report format
1544
1545
        Arguments:
1546
            report_format_id: UUID of an existing report format
1547
                              or ReportFormatType (enum)
1548
        Returns:
1549
            The response. See :py:meth:`send_command` for details.
1550
        """
1551
        cmd = XmlCommand("get_report_formats")
1552
        if not report_format_id:
1553
            raise RequiredArgument(
1554
                function=self.get_report_format.__name__,
1555
                argument='report_format_id',
1556
            )
1557
1558
        if isinstance(report_format_id, ReportFormatType):
1559
            report_format_id = report_format_id.value
1560
1561
        cmd.set_attribute("report_format_id", report_format_id)
1562
1563
        # for single entity always request all details
1564
        cmd.set_attribute("details", "1")
1565
        return self._send_xml_command(cmd)
1566
1567
    def get_roles(
1568
        self,
1569
        *,
1570
        filter: Optional[str] = None,
@@ 2088-2119 (lines=32) @@
2085
        """
2086
        return self._send_xml_command(XmlCommand("sync_scap"))
2087
2088
    def verify_report_format(
2089
        self, report_format_id: Union[str, ReportFormatType]
2090
    ) -> Any:
2091
        """Verify an existing report format
2092
2093
        Verifies the trust level of an existing report format. It will be
2094
        checked whether the signature of the report format currently matches the
2095
        report format. This includes the script and files used to generate
2096
        reports of this format. It is *not* verified if the report format works
2097
        as expected by the user.
2098
2099
        Arguments:
2100
            report_format_id: UUID of the report format to be verified
2101
                              or ReportFormatType (enum)
2102
2103
        Returns:
2104
            The response. See :py:meth:`send_command` for details.
2105
        """
2106
        if not report_format_id:
2107
            raise RequiredArgument(
2108
                function=self.verify_report_format.__name__,
2109
                argument='report_format_id',
2110
            )
2111
2112
        cmd = XmlCommand("verify_report_format")
2113
2114
        if isinstance(report_format_id, ReportFormatType):
2115
            report_format_id = report_format_id.value
2116
2117
        cmd.set_attribute("report_format_id", report_format_id)
2118
2119
        return self._send_xml_command(cmd)
2120