Code Duplication    Length = 30-32 lines in 2 locations

gvm/protocols/gmpv7.py 2 locations

@@ 2577-2608 (lines=32) @@
2574
        cmd.set_attribute('permission_id', permission_id)
2575
        return self._send_xml_command(cmd)
2576
2577
    def get_port_lists(self, filter=None, filter_id=None, details=None,
2578
                       targets=None, trash=None):
2579
        """Request a list of port lists
2580
2581
        Arguments:
2582
            filter (str, optional): Filter term to use for the query
2583
            filter_id (str, optional): UUID of an existing filter to use for
2584
                the query
2585
            details (boolean, optional): Whether to include full port list
2586
                details
2587
            targets (boolean, optional): Whether to include targets using this
2588
                port list
2589
            trash (boolean, optional): Whether to get port lists in the
2590
                trashcan instead
2591
2592
        Returns:
2593
            The response. See :py:meth:`send_command` for details.
2594
        """
2595
        cmd = XmlCommand('get_port_lists')
2596
2597
        _add_filter(cmd, filter, filter_id)
2598
2599
        if not details is None:
2600
            cmd.set_attribute('details', _to_bool(details))
2601
2602
        if not targets is None:
2603
            cmd.set_attribute('targets', _to_bool(targets))
2604
2605
        if not trash is None:
2606
            cmd.set_attribute('trash', _to_bool(trash))
2607
2608
        return self._send_xml_command(cmd)
2609
2610
    def get_port_list(self, port_list_id):
2611
        """Request a single port list
@@ 3107-3136 (lines=30) @@
3104
        cmd.set_attribute('target_id', target_id)
3105
        return self._send_xml_command(cmd)
3106
3107
    def get_tasks(self, filter=None, filter_id=None, trash=None, details=None,
3108
                  schedules_only=None):
3109
        """Request a list of tasks
3110
3111
        Arguments:
3112
            filter (str, optional): Filter term to use for the query
3113
            filter_id (str, optional): UUID of an existing filter to use for
3114
                the query
3115
            trash (boolean, optional): Whether to get the trashcan tasks instead
3116
            details (boolean, optional): Whether to include full task details
3117
            schedules_only (boolean, optional): Whether to only include id, name
3118
                and schedule details
3119
3120
        Returns:
3121
            The response. See :py:meth:`send_command` for details.
3122
        """
3123
        cmd = XmlCommand('get_tasks')
3124
3125
        _add_filter(cmd, filter, filter_id)
3126
3127
        if not trash is None:
3128
            cmd.set_attribute('trash', _to_bool(trash))
3129
3130
        if not details is None:
3131
            cmd.set_attribute('details', _to_bool(details))
3132
3133
        if not schedules_only is None:
3134
            cmd.set_attribute('schedules_only', _to_bool(schedules_only))
3135
3136
        return self._send_xml_command(cmd)
3137
3138
    def get_task(self, task_id):
3139
        """Request a single task