Taragolis commented on code in PR #39464: URL: https://github.com/apache/airflow/pull/39464#discussion_r1593491332
########## airflow/providers/docker/operators/docker_swarm.py: ########## @@ -225,6 +231,24 @@ def stream_new_logs(last_line_logged, since=0): sleep(2) last_line_logged, last_timestamp = stream_new_logs(last_line_logged, since=last_timestamp) + @staticmethod + def format_args(args: list[str] | str | None) -> list[str] | None: + """Retrieve args. + + The args string is parsed to a list. If it starts with ``[``, + the string is treated as a Python literal and parsed into a list. + + :param args: args to the docker service + + :return: the args as list + """ + if isinstance(args, str): + if args.strip().startswith("["): + return ast.literal_eval(args) + else: + return shlex.split(args) + return args Review Comment: > I just got that from the docker command formatter It was exists because : - Field `DockerOperator.command` templated - For historical reason, it add this support before NativeEnvironment and/or JSON encoder But I can't see this case here -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org