Code Duplication    Length = 28-32 lines in 2 locations

gvm/protocols/gmpv208/gmpv208.py 2 locations

@@ 2513-2540 (lines=28) @@
2510
2511
        return self._send_xml_command(cmd)
2512
2513
    def get_report_format(
2514
        self, report_format_id: Union[str, ReportFormatType]
2515
    ) -> Any:
2516
        """Request a single report format
2517
2518
        Arguments:
2519
            report_format_id: UUID of an existing report format
2520
                              or ReportFormatType (enum)
2521
2522
        Returns:
2523
            The response. See :py:meth:`send_command` for details.
2524
        """
2525
        cmd = XmlCommand("get_report_formats")
2526
2527
        if not report_format_id:
2528
            raise RequiredArgument(
2529
                function=self.get_report_format.__name__,
2530
                argument='report_format_id',
2531
            )
2532
2533
        if isinstance(report_format_id, ReportFormatType):
2534
            report_format_id = report_format_id.value
2535
2536
        cmd.set_attribute("report_format_id", report_format_id)
2537
2538
        # for single entity always request all details
2539
        cmd.set_attribute("details", "1")
2540
        return self._send_xml_command(cmd)
2541
2542
    def get_roles(
2543
        self,
@@ 3320-3351 (lines=32) @@
3317
        """
3318
        return self._send_xml_command(XmlCommand("sync_scap"))
3319
3320
    def verify_report_format(
3321
        self, report_format_id: Union[str, ReportFormatType]
3322
    ) -> Any:
3323
        """Verify an existing report format
3324
3325
        Verifies the trust level of an existing report format. It will be
3326
        checked whether the signature of the report format currently matches the
3327
        report format. This includes the script and files used to generate
3328
        reports of this format. It is *not* verified if the report format works
3329
        as expected by the user.
3330
3331
        Arguments:
3332
            report_format_id: UUID of the report format to be verified
3333
                              or ReportFormatType (enum)
3334
3335
        Returns:
3336
            The response. See :py:meth:`send_command` for details.
3337
        """
3338
        if not report_format_id:
3339
            raise RequiredArgument(
3340
                function=self.verify_report_format.__name__,
3341
                argument='report_format_id',
3342
            )
3343
3344
        cmd = XmlCommand("verify_report_format")
3345
3346
        if isinstance(report_format_id, ReportFormatType):
3347
            report_format_id = report_format_id.value
3348
3349
        cmd.set_attribute("report_format_id", report_format_id)
3350
3351
        return self._send_xml_command(cmd)
3352
3353
    def verify_scanner(self, scanner_id: str) -> Any:
3354
        """Verify an existing scanner