Code Duplication    Length = 25-27 lines in 3 locations

gvm/protocols/gmpv7.py 3 locations

@@ 3768-3794 (lines=27) @@
3765
        cmd.set_attribute("tag_id", tag_id)
3766
        return self._send_xml_command(cmd)
3767
3768
    def get_targets(
3769
        self, *, filter=None, filter_id=None, trash=None, tasks=None
3770
    ):
3771
        """Request a list of targets
3772
3773
        Arguments:
3774
            filter (str, optional): Filter term to use for the query
3775
            filter_id (str, optional): UUID of an existing filter to use for
3776
                the query
3777
            trash (boolean, optional): Whether to get the trashcan targets
3778
                instead
3779
            tasks (boolean, optional): Whether to include list of tasks that
3780
                use the target
3781
3782
        Returns:
3783
            The response. See :py:meth:`send_command` for details.
3784
        """
3785
        cmd = XmlCommand("get_targets")
3786
3787
        _add_filter(cmd, filter, filter_id)
3788
3789
        if not trash is None:
3790
            cmd.set_attribute("trash", _to_bool(trash))
3791
3792
        if not tasks is None:
3793
            cmd.set_attribute("tasks", _to_bool(tasks))
3794
3795
        return self._send_xml_command(cmd)
3796
3797
    def get_target(self, target_id):
@@ 3591-3617 (lines=27) @@
3588
        cmd.set_attribute("details", "1")
3589
        return self._send_xml_command(cmd)
3590
3591
    def get_schedules(
3592
        self, *, filter=None, filter_id=None, trash=None, tasks=None
3593
    ):
3594
        """Request a list of schedules
3595
3596
        Arguments:
3597
            filter (str, optional): Filter term to use for the query
3598
            filter_id (str, optional): UUID of an existing filter to use for
3599
                the query
3600
            trash (boolean, optional): Whether to get the trashcan schedules
3601
                instead
3602
            tasks (boolean, optional): Whether to include tasks using the
3603
                schedules
3604
3605
        Returns:
3606
            The response. See :py:meth:`send_command` for details.
3607
        """
3608
        cmd = XmlCommand("get_schedules")
3609
3610
        _add_filter(cmd, filter, filter_id)
3611
3612
        if not trash is None:
3613
            cmd.set_attribute("trash", _to_bool(trash))
3614
3615
        if not tasks is None:
3616
            cmd.set_attribute("tasks", _to_bool(tasks))
3617
3618
        return self._send_xml_command(cmd)
3619
3620
    def get_schedule(self, schedule_id):
@@ 2531-2555 (lines=25) @@
2528
        cmd.set_attributes(kwargs)
2529
        return self._send_xml_command(cmd)
2530
2531
    def get_alerts(
2532
        self, *, filter=None, filter_id=None, trash=None, tasks=None
2533
    ):
2534
        """Request a list of alerts
2535
2536
        Arguments:
2537
            filter (str, optional): Filter term to use for the query
2538
            filter_id (str, optional): UUID of an existing filter to use for
2539
                the query
2540
            trash (boolean, optional): True to request the alerts in the
2541
                trashcan
2542
            tasks (boolean, optional): Whether to include the tasks using the
2543
                alerts
2544
        Returns:
2545
            The response. See :py:meth:`send_command` for details.
2546
        """
2547
        cmd = XmlCommand("get_alerts")
2548
2549
        _add_filter(cmd, filter, filter_id)
2550
2551
        if not trash is None:
2552
            cmd.set_attribute("trash", _to_bool(trash))
2553
2554
        if not tasks is None:
2555
            cmd.set_attribute("tasks", _to_bool(tasks))
2556
2557
        return self._send_xml_command(cmd)
2558