Code Duplication    Length = 25-27 lines in 3 locations

gvm/protocols/gmpv7.py 3 locations

@@ 3136-3162 (lines=27) @@
3133
        cmd.set_attribute('tag_id', tag_id)
3134
        return self._send_xml_command(cmd)
3135
3136
    def get_targets(self, *, filter=None, filter_id=None, trash=None,
3137
                    tasks=None):
3138
        """Request a list of targets
3139
3140
        Arguments:
3141
            filter (str, optional): Filter term to use for the query
3142
            filter_id (str, optional): UUID of an existing filter to use for
3143
                the query
3144
            trash (boolean, optional): Whether to get the trashcan targets
3145
                instead
3146
            tasks (boolean, optional): Whether to include list of tasks that
3147
                use the target
3148
3149
        Returns:
3150
            The response. See :py:meth:`send_command` for details.
3151
        """
3152
        cmd = XmlCommand('get_targets')
3153
3154
        _add_filter(cmd, filter, filter_id)
3155
3156
        if not trash is None:
3157
            cmd.set_attribute('trash', _to_bool(trash))
3158
3159
        if not tasks is None:
3160
            cmd.set_attribute('tasks', _to_bool(tasks))
3161
3162
        return self._send_xml_command(cmd)
3163
3164
    def get_target(self, target_id):
3165
        """Request a single target
@@ 2983-3009 (lines=27) @@
2980
        cmd.set_attribute('details', '1')
2981
        return self._send_xml_command(cmd)
2982
2983
    def get_schedules(self, *, filter=None, filter_id=None, trash=None,
2984
                      tasks=None):
2985
        """Request a list of schedules
2986
2987
        Arguments:
2988
            filter (str, optional): Filter term to use for the query
2989
            filter_id (str, optional): UUID of an existing filter to use for
2990
                the query
2991
            trash (boolean, optional): Whether to get the trashcan schedules
2992
                instead
2993
            tasks (boolean, optional): Whether to include tasks using the
2994
                schedules
2995
2996
        Returns:
2997
            The response. See :py:meth:`send_command` for details.
2998
        """
2999
        cmd = XmlCommand('get_schedules')
3000
3001
        _add_filter(cmd, filter, filter_id)
3002
3003
        if not trash is None:
3004
            cmd.set_attribute('trash', _to_bool(trash))
3005
3006
        if not tasks is None:
3007
            cmd.set_attribute('tasks', _to_bool(tasks))
3008
3009
        return self._send_xml_command(cmd)
3010
3011
    def get_schedule(self, schedule_id):
3012
        """Request a single schedule
@@ 2062-2086 (lines=25) @@
2059
        cmd.set_attributes(kwargs)
2060
        return self._send_xml_command(cmd)
2061
2062
    def get_alerts(self, *, filter=None, filter_id=None, trash=None,
2063
                   tasks=None):
2064
        """Request a list of alerts
2065
2066
        Arguments:
2067
            filter (str, optional): Filter term to use for the query
2068
            filter_id (str, optional): UUID of an existing filter to use for
2069
                the query
2070
            trash (boolean, optional): True to request the alerts in the
2071
                trashcan
2072
            tasks (boolean, optional): Whether to include the tasks using the
2073
                alerts
2074
        Returns:
2075
            The response. See :py:meth:`send_command` for details.
2076
        """
2077
        cmd = XmlCommand('get_alerts')
2078
2079
        _add_filter(cmd, filter, filter_id)
2080
2081
        if not trash is None:
2082
            cmd.set_attribute('trash', _to_bool(trash))
2083
2084
        if not tasks is None:
2085
            cmd.set_attribute('tasks', _to_bool(tasks))
2086
2087
        return self._send_xml_command(cmd)
2088
2089
    def get_alert(self, alert_id):