mirror of
https://github.com/enzet/map-machine.git
synced 2025-04-30 10:47:29 +02:00
Clean up collection parsing.
This commit is contained in:
parent
96244220ac
commit
36fb64a978
1 changed files with 5 additions and 20 deletions
|
@ -61,28 +61,13 @@ class Collection:
|
||||||
@classmethod
|
@classmethod
|
||||||
def deserialize(cls, structure: dict[str, Any]):
|
def deserialize(cls, structure: dict[str, Any]):
|
||||||
"""Deserialize icon collection from structure."""
|
"""Deserialize icon collection from structure."""
|
||||||
row_key: Optional[str] = (
|
|
||||||
structure["row_key"] if "row_key" in structure else None
|
|
||||||
)
|
|
||||||
row_values: list[str] = (
|
|
||||||
structure["row_values"] if "row_values" in structure else []
|
|
||||||
)
|
|
||||||
column_key: Optional[str] = (
|
|
||||||
structure["column_key"] if "column_key" in structure else None
|
|
||||||
)
|
|
||||||
column_values: list[str] = (
|
|
||||||
structure["column_values"] if "column_values" in structure else []
|
|
||||||
)
|
|
||||||
row_tags: list[Tags] = (
|
|
||||||
structure["row_tags"] if "row_tags" in structure else []
|
|
||||||
)
|
|
||||||
return cls(
|
return cls(
|
||||||
structure["tags"],
|
structure["tags"],
|
||||||
row_key,
|
structure.get("row_key", None),
|
||||||
row_values,
|
structure.get("row_values", []),
|
||||||
column_key,
|
structure.get("column_key", None),
|
||||||
column_values,
|
structure.get("column_values", []),
|
||||||
row_tags,
|
structure.get("row_tags", []),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue