Code Duplication    Length = 25-27 lines in 3 locations

gvm/protocols/gmpv7.py 3 locations

@@ 3479-3505 (lines=27) @@
3476
        cmd.set_attribute('tag_id', tag_id)
3477
        return self._send_xml_command(cmd)
3478
3479
    def get_targets(self, *, filter=None, filter_id=None, trash=None,
3480
                    tasks=None):
3481
        """Request a list of targets
3482
3483
        Arguments:
3484
            filter (str, optional): Filter term to use for the query
3485
            filter_id (str, optional): UUID of an existing filter to use for
3486
                the query
3487
            trash (boolean, optional): Whether to get the trashcan targets
3488
                instead
3489
            tasks (boolean, optional): Whether to include list of tasks that
3490
                use the target
3491
3492
        Returns:
3493
            The response. See :py:meth:`send_command` for details.
3494
        """
3495
        cmd = XmlCommand('get_targets')
3496
3497
        _add_filter(cmd, filter, filter_id)
3498
3499
        if not trash is None:
3500
            cmd.set_attribute('trash', _to_bool(trash))
3501
3502
        if not tasks is None:
3503
            cmd.set_attribute('tasks', _to_bool(tasks))
3504
3505
        return self._send_xml_command(cmd)
3506
3507
    def get_target(self, target_id):
3508
        """Request a single target
@@ 3306-3332 (lines=27) @@
3303
        cmd.set_attribute('details', '1')
3304
        return self._send_xml_command(cmd)
3305
3306
    def get_schedules(self, *, filter=None, filter_id=None, trash=None,
3307
                      tasks=None):
3308
        """Request a list of schedules
3309
3310
        Arguments:
3311
            filter (str, optional): Filter term to use for the query
3312
            filter_id (str, optional): UUID of an existing filter to use for
3313
                the query
3314
            trash (boolean, optional): Whether to get the trashcan schedules
3315
                instead
3316
            tasks (boolean, optional): Whether to include tasks using the
3317
                schedules
3318
3319
        Returns:
3320
            The response. See :py:meth:`send_command` for details.
3321
        """
3322
        cmd = XmlCommand('get_schedules')
3323
3324
        _add_filter(cmd, filter, filter_id)
3325
3326
        if not trash is None:
3327
            cmd.set_attribute('trash', _to_bool(trash))
3328
3329
        if not tasks is None:
3330
            cmd.set_attribute('tasks', _to_bool(tasks))
3331
3332
        return self._send_xml_command(cmd)
3333
3334
    def get_schedule(self, schedule_id):
3335
        """Request a single schedule
@@ 2308-2332 (lines=25) @@
2305
        cmd.set_attributes(kwargs)
2306
        return self._send_xml_command(cmd)
2307
2308
    def get_alerts(self, *, filter=None, filter_id=None, trash=None,
2309
                   tasks=None):
2310
        """Request a list of alerts
2311
2312
        Arguments:
2313
            filter (str, optional): Filter term to use for the query
2314
            filter_id (str, optional): UUID of an existing filter to use for
2315
                the query
2316
            trash (boolean, optional): True to request the alerts in the
2317
                trashcan
2318
            tasks (boolean, optional): Whether to include the tasks using the
2319
                alerts
2320
        Returns:
2321
            The response. See :py:meth:`send_command` for details.
2322
        """
2323
        cmd = XmlCommand('get_alerts')
2324
2325
        _add_filter(cmd, filter, filter_id)
2326
2327
        if not trash is None:
2328
            cmd.set_attribute('trash', _to_bool(trash))
2329
2330
        if not tasks is None:
2331
            cmd.set_attribute('tasks', _to_bool(tasks))
2332
2333
        return self._send_xml_command(cmd)
2334
2335
    def get_alert(self, alert_id):