Code Duplication    Length = 30-32 lines in 2 locations

gvm/protocols/gmpv7.py 2 locations

@@ 2659-2690 (lines=32) @@
2656
        cmd.set_attribute('permission_id', permission_id)
2657
        return self._send_xml_command(cmd)
2658
2659
    def get_port_lists(self, *, filter=None, filter_id=None, details=None,
2660
                       targets=None, trash=None):
2661
        """Request a list of port lists
2662
2663
        Arguments:
2664
            filter (str, optional): Filter term to use for the query
2665
            filter_id (str, optional): UUID of an existing filter to use for
2666
                the query
2667
            details (boolean, optional): Whether to include full port list
2668
                details
2669
            targets (boolean, optional): Whether to include targets using this
2670
                port list
2671
            trash (boolean, optional): Whether to get port lists in the
2672
                trashcan instead
2673
2674
        Returns:
2675
            The response. See :py:meth:`send_command` for details.
2676
        """
2677
        cmd = XmlCommand('get_port_lists')
2678
2679
        _add_filter(cmd, filter, filter_id)
2680
2681
        if not details is None:
2682
            cmd.set_attribute('details', _to_bool(details))
2683
2684
        if not targets is None:
2685
            cmd.set_attribute('targets', _to_bool(targets))
2686
2687
        if not trash is None:
2688
            cmd.set_attribute('trash', _to_bool(trash))
2689
2690
        return self._send_xml_command(cmd)
2691
2692
    def get_port_list(self, port_list_id):
2693
        """Request a single port list
@@ 3184-3213 (lines=30) @@
3181
        cmd.set_attribute('target_id', target_id)
3182
        return self._send_xml_command(cmd)
3183
3184
    def get_tasks(self, *, filter=None, filter_id=None, trash=None,
3185
                  details=None, schedules_only=None):
3186
        """Request a list of tasks
3187
3188
        Arguments:
3189
            filter (str, optional): Filter term to use for the query
3190
            filter_id (str, optional): UUID of an existing filter to use for
3191
                the query
3192
            trash (boolean, optional): Whether to get the trashcan tasks instead
3193
            details (boolean, optional): Whether to include full task details
3194
            schedules_only (boolean, optional): Whether to only include id, name
3195
                and schedule details
3196
3197
        Returns:
3198
            The response. See :py:meth:`send_command` for details.
3199
        """
3200
        cmd = XmlCommand('get_tasks')
3201
3202
        _add_filter(cmd, filter, filter_id)
3203
3204
        if not trash is None:
3205
            cmd.set_attribute('trash', _to_bool(trash))
3206
3207
        if not details is None:
3208
            cmd.set_attribute('details', _to_bool(details))
3209
3210
        if not schedules_only is None:
3211
            cmd.set_attribute('schedules_only', _to_bool(schedules_only))
3212
3213
        return self._send_xml_command(cmd)
3214
3215
    def get_task(self, task_id):
3216
        """Request a single task