Skip to content

Commit

Permalink
Rocoto XML regex fix (ufs-community#643)
Browse files Browse the repository at this point in the history
  • Loading branch information
maddenp-noaa authored Nov 4, 2024
1 parent bf01a96 commit 8b835f7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
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]]]

# 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"
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

0 comments on commit 8b835f7

Please sign in to comment.