From 656ba0afb867301ccb48b24837fda1793e3281dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20K=C3=B6ster?= Date: Fri, 22 Mar 2024 11:17:57 +0100 Subject: [PATCH] fix: quote list of args (#62) --- snakemake_interface_executor_plugins/utils.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/snakemake_interface_executor_plugins/utils.py b/snakemake_interface_executor_plugins/utils.py index b72ac7c..2fa22ba 100644 --- a/snakemake_interface_executor_plugins/utils.py +++ b/snakemake_interface_executor_plugins/utils.py @@ -40,12 +40,10 @@ def format_cli_pos_arg(value, quote=True): elif not_iterable(value): return format_cli_value(value) else: - return join_cli_args( - format_cli_value(v, quote_if_contains_whitespace=True) for v in value - ) + return join_cli_args(format_cli_value(v, quote=True) for v in value) -def format_cli_value(value: Any, quote_if_contains_whitespace: bool = False) -> str: +def format_cli_value(value: Any, quote: bool = False) -> str: if isinstance(value, SettingsEnumBase): return value.item_to_choice() elif isinstance(value, Path): @@ -54,8 +52,7 @@ def format_cli_value(value: Any, quote_if_contains_whitespace: bool = False) -> if is_quoted(value): # the value is already quoted, do not quote again return value - elif quote_if_contains_whitespace and " " in value: - # may be expression + elif quote: return repr(value) else: return value