Code Duplication    Length = 41-42 lines in 4 locations

gvm/protocols/gmpv7/gmpv7.py 2 locations

@@ 3686-3727 (lines=42) @@
3683
3684
        return self._send_xml_command(cmd)
3685
3686
    def get_reports(
3687
        self,
3688
        *,
3689
        filter: Optional[str] = None,
3690
        filter_id: Optional[str] = None,
3691
        note_details: Optional[bool] = None,
3692
        override_details: Optional[bool] = None,
3693
        details: Optional[bool] = None,
3694
    ) -> Any:
3695
        """Request a list of reports
3696
3697
        Arguments:
3698
            filter: Filter term to use for the query
3699
            filter_id: UUID of an existing filter to use for the query
3700
            note_details: If notes are included, whether to include note details
3701
            override_details: If overrides are included, whether to include
3702
                override details
3703
            details: Whether to exclude results
3704
3705
        Returns:
3706
            The response. See :py:meth:`send_command` for details.
3707
        """
3708
        cmd = XmlCommand("get_reports")
3709
3710
        if filter:
3711
            cmd.set_attribute("report_filter", filter)
3712
3713
        if filter_id:
3714
            cmd.set_attribute("report_filt_id", filter_id)
3715
3716
        if note_details is not None:
3717
            cmd.set_attribute("note_details", _to_bool(note_details))
3718
3719
        if override_details is not None:
3720
            cmd.set_attribute("override_details", _to_bool(override_details))
3721
3722
        if details is not None:
3723
            cmd.set_attribute("details", _to_bool(details))
3724
3725
        cmd.set_attribute("ignore_pagination", "1")
3726
3727
        return self._send_xml_command(cmd)
3728
3729
    def get_report(
3730
        self,
@@ 3854-3894 (lines=41) @@
3851
        cmd.set_attribute("details", "1")
3852
        return self._send_xml_command(cmd)
3853
3854
    def get_results(
3855
        self,
3856
        *,
3857
        filter: Optional[str] = None,
3858
        filter_id: Optional[str] = None,
3859
        task_id: Optional[str] = None,
3860
        note_details: Optional[bool] = None,
3861
        override_details: Optional[bool] = None,
3862
        details: Optional[bool] = None,
3863
    ) -> Any:
3864
        """Request a list of results
3865
3866
        Arguments:
3867
            filter: Filter term to use for the query
3868
            filter_id: UUID of an existing filter to use for the query
3869
            task_id: UUID of task for note and override handling
3870
            note_details: If notes are included, whether to include note details
3871
            override_details: If overrides are included, whether to include
3872
                override details
3873
            details: Whether to include additional details of the results
3874
3875
        Returns:
3876
            The response. See :py:meth:`send_command` for details.
3877
        """
3878
        cmd = XmlCommand("get_results")
3879
3880
        _add_filter(cmd, filter, filter_id)
3881
3882
        if task_id:
3883
            cmd.set_attribute("task_id", task_id)
3884
3885
        if details is not None:
3886
            cmd.set_attribute("details", _to_bool(details))
3887
3888
        if note_details is not None:
3889
            cmd.set_attribute("note_details", _to_bool(note_details))
3890
3891
        if override_details is not None:
3892
            cmd.set_attribute("override_details", _to_bool(override_details))
3893
3894
        return self._send_xml_command(cmd)
3895
3896
    def get_result(self, result_id: str) -> Any:
3897
        """Request a single result

gvm/protocols/gmpv208/gmpv208.py 2 locations

@@ 5352-5393 (lines=42) @@
5349
5350
        return self._send_xml_command(cmd)
5351
5352
    def get_reports(
5353
        self,
5354
        *,
5355
        filter: Optional[str] = None,
5356
        filter_id: Optional[str] = None,
5357
        note_details: Optional[bool] = None,
5358
        override_details: Optional[bool] = None,
5359
        details: Optional[bool] = None,
5360
    ) -> Any:
5361
        """Request a list of reports
5362
5363
        Arguments:
5364
            filter: Filter term to use for the query
5365
            filter_id: UUID of an existing filter to use for the query
5366
            note_details: If notes are included, whether to include note details
5367
            override_details: If overrides are included, whether to include
5368
                override details
5369
            details: Whether to exclude results
5370
5371
        Returns:
5372
            The response. See :py:meth:`send_command` for details.
5373
        """
5374
        cmd = XmlCommand("get_reports")
5375
5376
        if filter:
5377
            cmd.set_attribute("report_filter", filter)
5378
5379
        if filter_id:
5380
            cmd.set_attribute("report_filt_id", filter_id)
5381
5382
        if note_details is not None:
5383
            cmd.set_attribute("note_details", _to_bool(note_details))
5384
5385
        if override_details is not None:
5386
            cmd.set_attribute("override_details", _to_bool(override_details))
5387
5388
        if details is not None:
5389
            cmd.set_attribute("details", _to_bool(details))
5390
5391
        cmd.set_attribute("ignore_pagination", "1")
5392
5393
        return self._send_xml_command(cmd)
5394
5395
    def get_report(
5396
        self,
@@ 5520-5560 (lines=41) @@
5517
        cmd.set_attribute("details", "1")
5518
        return self._send_xml_command(cmd)
5519
5520
    def get_results(
5521
        self,
5522
        *,
5523
        filter: Optional[str] = None,
5524
        filter_id: Optional[str] = None,
5525
        task_id: Optional[str] = None,
5526
        note_details: Optional[bool] = None,
5527
        override_details: Optional[bool] = None,
5528
        details: Optional[bool] = None,
5529
    ) -> Any:
5530
        """Request a list of results
5531
5532
        Arguments:
5533
            filter: Filter term to use for the query
5534
            filter_id: UUID of an existing filter to use for the query
5535
            task_id: UUID of task for note and override handling
5536
            note_details: If notes are included, whether to include note details
5537
            override_details: If overrides are included, whether to include
5538
                override details
5539
            details: Whether to include additional details of the results
5540
5541
        Returns:
5542
            The response. See :py:meth:`send_command` for details.
5543
        """
5544
        cmd = XmlCommand("get_results")
5545
5546
        _add_filter(cmd, filter, filter_id)
5547
5548
        if task_id:
5549
            cmd.set_attribute("task_id", task_id)
5550
5551
        if details is not None:
5552
            cmd.set_attribute("details", _to_bool(details))
5553
5554
        if note_details is not None:
5555
            cmd.set_attribute("note_details", _to_bool(note_details))
5556
5557
        if override_details is not None:
5558
            cmd.set_attribute("override_details", _to_bool(override_details))
5559
5560
        return self._send_xml_command(cmd)
5561
5562
    def get_result(self, result_id: str) -> Any:
5563
        """Request a single result