Code Duplication    Length = 30-32 lines in 2 locations

gvm/protocols/gmpv7.py 2 locations

@@ 2775-2806 (lines=32) @@
2772
        cmd.set_attribute('permission_id', permission_id)
2773
        return self._send_xml_command(cmd)
2774
2775
    def get_port_lists(self, *, filter=None, filter_id=None, details=None,
2776
                       targets=None, trash=None):
2777
        """Request a list of port lists
2778
2779
        Arguments:
2780
            filter (str, optional): Filter term to use for the query
2781
            filter_id (str, optional): UUID of an existing filter to use for
2782
                the query
2783
            details (boolean, optional): Whether to include full port list
2784
                details
2785
            targets (boolean, optional): Whether to include targets using this
2786
                port list
2787
            trash (boolean, optional): Whether to get port lists in the
2788
                trashcan instead
2789
2790
        Returns:
2791
            The response. See :py:meth:`send_command` for details.
2792
        """
2793
        cmd = XmlCommand('get_port_lists')
2794
2795
        _add_filter(cmd, filter, filter_id)
2796
2797
        if not details is None:
2798
            cmd.set_attribute('details', _to_bool(details))
2799
2800
        if not targets is None:
2801
            cmd.set_attribute('targets', _to_bool(targets))
2802
2803
        if not trash is None:
2804
            cmd.set_attribute('trash', _to_bool(trash))
2805
2806
        return self._send_xml_command(cmd)
2807
2808
    def get_port_list(self, port_list_id):
2809
        """Request a single port list
@@ 3300-3329 (lines=30) @@
3297
        cmd.set_attribute('target_id', target_id)
3298
        return self._send_xml_command(cmd)
3299
3300
    def get_tasks(self, *, filter=None, filter_id=None, trash=None,
3301
                  details=None, schedules_only=None):
3302
        """Request a list of tasks
3303
3304
        Arguments:
3305
            filter (str, optional): Filter term to use for the query
3306
            filter_id (str, optional): UUID of an existing filter to use for
3307
                the query
3308
            trash (boolean, optional): Whether to get the trashcan tasks instead
3309
            details (boolean, optional): Whether to include full task details
3310
            schedules_only (boolean, optional): Whether to only include id, name
3311
                and schedule details
3312
3313
        Returns:
3314
            The response. See :py:meth:`send_command` for details.
3315
        """
3316
        cmd = XmlCommand('get_tasks')
3317
3318
        _add_filter(cmd, filter, filter_id)
3319
3320
        if not trash is None:
3321
            cmd.set_attribute('trash', _to_bool(trash))
3322
3323
        if not details is None:
3324
            cmd.set_attribute('details', _to_bool(details))
3325
3326
        if not schedules_only is None:
3327
            cmd.set_attribute('schedules_only', _to_bool(schedules_only))
3328
3329
        return self._send_xml_command(cmd)
3330
3331
    def get_task(self, task_id):
3332
        """Request a single task