Code Duplication    Length = 54-54 lines in 2 locations

gvm/protocols/gmpv7/gmpv7.py 1 location

@@ 3729-3782 (lines=54) @@
3726
3727
        return self._send_xml_command(cmd)
3728
3729
    def get_report(
3730
        self,
3731
        report_id: str,
3732
        *,
3733
        filter: Optional[str] = None,
3734
        filter_id: Optional[str] = None,
3735
        delta_report_id: Optional[str] = None,
3736
        report_format_id: Optional[Union[str, ReportFormatType]] = None,
3737
        ignore_pagination: Optional[bool] = None,
3738
        details: Optional[bool] = True,
3739
    ) -> Any:
3740
        """Request a single report
3741
3742
        Arguments:
3743
            report_id: UUID of an existing report
3744
            filter: Filter term to use to filter results in the report
3745
            filter_id: UUID of filter to use to filter results in the report
3746
            delta_report_id: UUID of an existing report to compare report to.
3747
            report_format_id: UUID of report format to use
3748
                              or ReportFormatType (enum)
3749
            ignore_pagination: Whether to ignore the filter terms "first" and
3750
                "rows".
3751
            details: Request additional report information details
3752
                     defaults to True
3753
3754
        Returns:
3755
            The response. See :py:meth:`send_command` for details.
3756
        """
3757
        cmd = XmlCommand("get_reports")
3758
3759
        if not report_id:
3760
            raise RequiredArgument(
3761
                function=self.get_report.__name__, argument='report_id'
3762
            )
3763
3764
        cmd.set_attribute("report_id", report_id)
3765
3766
        _add_filter(cmd, filter, filter_id)
3767
3768
        if delta_report_id:
3769
            cmd.set_attribute("delta_report_id", delta_report_id)
3770
3771
        if report_format_id:
3772
            if isinstance(report_format_id, ReportFormatType):
3773
                report_format_id = report_format_id.value
3774
3775
            cmd.set_attribute("format_id", report_format_id)
3776
3777
        if ignore_pagination is not None:
3778
            cmd.set_attribute("ignore_pagination", _to_bool(ignore_pagination))
3779
3780
        cmd.set_attribute("details", _to_bool(details))
3781
3782
        return self._send_xml_command(cmd)
3783
3784
    def get_report_formats(
3785
        self,

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 5395-5448 (lines=54) @@
5392
5393
        return self._send_xml_command(cmd)
5394
5395
    def get_report(
5396
        self,
5397
        report_id: str,
5398
        *,
5399
        filter: Optional[str] = None,
5400
        filter_id: Optional[str] = None,
5401
        delta_report_id: Optional[str] = None,
5402
        report_format_id: Optional[Union[str, ReportFormatType]] = None,
5403
        ignore_pagination: Optional[bool] = None,
5404
        details: Optional[bool] = True,
5405
    ) -> Any:
5406
        """Request a single report
5407
5408
        Arguments:
5409
            report_id: UUID of an existing report
5410
            filter: Filter term to use to filter results in the report
5411
            filter_id: UUID of filter to use to filter results in the report
5412
            delta_report_id: UUID of an existing report to compare report to.
5413
            report_format_id: UUID of report format to use
5414
                              or ReportFormatType (enum)
5415
            ignore_pagination: Whether to ignore the filter terms "first" and
5416
                "rows".
5417
            details: Request additional report information details
5418
                     defaults to True
5419
5420
        Returns:
5421
            The response. See :py:meth:`send_command` for details.
5422
        """
5423
        cmd = XmlCommand("get_reports")
5424
5425
        if not report_id:
5426
            raise RequiredArgument(
5427
                function=self.get_report.__name__, argument='report_id'
5428
            )
5429
5430
        cmd.set_attribute("report_id", report_id)
5431
5432
        _add_filter(cmd, filter, filter_id)
5433
5434
        if delta_report_id:
5435
            cmd.set_attribute("delta_report_id", delta_report_id)
5436
5437
        if report_format_id:
5438
            if isinstance(report_format_id, ReportFormatType):
5439
                report_format_id = report_format_id.value
5440
5441
            cmd.set_attribute("format_id", report_format_id)
5442
5443
        if ignore_pagination is not None:
5444
            cmd.set_attribute("ignore_pagination", _to_bool(ignore_pagination))
5445
5446
        cmd.set_attribute("details", _to_bool(details))
5447
5448
        return self._send_xml_command(cmd)
5449
5450
    def get_report_formats(
5451
        self,