Code Duplication    Length = 30-32 lines in 2 locations

gvm/protocols/gmpv7.py 2 locations

@@ 2458-2489 (lines=32) @@
2455
        cmd.set_attribute('permission_id', permission_id)
2456
        return self._send_xml_command(cmd)
2457
2458
    def get_port_lists(self, filter=None, filter_id=None, details=None,
2459
                       targets=None, trash=None):
2460
        """Request a list of port lists
2461
2462
        Arguments:
2463
            filter (str, optional): Filter term to use for the query
2464
            filter_id (str, optional): UUID of an existing filter to use for
2465
                the query
2466
            details (boolean, optional): Whether to include full port list
2467
                details
2468
            targets (boolean, optional): Whether to include targets using this
2469
                port list
2470
            trash (boolean, optional): Whether to get port lists in the
2471
                trashcan instead
2472
2473
        Returns:
2474
            The response. See :py:meth:`send_command` for details.
2475
        """
2476
        cmd = XmlCommand('get_port_lists')
2477
2478
        _add_filter(cmd, filter, filter_id)
2479
2480
        if not details is None:
2481
            cmd.set_attribute('details', _to_bool(details))
2482
2483
        if not targets is None:
2484
            cmd.set_attribute('targets', _to_bool(targets))
2485
2486
        if not trash is None:
2487
            cmd.set_attribute('trash', _to_bool(trash))
2488
2489
        return self._send_xml_command(cmd)
2490
2491
    def get_port_list(self, port_list_id):
2492
        """Request a single port list
@@ 2966-2995 (lines=30) @@
2963
        cmd.set_attribute('target_id', target_id)
2964
        return self._send_xml_command(cmd)
2965
2966
    def get_tasks(self, filter=None, filter_id=None, trash=None, details=None,
2967
                  schedules_only=None):
2968
        """Request a list of tasks
2969
2970
        Arguments:
2971
            filter (str, optional): Filter term to use for the query
2972
            filter_id (str, optional): UUID of an existing filter to use for
2973
                the query
2974
            trash (boolean, optional): Whether to get the trashcan tasks instead
2975
            details (boolean, optional): Whether to include full task details
2976
            schedules_only (boolean, optional): Whether to only include id, name
2977
                and schedule details
2978
2979
        Returns:
2980
            The response. See :py:meth:`send_command` for details.
2981
        """
2982
        cmd = XmlCommand('get_tasks')
2983
2984
        _add_filter(cmd, filter, filter_id)
2985
2986
        if not trash is None:
2987
            cmd.set_attribute('trash', _to_bool(trash))
2988
2989
        if not details is None:
2990
            cmd.set_attribute('details', _to_bool(details))
2991
2992
        if not schedules_only is None:
2993
            cmd.set_attribute('schedules_only', _to_bool(schedules_only))
2994
2995
        return self._send_xml_command(cmd)
2996
2997
    def get_task(self, task_id):
2998
        """Request a single task