Code Duplication    Length = 28-32 lines in 2 locations

gvm/protocols/gmpv208/gmpv208.py 2 locations

@@ 7179-7210 (lines=32) @@
7176
7177
        return self._send_xml_command(cmd)
7178
7179
    def verify_report_format(
7180
        self, report_format_id: Union[str, ReportFormatType]
7181
    ) -> Any:
7182
        """Verify an existing report format
7183
7184
        Verifies the trust level of an existing report format. It will be
7185
        checked whether the signature of the report format currently matches the
7186
        report format. This includes the script and files used to generate
7187
        reports of this format. It is *not* verified if the report format works
7188
        as expected by the user.
7189
7190
        Arguments:
7191
            report_format_id: UUID of the report format to be verified
7192
                              or ReportFormatType (enum)
7193
7194
        Returns:
7195
            The response. See :py:meth:`send_command` for details.
7196
        """
7197
        if not report_format_id:
7198
            raise RequiredArgument(
7199
                function=self.verify_report_format.__name__,
7200
                argument='report_format_id',
7201
            )
7202
7203
        cmd = XmlCommand("verify_report_format")
7204
7205
        if isinstance(report_format_id, ReportFormatType):
7206
            report_format_id = report_format_id.value
7207
7208
        cmd.set_attribute("report_format_id", report_format_id)
7209
7210
        return self._send_xml_command(cmd)
7211
7212
    def verify_scanner(self, scanner_id: str) -> Any:
7213
        """Verify an existing scanner
@@ 5323-5350 (lines=28) @@
5320
5321
        return self._send_xml_command(cmd)
5322
5323
    def get_report_format(
5324
        self, report_format_id: Union[str, ReportFormatType]
5325
    ) -> Any:
5326
        """Request a single report format
5327
5328
        Arguments:
5329
            report_format_id: UUID of an existing report format
5330
                              or ReportFormatType (enum)
5331
5332
        Returns:
5333
            The response. See :py:meth:`send_command` for details.
5334
        """
5335
        cmd = XmlCommand("get_report_formats")
5336
5337
        if not report_format_id:
5338
            raise RequiredArgument(
5339
                function=self.get_report_format.__name__,
5340
                argument='report_format_id',
5341
            )
5342
5343
        if isinstance(report_format_id, ReportFormatType):
5344
            report_format_id = report_format_id.value
5345
5346
        cmd.set_attribute("report_format_id", report_format_id)
5347
5348
        # for single entity always request all details
5349
        cmd.set_attribute("details", "1")
5350
        return self._send_xml_command(cmd)
5351
5352
    def get_results(
5353
        self,