Code Duplication    Length = 25-27 lines in 3 locations

gvm/protocols/gmpv7.py 3 locations

@@ 3116-3142 (lines=27) @@
3113
        cmd.set_attribute('tag_id', tag_id)
3114
        return self._send_xml_command(cmd)
3115
3116
    def get_targets(self, *, filter=None, filter_id=None, trash=None,
3117
                    tasks=None):
3118
        """Request a list of targets
3119
3120
        Arguments:
3121
            filter (str, optional): Filter term to use for the query
3122
            filter_id (str, optional): UUID of an existing filter to use for
3123
                the query
3124
            trash (boolean, optional): Whether to get the trashcan targets
3125
                instead
3126
            tasks (boolean, optional): Whether to include list of tasks that
3127
                use the target
3128
3129
        Returns:
3130
            The response. See :py:meth:`send_command` for details.
3131
        """
3132
        cmd = XmlCommand('get_targets')
3133
3134
        _add_filter(cmd, filter, filter_id)
3135
3136
        if not trash is None:
3137
            cmd.set_attribute('trash', _to_bool(trash))
3138
3139
        if not tasks is None:
3140
            cmd.set_attribute('tasks', _to_bool(tasks))
3141
3142
        return self._send_xml_command(cmd)
3143
3144
    def get_target(self, target_id):
3145
        """Request a single target
@@ 2963-2989 (lines=27) @@
2960
        cmd.set_attribute('details', '1')
2961
        return self._send_xml_command(cmd)
2962
2963
    def get_schedules(self, *, filter=None, filter_id=None, trash=None,
2964
                      tasks=None):
2965
        """Request a list of schedules
2966
2967
        Arguments:
2968
            filter (str, optional): Filter term to use for the query
2969
            filter_id (str, optional): UUID of an existing filter to use for
2970
                the query
2971
            trash (boolean, optional): Whether to get the trashcan schedules
2972
                instead
2973
            tasks (boolean, optional): Whether to include tasks using the
2974
                schedules
2975
2976
        Returns:
2977
            The response. See :py:meth:`send_command` for details.
2978
        """
2979
        cmd = XmlCommand('get_schedules')
2980
2981
        _add_filter(cmd, filter, filter_id)
2982
2983
        if not trash is None:
2984
            cmd.set_attribute('trash', _to_bool(trash))
2985
2986
        if not tasks is None:
2987
            cmd.set_attribute('tasks', _to_bool(tasks))
2988
2989
        return self._send_xml_command(cmd)
2990
2991
    def get_schedule(self, schedule_id):
2992
        """Request a single schedule
@@ 2045-2069 (lines=25) @@
2042
        cmd.set_attributes(kwargs)
2043
        return self._send_xml_command(cmd)
2044
2045
    def get_alerts(self, *, filter=None, filter_id=None, trash=None,
2046
                   tasks=None):
2047
        """Request a list of alerts
2048
2049
        Arguments:
2050
            filter (str, optional): Filter term to use for the query
2051
            filter_id (str, optional): UUID of an existing filter to use for
2052
                the query
2053
            trash (boolean, optional): True to request the alerts in the
2054
                trashcan
2055
            tasks (boolean, optional): Whether to include the tasks using the
2056
                alerts
2057
        Returns:
2058
            The response. See :py:meth:`send_command` for details.
2059
        """
2060
        cmd = XmlCommand('get_alerts')
2061
2062
        _add_filter(cmd, filter, filter_id)
2063
2064
        if not trash is None:
2065
            cmd.set_attribute('trash', _to_bool(trash))
2066
2067
        if not tasks is None:
2068
            cmd.set_attribute('tasks', _to_bool(tasks))
2069
2070
        return self._send_xml_command(cmd)
2071
2072
    def get_alert(self, alert_id):