Code Duplication    Length = 30-32 lines in 2 locations

gvm/protocols/gmpv7.py 2 locations

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