Skip to content

Commit e5b08e5

Browse files
authored
Default values for backwards compatibility (#56)
* Default values check for backwards compatibility
1 parent 956825f commit e5b08e5

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "vfxnaming"
7-
version = "1.5.5-beta"
7+
version = "1.5.6-beta"
88
authors = [
99
{ name="Chris Granados", email="info@chrisgranados.com" },
1010
]

src/vfxnaming/rules.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,17 @@ def from_data(cls, data) -> "Rule":
8686
if data.get("_Serializable_version") is not None:
8787
del data["_Serializable_version"]
8888

89+
if not data.get("_name"):
90+
raise RuleError(f"Rule name is required but was not found in {data}")
91+
92+
if not data.get("_pattern"):
93+
raise RuleError(f"Rule pattern is required but was not found in {data}")
94+
8995
this = cls(
9096
data.get("_name"),
9197
data.get("_pattern"),
92-
data.get("_anchor"),
93-
data.get("_nice_name"),
98+
data.get("_anchor", cls.ANCHOR_START),
99+
data.get("_nice_name", ""),
94100
)
95101
return this
96102

0 commit comments

Comments
 (0)