Code Duplication    Length = 30-32 lines in 2 locations

gvm/protocols/gmpv7.py 2 locations

@@ 2892-2923 (lines=32) @@
2889
        cmd.set_attribute('permission_id', permission_id)
2890
        return self._send_xml_command(cmd)
2891
2892
    def get_port_lists(self, *, filter=None, filter_id=None, details=None,
2893
                       targets=None, trash=None):
2894
        """Request a list of port lists
2895
2896
        Arguments:
2897
            filter (str, optional): Filter term to use for the query
2898
            filter_id (str, optional): UUID of an existing filter to use for
2899
                the query
2900
            details (boolean, optional): Whether to include full port list
2901
                details
2902
            targets (boolean, optional): Whether to include targets using this
2903
                port list
2904
            trash (boolean, optional): Whether to get port lists in the
2905
                trashcan instead
2906
2907
        Returns:
2908
            The response. See :py:meth:`send_command` for details.
2909
        """
2910
        cmd = XmlCommand('get_port_lists')
2911
2912
        _add_filter(cmd, filter, filter_id)
2913
2914
        if not details is None:
2915
            cmd.set_attribute('details', _to_bool(details))
2916
2917
        if not targets is None:
2918
            cmd.set_attribute('targets', _to_bool(targets))
2919
2920
        if not trash is None:
2921
            cmd.set_attribute('trash', _to_bool(trash))
2922
2923
        return self._send_xml_command(cmd)
2924
2925
    def get_port_list(self, port_list_id):
2926
        """Request a single port list
@@ 3485-3514 (lines=30) @@
3482
        cmd.set_attribute('target_id', target_id)
3483
        return self._send_xml_command(cmd)
3484
3485
    def get_tasks(self, *, filter=None, filter_id=None, trash=None,
3486
                  details=None, schedules_only=None):
3487
        """Request a list of tasks
3488
3489
        Arguments:
3490
            filter (str, optional): Filter term to use for the query
3491
            filter_id (str, optional): UUID of an existing filter to use for
3492
                the query
3493
            trash (boolean, optional): Whether to get the trashcan tasks instead
3494
            details (boolean, optional): Whether to include full task details
3495
            schedules_only (boolean, optional): Whether to only include id, name
3496
                and schedule details
3497
3498
        Returns:
3499
            The response. See :py:meth:`send_command` for details.
3500
        """
3501
        cmd = XmlCommand('get_tasks')
3502
3503
        _add_filter(cmd, filter, filter_id)
3504
3505
        if not trash is None:
3506
            cmd.set_attribute('trash', _to_bool(trash))
3507
3508
        if not details is None:
3509
            cmd.set_attribute('details', _to_bool(details))
3510
3511
        if not schedules_only is None:
3512
            cmd.set_attribute('schedules_only', _to_bool(schedules_only))
3513
3514
        return self._send_xml_command(cmd)
3515
3516
    def get_task(self, task_id):
3517
        """Request a single task