Code Duplication    Length = 30-32 lines in 2 locations

gvm/protocols/gmpv7.py 2 locations

@@ 2632-2663 (lines=32) @@
2629
        cmd.set_attribute('permission_id', permission_id)
2630
        return self._send_xml_command(cmd)
2631
2632
    def get_port_lists(self, *, filter=None, filter_id=None, details=None,
2633
                       targets=None, trash=None):
2634
        """Request a list of port lists
2635
2636
        Arguments:
2637
            filter (str, optional): Filter term to use for the query
2638
            filter_id (str, optional): UUID of an existing filter to use for
2639
                the query
2640
            details (boolean, optional): Whether to include full port list
2641
                details
2642
            targets (boolean, optional): Whether to include targets using this
2643
                port list
2644
            trash (boolean, optional): Whether to get port lists in the
2645
                trashcan instead
2646
2647
        Returns:
2648
            The response. See :py:meth:`send_command` for details.
2649
        """
2650
        cmd = XmlCommand('get_port_lists')
2651
2652
        _add_filter(cmd, filter, filter_id)
2653
2654
        if not details is None:
2655
            cmd.set_attribute('details', _to_bool(details))
2656
2657
        if not targets is None:
2658
            cmd.set_attribute('targets', _to_bool(targets))
2659
2660
        if not trash is None:
2661
            cmd.set_attribute('trash', _to_bool(trash))
2662
2663
        return self._send_xml_command(cmd)
2664
2665
    def get_port_list(self, port_list_id):
2666
        """Request a single port list
@@ 3157-3186 (lines=30) @@
3154
        cmd.set_attribute('target_id', target_id)
3155
        return self._send_xml_command(cmd)
3156
3157
    def get_tasks(self, *, filter=None, filter_id=None, trash=None,
3158
                  details=None, schedules_only=None):
3159
        """Request a list of tasks
3160
3161
        Arguments:
3162
            filter (str, optional): Filter term to use for the query
3163
            filter_id (str, optional): UUID of an existing filter to use for
3164
                the query
3165
            trash (boolean, optional): Whether to get the trashcan tasks instead
3166
            details (boolean, optional): Whether to include full task details
3167
            schedules_only (boolean, optional): Whether to only include id, name
3168
                and schedule details
3169
3170
        Returns:
3171
            The response. See :py:meth:`send_command` for details.
3172
        """
3173
        cmd = XmlCommand('get_tasks')
3174
3175
        _add_filter(cmd, filter, filter_id)
3176
3177
        if not trash is None:
3178
            cmd.set_attribute('trash', _to_bool(trash))
3179
3180
        if not details is None:
3181
            cmd.set_attribute('details', _to_bool(details))
3182
3183
        if not schedules_only is None:
3184
            cmd.set_attribute('schedules_only', _to_bool(schedules_only))
3185
3186
        return self._send_xml_command(cmd)
3187
3188
    def get_task(self, task_id):
3189
        """Request a single task