Skip to content

Commit b85bd0c

Browse files
committed
Add check for outdated connector attributes
1 parent 81ed3fa commit b85bd0c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/wireviz/Harness.py

+12
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,17 @@
5353
)
5454
from wireviz.wv_html import generate_html_output
5555

56+
OLD_CONNECTOR_ATTR = {
57+
"pinout": "was renamed to 'pinlabels' in v0.2",
58+
"pinnumbers": "was renamed to 'pins' in v0.2",
59+
"autogenerate": "is replaced with new syntax in v0.4",
60+
}
61+
62+
def check_old(node: str, old_attr: dict, args: dict) -> None:
63+
"""Raise exception for any outdated attributes in args."""
64+
for attr, descr in old_attr.items():
65+
if attr in args:
66+
raise ValueError(f"'{attr}' in {node}: '{attr}' {descr}")
5667

5768
@dataclass
5869
class Harness:
@@ -68,6 +79,7 @@ def __post_init__(self):
6879
self.additional_bom_items = []
6980

7081
def add_connector(self, name: str, *args, **kwargs) -> None:
82+
check_old(f"Connector '{name}'", OLD_CONNECTOR_ATTR, kwargs)
7183
self.connectors[name] = Connector(name, *args, **kwargs)
7284

7385
def add_cable(self, name: str, *args, **kwargs) -> None:

0 commit comments

Comments
 (0)