Code Duplication    Length = 30-32 lines in 2 locations

gvm/protocols/gmpv7.py 2 locations

@@ 2517-2548 (lines=32) @@
2514
        cmd.set_attribute('permission_id', permission_id)
2515
        return self._send_xml_command(cmd)
2516
2517
    def get_port_lists(self, filter=None, filter_id=None, details=None,
2518
                       targets=None, trash=None):
2519
        """Request a list of port lists
2520
2521
        Arguments:
2522
            filter (str, optional): Filter term to use for the query
2523
            filter_id (str, optional): UUID of an existing filter to use for
2524
                the query
2525
            details (boolean, optional): Whether to include full port list
2526
                details
2527
            targets (boolean, optional): Whether to include targets using this
2528
                port list
2529
            trash (boolean, optional): Whether to get port lists in the
2530
                trashcan instead
2531
2532
        Returns:
2533
            The response. See :py:meth:`send_command` for details.
2534
        """
2535
        cmd = XmlCommand('get_port_lists')
2536
2537
        _add_filter(cmd, filter, filter_id)
2538
2539
        if not details is None:
2540
            cmd.set_attribute('details', _to_bool(details))
2541
2542
        if not targets is None:
2543
            cmd.set_attribute('targets', _to_bool(targets))
2544
2545
        if not trash is None:
2546
            cmd.set_attribute('trash', _to_bool(trash))
2547
2548
        return self._send_xml_command(cmd)
2549
2550
    def get_port_list(self, port_list_id):
2551
        """Request a single port list
@@ 3047-3076 (lines=30) @@
3044
        cmd.set_attribute('target_id', target_id)
3045
        return self._send_xml_command(cmd)
3046
3047
    def get_tasks(self, filter=None, filter_id=None, trash=None, details=None,
3048
                  schedules_only=None):
3049
        """Request a list of tasks
3050
3051
        Arguments:
3052
            filter (str, optional): Filter term to use for the query
3053
            filter_id (str, optional): UUID of an existing filter to use for
3054
                the query
3055
            trash (boolean, optional): Whether to get the trashcan tasks instead
3056
            details (boolean, optional): Whether to include full task details
3057
            schedules_only (boolean, optional): Whether to only include id, name
3058
                and schedule details
3059
3060
        Returns:
3061
            The response. See :py:meth:`send_command` for details.
3062
        """
3063
        cmd = XmlCommand('get_tasks')
3064
3065
        _add_filter(cmd, filter, filter_id)
3066
3067
        if not trash is None:
3068
            cmd.set_attribute('trash', _to_bool(trash))
3069
3070
        if not details is None:
3071
            cmd.set_attribute('details', _to_bool(details))
3072
3073
        if not schedules_only is None:
3074
            cmd.set_attribute('schedules_only', _to_bool(schedules_only))
3075
3076
        return self._send_xml_command(cmd)
3077
3078
    def get_task(self, task_id):
3079
        """Request a single task