Code Duplication    Length = 30-32 lines in 2 locations

gvm/protocols/gmpv7.py 2 locations

@@ 2615-2646 (lines=32) @@
2612
        cmd.set_attribute('permission_id', permission_id)
2613
        return self._send_xml_command(cmd)
2614
2615
    def get_port_lists(self, *, filter=None, filter_id=None, details=None,
2616
                       targets=None, trash=None):
2617
        """Request a list of port lists
2618
2619
        Arguments:
2620
            filter (str, optional): Filter term to use for the query
2621
            filter_id (str, optional): UUID of an existing filter to use for
2622
                the query
2623
            details (boolean, optional): Whether to include full port list
2624
                details
2625
            targets (boolean, optional): Whether to include targets using this
2626
                port list
2627
            trash (boolean, optional): Whether to get port lists in the
2628
                trashcan instead
2629
2630
        Returns:
2631
            The response. See :py:meth:`send_command` for details.
2632
        """
2633
        cmd = XmlCommand('get_port_lists')
2634
2635
        _add_filter(cmd, filter, filter_id)
2636
2637
        if not details is None:
2638
            cmd.set_attribute('details', _to_bool(details))
2639
2640
        if not targets is None:
2641
            cmd.set_attribute('targets', _to_bool(targets))
2642
2643
        if not trash is None:
2644
            cmd.set_attribute('trash', _to_bool(trash))
2645
2646
        return self._send_xml_command(cmd)
2647
2648
    def get_port_list(self, port_list_id):
2649
        """Request a single port list
@@ 3140-3169 (lines=30) @@
3137
        cmd.set_attribute('target_id', target_id)
3138
        return self._send_xml_command(cmd)
3139
3140
    def get_tasks(self, *, filter=None, filter_id=None, trash=None,
3141
                  details=None, schedules_only=None):
3142
        """Request a list of tasks
3143
3144
        Arguments:
3145
            filter (str, optional): Filter term to use for the query
3146
            filter_id (str, optional): UUID of an existing filter to use for
3147
                the query
3148
            trash (boolean, optional): Whether to get the trashcan tasks instead
3149
            details (boolean, optional): Whether to include full task details
3150
            schedules_only (boolean, optional): Whether to only include id, name
3151
                and schedule details
3152
3153
        Returns:
3154
            The response. See :py:meth:`send_command` for details.
3155
        """
3156
        cmd = XmlCommand('get_tasks')
3157
3158
        _add_filter(cmd, filter, filter_id)
3159
3160
        if not trash is None:
3161
            cmd.set_attribute('trash', _to_bool(trash))
3162
3163
        if not details is None:
3164
            cmd.set_attribute('details', _to_bool(details))
3165
3166
        if not schedules_only is None:
3167
            cmd.set_attribute('schedules_only', _to_bool(schedules_only))
3168
3169
        return self._send_xml_command(cmd)
3170
3171
    def get_task(self, task_id):
3172
        """Request a single task