From 8e29d9d2e534239ad0eec4cacfd95bc1449c81a9 Mon Sep 17 00:00:00 2001 From: Jesse Michel Date: Sat, 5 Jun 2021 11:31:57 -0400 Subject: [PATCH] Switched to using shlex for reproducability information --- tap/tap.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tap/tap.py b/tap/tap.py index 8ab826a..e02dd66 100644 --- a/tap/tap.py +++ b/tap/tap.py @@ -4,13 +4,13 @@ from functools import partial import json from pprint import pformat -import re +from shlex import quote import sys import time -from warnings import warn from types import MethodType from typing import Any, Callable, Dict, List, Optional, Sequence, Set, Tuple, TypeVar, Union, get_type_hints from typing_inspect import is_literal_type, get_args +from warnings import warn from tap.utils import ( get_class_variables, @@ -352,9 +352,8 @@ def get_reproducibility_info() -> Dict[str, str]: :return: A dictionary of reproducibility information. """ - args = [f"'{arg}'" if re.search(r'\s', arg) else arg for arg in sys.argv] reproducibility = { - 'command_line': f'python {" ".join(args)}', + 'command_line': f'python {" ".join(quote(arg) for arg in sys.argv)}', 'time': time.strftime('%c') }