Code Duplication    Length = 29-33 lines in 2 locations

gvm/protocols/gmpv7/gmpv7.py 2 locations

@@ 3826-3854 (lines=29) @@
3823
3824
        return self._send_xml_command(cmd)
3825
3826
    def get_report_format(
3827
        self,
3828
        report_format_id: Union[str, ReportFormatType],
3829
    ) -> Any:
3830
        """Request a single report format
3831
3832
        Arguments:
3833
            report_format_id: UUID of an existing report format
3834
                              or ReportFormatType (enum)
3835
3836
        Returns:
3837
            The response. See :py:meth:`send_command` for details.
3838
        """
3839
        cmd = XmlCommand("get_report_formats")
3840
3841
        if not report_format_id:
3842
            raise RequiredArgument(
3843
                function=self.get_report_format.__name__,
3844
                argument='report_format_id',
3845
            )
3846
3847
        if isinstance(report_format_id, ReportFormatType):
3848
            report_format_id = report_format_id.value
3849
3850
        cmd.set_attribute("report_format_id", report_format_id)
3851
3852
        # for single entity always request all details
3853
        cmd.set_attribute("details", "1")
3854
        return self._send_xml_command(cmd)
3855
3856
    def get_results(
3857
        self,
@@ 6410-6442 (lines=33) @@
6407
6408
        return self._send_xml_command(cmd)
6409
6410
    def verify_report_format(
6411
        self,
6412
        report_format_id: Union[str, ReportFormatType],
6413
    ) -> Any:
6414
        """Verify an existing report format
6415
6416
        Verifies the trust level of an existing report format. It will be
6417
        checked whether the signature of the report format currently matches the
6418
        report format. This includes the script and files used to generate
6419
        reports of this format. It is *not* verified if the report format works
6420
        as expected by the user.
6421
6422
        Arguments:
6423
            report_format_id: UUID of the report format to be verified
6424
                              or ReportFormatType (enum)
6425
6426
        Returns:
6427
            The response. See :py:meth:`send_command` for details.
6428
        """
6429
        if not report_format_id:
6430
            raise RequiredArgument(
6431
                function=self.verify_report_format.__name__,
6432
                argument='report_format_id',
6433
            )
6434
6435
        cmd = XmlCommand("verify_report_format")
6436
6437
        if isinstance(report_format_id, ReportFormatType):
6438
            report_format_id = report_format_id.value
6439
6440
        cmd.set_attribute("report_format_id", report_format_id)
6441
6442
        return self._send_xml_command(cmd)
6443
6444
    def verify_scanner(self, scanner_id: str) -> Any:
6445
        """Verify an existing scanner