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,
@@ 6398-6430 (lines=33) @@
6395
6396
        return self._send_xml_command(cmd)
6397
6398
    def verify_report_format(
6399
        self,
6400
        report_format_id: Union[str, ReportFormatType],
6401
    ) -> Any:
6402
        """Verify an existing report format
6403
6404
        Verifies the trust level of an existing report format. It will be
6405
        checked whether the signature of the report format currently matches the
6406
        report format. This includes the script and files used to generate
6407
        reports of this format. It is *not* verified if the report format works
6408
        as expected by the user.
6409
6410
        Arguments:
6411
            report_format_id: UUID of the report format to be verified
6412
                              or ReportFormatType (enum)
6413
6414
        Returns:
6415
            The response. See :py:meth:`send_command` for details.
6416
        """
6417
        if not report_format_id:
6418
            raise RequiredArgument(
6419
                function=self.verify_report_format.__name__,
6420
                argument='report_format_id',
6421
            )
6422
6423
        cmd = XmlCommand("verify_report_format")
6424
6425
        if isinstance(report_format_id, ReportFormatType):
6426
            report_format_id = report_format_id.value
6427
6428
        cmd.set_attribute("report_format_id", report_format_id)
6429
6430
        return self._send_xml_command(cmd)
6431
6432
    def verify_scanner(self, scanner_id: str) -> Any:
6433
        """Verify an existing scanner