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
Pipeline #49959 passed with warnings
...@@ -137,7 +137,7 @@ class State: ...@@ -137,7 +137,7 @@ class State:
All transitions which are available from this state (read-only) 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.name = name
self.model = model self.model = model
self._id: Optional[str] = None self._id: Optional[str] = None
...@@ -195,13 +195,7 @@ class State: ...@@ -195,13 +195,7 @@ class State:
------- -------
state : State state : State
""" """
name = xml.get("name") result = State(name=xml.get("name"), model=xml.get("model"))
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._id = xml.get("id") result._id = xml.get("id")
result._description = xml.get("description") result._description = xml.get("description")
transitions = [ transitions = [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment