Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rocoto XML regex fix #643

Merged
merged 2 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/uwtools/drivers/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
from uwtools.utils.file import writable
from uwtools.utils.processing import run_shell_cmd

OutputT = dict[str, Union[str, list[str]]]
maddenp-noaa marked this conversation as resolved.
Show resolved Hide resolved

# NB: Class docstrings are programmatically defined.


Expand Down Expand Up @@ -433,7 +431,7 @@ def _run_via_local_execution(self):
# Public methods

@property
def output(self) -> OutputT:
def output(self) -> Union[dict[str, str], dict[str, list[str]]]:
"""
Returns a description of the file(s) created when this component runs.
"""
Expand Down
4 changes: 2 additions & 2 deletions src/uwtools/drivers/upp.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from iotaa import asset, task, tasks

from uwtools.config.formats.nml import NMLConfig
from uwtools.drivers.driver import DriverCycleLeadtimeBased, OutputT
from uwtools.drivers.driver import DriverCycleLeadtimeBased
from uwtools.drivers.support import set_driver_docstring
from uwtools.exceptions import UWConfigError
from uwtools.strings import STR
Expand Down Expand Up @@ -100,7 +100,7 @@ def driver_name(cls) -> str:
return STR.upp

@property
def output(self) -> OutputT:
def output(self) -> dict[str, list[str]]:
"""
Returns a description of the file(s) created when this component runs.
"""
Expand Down
2 changes: 1 addition & 1 deletion src/uwtools/rocoto.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def __str__(self) -> str:
xml = etree.tostring(
self._root, pretty_print=True, encoding="utf-8", xml_declaration=True
).decode()
xml = re.sub(r"&([^;]+);", r"&\1;", xml)
xml = re.sub(r"&([^&]+;)", r"&\1", xml)
xml = self._insert_doctype(xml)
return xml

Expand Down
6 changes: 3 additions & 3 deletions src/uwtools/tests/fixtures/hello_workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ workflow:
task_hello:
attrs:
cycledefs: howdy
maxtries: "2"
maxtries: 2
account: "&ACCOUNT;"
command: "echo hello $person"
command: "echo account for $person is &ACCOUNT; && true"
maddenp-noaa marked this conversation as resolved.
Show resolved Hide resolved
jobname:
cyclestr:
attrs:
Expand All @@ -34,7 +34,7 @@ workflow:
task_hello_#member#:
attrs:
cycledefs: howdy
maxtries: "1"
maxtries: 1
account: "&ACCOUNT;"
command: "echo hello #member#"
nodes: 1:ppn=1
Expand Down
Loading