From d3c23b1181369baa88fc26a447bcbcd367c3ccf8 Mon Sep 17 00:00:00 2001 From: Meagan Lang Date: Mon, 17 Jul 2023 11:38:34 -0400 Subject: [PATCH] Add to TODO list Fix lint Prune paths on windows to get under character limit --- docs/source/development/todo.rst | 2 ++ utils/setup_test_env.py | 20 +++++++++++++++++++- yggdrasil/scanf.py | 12 ++++++------ 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/docs/source/development/todo.rst b/docs/source/development/todo.rst index a1acee686..1a8fffbdb 100644 --- a/docs/source/development/todo.rst +++ b/docs/source/development/todo.rst @@ -19,6 +19,7 @@ Documentation * Refernce metaschema on website in $id or $schema? * Expand development section into contributing guide * Go through and update/prune interface documentation +* Docs on default_file/default_value Refactor -------- @@ -45,6 +46,7 @@ New feature/example * Add 'shell' option for executable models on Windows to allow calling different shell types. * Move communication to C++ * Allow models to be embedded natively +* More specific YAML parsing errors (e.g. IncompleteConnection for input/output without connection) Testing ------- diff --git a/utils/setup_test_env.py b/utils/setup_test_env.py index 3defab113..f0ccede6d 100644 --- a/utils/setup_test_env.py +++ b/utils/setup_test_env.py @@ -519,7 +519,23 @@ def add_argument(*a_args, **a_kwargs): parser.add_argument( '--install-%s' % k, action='store_true', help=("Install %s" % k)) - + + +def prune_windows_path(): + to_remove = [ + 'C:\\Program Files\\Microsoft SQL Server\\140\\DTS\\Binn', + 'C:\\Program Files\\Microsoft SQL Server\\150\\DTS\\Binn', + 'C:\\Program Files\\Microsoft SQL Server\\160\\DTS\\Binn'] + print(f"PRUNING PATH: {os.environ['PATH']}") + path_list = os.environ['PATH'].split(os.pathsep) + for x in to_remove: + if x in path_list: + path_list.remove(x) + new_path = os.pathsep.join(path_list) + print(f"PRUNED PATH: {new_path}") + cmds = [f"set \"PATH={new_path}\""] + return cmds + def get_summary_commands(param=None, conda_env=None, allow_missing_python=False, **kwargs): @@ -1132,6 +1148,8 @@ def build_conda_recipe(recipe='recipe', param=None, # https://github.com/conda/conda/issues/7758#issuecomment-660328841 assert conda_env == 'base' or param.dry_run assert conda_idx + if _is_win and _on_gha: + cmds += prune_windows_path() # Might invalidate cache cmds += [f"{CONDA_CMD} clean --all {param.conda_flags_general}"] cmds += setup_conda(param=param, conda_env=conda_env, diff --git a/yggdrasil/scanf.py b/yggdrasil/scanf.py index 485f243a7..ffdc29ca3 100644 --- a/yggdrasil/scanf.py +++ b/yggdrasil/scanf.py @@ -242,10 +242,10 @@ def parse_cformat(format, i): # few characters needed to handle the field ommision. scanf_translate = [ (re.compile(_token), _pattern, _cast) for _token, _pattern, _cast in [ - ("%c", "(.)", lambda x:x), + ("%c", "(.)", lambda x: x), ("%\\*c", "(?:.)", None), - ("%(\\d)c", "(.{%s})", lambda x:x), + ("%(\\d)c", "(.{%s})", lambda x: x), ("%\\*(\\d)c", "(?:.{%s})", None), ("%(\\d)[di]", "([+-]?\\d{%s})", int), @@ -280,16 +280,16 @@ def parse_cformat(format, i): ("%\\*[fgeE]", "(?:[-+]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][-+]?\\d+)?)", None), # langmm: Added to allows matching of %5s - ("%(\\d)s", "(.{%s})", lambda x:x.strip()), + ("%(\\d)s", "(.{%s})", lambda x: x.strip()), ("%\\*(\\d)s", "(?:.{%s})", None), - ("%s", "(\\S+)", lambda x:x), + ("%s", "(\\S+)", lambda x: x), ("%\\*s", "(?:\\S+)", None), - ("%([xX])", "(0%s[\\dA-Za-f]+)", lambda x:int(x, 16)), + ("%([xX])", "(0%s[\\dA-Za-f]+)", lambda x: int(x, 16)), ("%\\*([xX])", "(?:0%s[\\dA-Za-f]+)", None), - ("%o", "(0[0-7]*)", lambda x:int(x, 8)), + ("%o", "(0[0-7]*)", lambda x: int(x, 8)), ("%\\*o", "(?:0[0-7]*)", None), ]]