import click
from parsec.cli import pass_context
from parsec.decorators import custom_exception, dict_output


@click.command('download_dataset')
@click.argument("dataset_id", type=str)
@click.option(
    "--file_path",
    help="If this argument is provided, the dataset will be streamed to disk at that path (should be a directory if use_default_filename=True). If the file_path argument is not provided, the dataset content is loaded into memory and returned by the method (Memory consumption may be heavy as the entire file will be in memory).",
    type=str
)
@click.option(
    "--use_default_filename",
    help="If this argument is True, the exported file will be saved as file_path/%s, where %s is the dataset name. If this argument is False, file_path is assumed to contain the full file path including the filename.",
    default="True",
    show_default=True,
    is_flag=True
)
@click.option(
    "--wait_for_completion",
    help="This parameter is deprecated and ignored, it will be removed in BioBlend 0.12.",
    default="True",
    show_default=True,
    is_flag=True
)
@click.option(
    "--maxwait",
    help="Total time (in seconds) to wait for the dataset state to become terminal. If the dataset state is not terminal within this time, a ``DatasetTimeoutException`` will be thrown.",
    default="12000",
    show_default=True,
    type=float
)
@pass_context
@custom_exception
@dict_output
def cli(ctx, dataset_id, file_path="", use_default_filename=True, wait_for_completion=True, maxwait=12000):
    """Download a dataset to file or in memory. If the dataset state is not 'ok', a ``DatasetStateException`` will be thrown.

Output:

    If a file_path argument is not provided, returns a dict containing the file_content.
                 Otherwise returns nothing.
    """
    return ctx.gi.datasets.download_dataset(dataset_id, file_path=file_path, use_default_filename=use_default_filename, wait_for_completion=wait_for_completion, maxwait=maxwait)

@@ -1024,35 +1024,36 @@
 %22,%0A    default=%22
-Tru
+Fals
 e%22,%0A    show_def
@@ -1915,49 +1915,8 @@
 ame,
- wait_for_completion=wait_for_completion,
  max

Remove wait_for_completion in download_datasets from the call. Fixes error from current bioblend