Code Duplication    Length = 30-32 lines in 2 locations

gvm/protocols/gmpv7.py 2 locations

@@ 2932-2963 (lines=32) @@
2929
        cmd.set_attribute('permission_id', permission_id)
2930
        return self._send_xml_command(cmd)
2931
2932
    def get_port_lists(self, *, filter=None, filter_id=None, details=None,
2933
                       targets=None, trash=None):
2934
        """Request a list of port lists
2935
2936
        Arguments:
2937
            filter (str, optional): Filter term to use for the query
2938
            filter_id (str, optional): UUID of an existing filter to use for
2939
                the query
2940
            details (boolean, optional): Whether to include full port list
2941
                details
2942
            targets (boolean, optional): Whether to include targets using this
2943
                port list
2944
            trash (boolean, optional): Whether to get port lists in the
2945
                trashcan instead
2946
2947
        Returns:
2948
            The response. See :py:meth:`send_command` for details.
2949
        """
2950
        cmd = XmlCommand('get_port_lists')
2951
2952
        _add_filter(cmd, filter, filter_id)
2953
2954
        if not details is None:
2955
            cmd.set_attribute('details', _to_bool(details))
2956
2957
        if not targets is None:
2958
            cmd.set_attribute('targets', _to_bool(targets))
2959
2960
        if not trash is None:
2961
            cmd.set_attribute('trash', _to_bool(trash))
2962
2963
        return self._send_xml_command(cmd)
2964
2965
    def get_port_list(self, port_list_id):
2966
        """Request a single port list
@@ 3525-3554 (lines=30) @@
3522
        cmd.set_attribute('target_id', target_id)
3523
        return self._send_xml_command(cmd)
3524
3525
    def get_tasks(self, *, filter=None, filter_id=None, trash=None,
3526
                  details=None, schedules_only=None):
3527
        """Request a list of tasks
3528
3529
        Arguments:
3530
            filter (str, optional): Filter term to use for the query
3531
            filter_id (str, optional): UUID of an existing filter to use for
3532
                the query
3533
            trash (boolean, optional): Whether to get the trashcan tasks instead
3534
            details (boolean, optional): Whether to include full task details
3535
            schedules_only (boolean, optional): Whether to only include id, name
3536
                and schedule details
3537
3538
        Returns:
3539
            The response. See :py:meth:`send_command` for details.
3540
        """
3541
        cmd = XmlCommand('get_tasks')
3542
3543
        _add_filter(cmd, filter, filter_id)
3544
3545
        if not trash is None:
3546
            cmd.set_attribute('trash', _to_bool(trash))
3547
3548
        if not details is None:
3549
            cmd.set_attribute('details', _to_bool(details))
3550
3551
        if not schedules_only is None:
3552
            cmd.set_attribute('schedules_only', _to_bool(schedules_only))
3553
3554
        return self._send_xml_command(cmd)
3555
3556
    def get_task(self, task_id):
3557
        """Request a single task