Code Duplication    Length = 54-54 lines in 2 locations

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 5363-5416 (lines=54) @@
5360
5361
        return self._send_xml_command(cmd)
5362
5363
    def get_report(
5364
        self,
5365
        report_id: str,
5366
        *,
5367
        filter: Optional[str] = None,
5368
        filter_id: Optional[str] = None,
5369
        delta_report_id: Optional[str] = None,
5370
        report_format_id: Optional[Union[str, ReportFormatType]] = None,
5371
        ignore_pagination: Optional[bool] = None,
5372
        details: Optional[bool] = True,
5373
    ) -> Any:
5374
        """Request a single report
5375
5376
        Arguments:
5377
            report_id: UUID of an existing report
5378
            filter: Filter term to use to filter results in the report
5379
            filter_id: UUID of filter to use to filter results in the report
5380
            delta_report_id: UUID of an existing report to compare report to.
5381
            report_format_id: UUID of report format to use
5382
                              or ReportFormatType (enum)
5383
            ignore_pagination: Whether to ignore the filter terms "first" and
5384
                "rows".
5385
            details: Request additional report information details
5386
                     defaults to True
5387
5388
        Returns:
5389
            The response. See :py:meth:`send_command` for details.
5390
        """
5391
        cmd = XmlCommand("get_reports")
5392
5393
        if not report_id:
5394
            raise RequiredArgument(
5395
                function=self.get_report.__name__, argument='report_id'
5396
            )
5397
5398
        cmd.set_attribute("report_id", report_id)
5399
5400
        _add_filter(cmd, filter, filter_id)
5401
5402
        if delta_report_id:
5403
            cmd.set_attribute("delta_report_id", delta_report_id)
5404
5405
        if report_format_id:
5406
            if isinstance(report_format_id, ReportFormatType):
5407
                report_format_id = report_format_id.value
5408
5409
            cmd.set_attribute("format_id", report_format_id)
5410
5411
        if ignore_pagination is not None:
5412
            cmd.set_attribute("ignore_pagination", _to_bool(ignore_pagination))
5413
5414
        cmd.set_attribute("details", _to_bool(details))
5415
5416
        return self._send_xml_command(cmd)
5417
5418
    def get_report_formats(
5419
        self,

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,