Skip to content
Snippets Groups Projects
Commit 7ea328a4 authored by Joscha Schmiedt's avatar Joscha Schmiedt
Browse files

Make name and model of State.__init__ optional

parent 5772dbab
No related branches found
No related tags found
2 merge requests!143Release 0.15.0,!135Add and fix more type hints
Checking pipeline status
......@@ -137,7 +137,7 @@ class State:
All transitions which are available from this state (read-only)
"""
def __init__(self, model: str, name: str):
def __init__(self, model: Optional[str], name: Optional[str]):
self.name = name
self.model = model
self._id: Optional[str] = None
......@@ -195,13 +195,7 @@ class State:
-------
state : State
"""
name = xml.get("name")
if name is None:
raise ValueError(f"State name is missing from xml:{str(xml)}")
model = xml.get("model")
if model is None:
raise ValueError(f"State model is missing from xml:{str(xml)}")
result = State(name=name, model=model)
result = State(name=xml.get("name"), model=xml.get("model"))
result._id = xml.get("id")
result._description = xml.get("description")
transitions = [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment