Skip to content

Commit

Permalink
Add to TODO list
Browse files Browse the repository at this point in the history
Fix lint
Prune paths on windows to get under character limit
  • Loading branch information
langmm committed Aug 1, 2023
1 parent 5abe5b2 commit d3c23b1
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
2 changes: 2 additions & 0 deletions docs/source/development/todo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
--------
Expand All @@ -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
-------
Expand Down
20 changes: 19 additions & 1 deletion utils/setup_test_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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,
Expand Down
12 changes: 6 additions & 6 deletions yggdrasil/scanf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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),
]]

Expand Down

0 comments on commit d3c23b1

Please sign in to comment.