Code Duplication    Length = 25-27 lines in 3 locations

gvm/protocols/gmpv7.py 3 locations

@@ 3840-3866 (lines=27) @@
3837
        cmd.set_attribute("tag_id", tag_id)
3838
        return self._send_xml_command(cmd)
3839
3840
    def get_targets(
3841
        self, *, filter=None, filter_id=None, trash=None, tasks=None
3842
    ):
3843
        """Request a list of targets
3844
3845
        Arguments:
3846
            filter (str, optional): Filter term to use for the query
3847
            filter_id (str, optional): UUID of an existing filter to use for
3848
                the query
3849
            trash (boolean, optional): Whether to get the trashcan targets
3850
                instead
3851
            tasks (boolean, optional): Whether to include list of tasks that
3852
                use the target
3853
3854
        Returns:
3855
            The response. See :py:meth:`send_command` for details.
3856
        """
3857
        cmd = XmlCommand("get_targets")
3858
3859
        _add_filter(cmd, filter, filter_id)
3860
3861
        if not trash is None:
3862
            cmd.set_attribute("trash", _to_bool(trash))
3863
3864
        if not tasks is None:
3865
            cmd.set_attribute("tasks", _to_bool(tasks))
3866
3867
        return self._send_xml_command(cmd)
3868
3869
    def get_target(self, target_id):
@@ 3663-3689 (lines=27) @@
3660
        cmd.set_attribute("details", "1")
3661
        return self._send_xml_command(cmd)
3662
3663
    def get_schedules(
3664
        self, *, filter=None, filter_id=None, trash=None, tasks=None
3665
    ):
3666
        """Request a list of schedules
3667
3668
        Arguments:
3669
            filter (str, optional): Filter term to use for the query
3670
            filter_id (str, optional): UUID of an existing filter to use for
3671
                the query
3672
            trash (boolean, optional): Whether to get the trashcan schedules
3673
                instead
3674
            tasks (boolean, optional): Whether to include tasks using the
3675
                schedules
3676
3677
        Returns:
3678
            The response. See :py:meth:`send_command` for details.
3679
        """
3680
        cmd = XmlCommand("get_schedules")
3681
3682
        _add_filter(cmd, filter, filter_id)
3683
3684
        if not trash is None:
3685
            cmd.set_attribute("trash", _to_bool(trash))
3686
3687
        if not tasks is None:
3688
            cmd.set_attribute("tasks", _to_bool(tasks))
3689
3690
        return self._send_xml_command(cmd)
3691
3692
    def get_schedule(self, schedule_id):
@@ 2603-2627 (lines=25) @@
2600
        cmd.set_attributes(kwargs)
2601
        return self._send_xml_command(cmd)
2602
2603
    def get_alerts(
2604
        self, *, filter=None, filter_id=None, trash=None, tasks=None
2605
    ):
2606
        """Request a list of alerts
2607
2608
        Arguments:
2609
            filter (str, optional): Filter term to use for the query
2610
            filter_id (str, optional): UUID of an existing filter to use for
2611
                the query
2612
            trash (boolean, optional): True to request the alerts in the
2613
                trashcan
2614
            tasks (boolean, optional): Whether to include the tasks using the
2615
                alerts
2616
        Returns:
2617
            The response. See :py:meth:`send_command` for details.
2618
        """
2619
        cmd = XmlCommand("get_alerts")
2620
2621
        _add_filter(cmd, filter, filter_id)
2622
2623
        if not trash is None:
2624
            cmd.set_attribute("trash", _to_bool(trash))
2625
2626
        if not tasks is None:
2627
            cmd.set_attribute("tasks", _to_bool(tasks))
2628
2629
        return self._send_xml_command(cmd)
2630