Code Duplication    Length = 25-27 lines in 3 locations

gvm/protocols/gmpv7.py 3 locations

@@ 3259-3285 (lines=27) @@
3256
        cmd.set_attribute('tag_id', tag_id)
3257
        return self._send_xml_command(cmd)
3258
3259
    def get_targets(self, *, filter=None, filter_id=None, trash=None,
3260
                    tasks=None):
3261
        """Request a list of targets
3262
3263
        Arguments:
3264
            filter (str, optional): Filter term to use for the query
3265
            filter_id (str, optional): UUID of an existing filter to use for
3266
                the query
3267
            trash (boolean, optional): Whether to get the trashcan targets
3268
                instead
3269
            tasks (boolean, optional): Whether to include list of tasks that
3270
                use the target
3271
3272
        Returns:
3273
            The response. See :py:meth:`send_command` for details.
3274
        """
3275
        cmd = XmlCommand('get_targets')
3276
3277
        _add_filter(cmd, filter, filter_id)
3278
3279
        if not trash is None:
3280
            cmd.set_attribute('trash', _to_bool(trash))
3281
3282
        if not tasks is None:
3283
            cmd.set_attribute('tasks', _to_bool(tasks))
3284
3285
        return self._send_xml_command(cmd)
3286
3287
    def get_target(self, target_id):
3288
        """Request a single target
@@ 3106-3132 (lines=27) @@
3103
        cmd.set_attribute('details', '1')
3104
        return self._send_xml_command(cmd)
3105
3106
    def get_schedules(self, *, filter=None, filter_id=None, trash=None,
3107
                      tasks=None):
3108
        """Request a list of schedules
3109
3110
        Arguments:
3111
            filter (str, optional): Filter term to use for the query
3112
            filter_id (str, optional): UUID of an existing filter to use for
3113
                the query
3114
            trash (boolean, optional): Whether to get the trashcan schedules
3115
                instead
3116
            tasks (boolean, optional): Whether to include tasks using the
3117
                schedules
3118
3119
        Returns:
3120
            The response. See :py:meth:`send_command` for details.
3121
        """
3122
        cmd = XmlCommand('get_schedules')
3123
3124
        _add_filter(cmd, filter, filter_id)
3125
3126
        if not trash is None:
3127
            cmd.set_attribute('trash', _to_bool(trash))
3128
3129
        if not tasks is None:
3130
            cmd.set_attribute('tasks', _to_bool(tasks))
3131
3132
        return self._send_xml_command(cmd)
3133
3134
    def get_schedule(self, schedule_id):
3135
        """Request a single schedule
@@ 2172-2196 (lines=25) @@
2169
        cmd.set_attributes(kwargs)
2170
        return self._send_xml_command(cmd)
2171
2172
    def get_alerts(self, *, filter=None, filter_id=None, trash=None,
2173
                   tasks=None):
2174
        """Request a list of alerts
2175
2176
        Arguments:
2177
            filter (str, optional): Filter term to use for the query
2178
            filter_id (str, optional): UUID of an existing filter to use for
2179
                the query
2180
            trash (boolean, optional): True to request the alerts in the
2181
                trashcan
2182
            tasks (boolean, optional): Whether to include the tasks using the
2183
                alerts
2184
        Returns:
2185
            The response. See :py:meth:`send_command` for details.
2186
        """
2187
        cmd = XmlCommand('get_alerts')
2188
2189
        _add_filter(cmd, filter, filter_id)
2190
2191
        if not trash is None:
2192
            cmd.set_attribute('trash', _to_bool(trash))
2193
2194
        if not tasks is None:
2195
            cmd.set_attribute('tasks', _to_bool(tasks))
2196
2197
        return self._send_xml_command(cmd)
2198
2199
    def get_alert(self, alert_id):