Skip to content

Commit

Permalink
Merge pull request #38 from pyiron/change_to_plural
Browse files Browse the repository at this point in the history
Make triple and restriction plural
  • Loading branch information
samwaseda authored Jan 19, 2025
2 parents d21c168 + 257e19a commit 8181a5a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
10 changes: 5 additions & 5 deletions semantikon/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def parse_metadata(value):
Returns:
dictionary of the metadata. Available keys are `units`, `label`,
`triple`, `uri` and `shape`. See `semantikon.typing.u` for more details.
`triples`, `uri` and `shape`. See `semantikon.typing.u` for more details.
"""
# When there is only one metadata `use_list=False` must have been used
if len(value.__metadata__) == 1 and isinstance(value.__metadata__[0], str):
Expand All @@ -63,10 +63,10 @@ def _meta_to_dict(value):
return {
"units": None,
"label": None,
"triple": None,
"triples": None,
"uri": None,
"shape": None,
"restriction": None,
"restrictions": None,
"dtype": value,
}
else:
Expand All @@ -82,7 +82,7 @@ def parse_input_args(func: callable):
Returns:
dictionary of the input arguments. Available keys are `units`, `label`,
`triple`, `uri` and `shape`. See `semantikon.typing.u` for more details.
`triples`, `uri` and `shape`. See `semantikon.typing.u` for more details.
"""
return {
key: _meta_to_dict(value.annotation)
Expand All @@ -100,7 +100,7 @@ def parse_output_args(func: callable):
Returns:
dictionary of the output arguments if there is only one output. Otherwise,
a list of dictionaries is returned. Available keys are `units`,
`label`, `triple`, `uri` and `shape`. See `semantikon.typing.u` for
`label`, `triples`, `uri` and `shape`. See `semantikon.typing.u` for
more details.
"""
sig = inspect.signature(func)
Expand Down
8 changes: 4 additions & 4 deletions semantikon/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ def u(
/,
units: str | None = None,
label: str | None = None,
triple: tuple[tuple[str, str, str], ...] | tuple[str, str, str] | None = None,
triples: tuple[tuple[str, str, str], ...] | tuple[str, str, str] | None = None,
uri: str | None = None,
shape: tuple[int] | None = None,
restriction: tuple[tuple[str, str]] | None = None,
restrictions: tuple[tuple[str, str]] | None = None,
use_list: bool = True,
**kwargs,
):
Expand All @@ -32,10 +32,10 @@ def u(
result = {
"units": units,
"label": label,
"triple": triple,
"triples": triples,
"uri": uri,
"shape": shape,
"restriction": restriction,
"restrictions": restrictions,
}
for key, value in parent_result.items():
if result[key] is None:
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_dataclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ def test_parse_metadata(self):
"units": "eV",
"label": "TotalEnergy",
"associate_to_sample": True,
"triple": None,
"triples": None,
"shape": None,
"uri": None,
"restriction": None,
"restrictions": None,
},
)

Expand Down
12 changes: 6 additions & 6 deletions tests/unit/test_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ def get_speed(
for key in [
"units",
"uri",
"triple",
"triples",
"shape",
"label",
"restriction",
"restrictions",
"dtype"
]:
self.assertTrue(key in input_args["distance"])
Expand All @@ -32,10 +32,10 @@ def get_speed(
for key in [
"units",
"uri",
"triple",
"triples",
"shape",
"label",
"restriction",
"restrictions",
"dtype"
]:
self.assertTrue(key in output_args)
Expand All @@ -60,10 +60,10 @@ def get_speed(
for key in [
"units",
"uri",
"triple",
"triples",
"shape",
"label",
"restriction",
"restrictions",
"dtype"
]:
self.assertTrue(key in output_arg)
Expand Down

0 comments on commit 8181a5a

Please sign in to comment.