Code Duplication    Length = 28-32 lines in 2 locations

gvm/protocols/gmpv208/gmpv208.py 2 locations

@@ 1206-1237 (lines=32) @@
1203
        """
1204
        return self._send_xml_command(XmlCommand("sync_scap"))
1205
1206
    def verify_report_format(
1207
        self, report_format_id: Union[str, ReportFormatType]
1208
    ) -> Any:
1209
        """Verify an existing report format
1210
1211
        Verifies the trust level of an existing report format. It will be
1212
        checked whether the signature of the report format currently matches the
1213
        report format. This includes the script and files used to generate
1214
        reports of this format. It is *not* verified if the report format works
1215
        as expected by the user.
1216
1217
        Arguments:
1218
            report_format_id: UUID of the report format to be verified
1219
                              or ReportFormatType (enum)
1220
1221
        Returns:
1222
            The response. See :py:meth:`send_command` for details.
1223
        """
1224
        if not report_format_id:
1225
            raise RequiredArgument(
1226
                function=self.verify_report_format.__name__,
1227
                argument='report_format_id',
1228
            )
1229
1230
        cmd = XmlCommand("verify_report_format")
1231
1232
        if isinstance(report_format_id, ReportFormatType):
1233
            report_format_id = report_format_id.value
1234
1235
        cmd.set_attribute("report_format_id", report_format_id)
1236
1237
        return self._send_xml_command(cmd)
1238
@@ 773-800 (lines=28) @@
770
771
        return self._send_xml_command(cmd)
772
773
    def get_report_format(
774
        self, report_format_id: Union[str, ReportFormatType]
775
    ) -> Any:
776
        """Request a single report format
777
778
        Arguments:
779
            report_format_id: UUID of an existing report format
780
                              or ReportFormatType (enum)
781
        Returns:
782
            The response. See :py:meth:`send_command` for details.
783
        """
784
        cmd = XmlCommand("get_report_formats")
785
        if not report_format_id:
786
            raise RequiredArgument(
787
                function=self.get_report_format.__name__,
788
                argument='report_format_id',
789
            )
790
791
        if isinstance(report_format_id, ReportFormatType):
792
            report_format_id = report_format_id.value
793
794
        cmd.set_attribute("report_format_id", report_format_id)
795
796
        # for single entity always request all details
797
        cmd.set_attribute("details", "1")
798
        return self._send_xml_command(cmd)
799
800
    def get_roles(
801
        self,
802
        *,
803
        filter: Optional[str] = None,