From 8effd431a69c93e1383a61f8e64b208aa31b0984 Mon Sep 17 00:00:00 2001 From: Salad Dais Date: Sat, 14 Jun 2025 07:06:18 +0000 Subject: [PATCH] Some typing fixups --- hippolyzer/lib/base/inventory.py | 4 ++-- hippolyzer/lib/base/legacy_schema.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hippolyzer/lib/base/inventory.py b/hippolyzer/lib/base/inventory.py index 37f929e..4855c63 100644 --- a/hippolyzer/lib/base/inventory.py +++ b/hippolyzer/lib/base/inventory.py @@ -163,9 +163,9 @@ class InventoryBase(SchemaBase): writer.write("\t{\n") # Make sure the ID field always comes first, if there is one. - fields_dict = {} + fields_dict: Dict[str, dataclasses.Field] = {} if hasattr(self, "ID_ATTR"): - fields_dict = {getattr(self, "ID_ATTR"): None} + fields_dict = {getattr(self, "ID_ATTR"): dataclasses.field()} # update()ing will put all fields that aren't yet in the dict after the ID attr. fields_dict.update(self._get_fields_dict()) diff --git a/hippolyzer/lib/base/legacy_schema.py b/hippolyzer/lib/base/legacy_schema.py index 60b20c8..55132ae 100644 --- a/hippolyzer/lib/base/legacy_schema.py +++ b/hippolyzer/lib/base/legacy_schema.py @@ -164,7 +164,7 @@ def parse_schema_line(line: str): @dataclasses.dataclass class SchemaBase(abc.ABC): @classmethod - def _get_fields_dict(cls, llsd_flavor: Optional[str] = None): + def _get_fields_dict(cls, llsd_flavor: Optional[str] = None) -> Dict[str, dataclasses.Field]: fields_dict = {} for field in dataclasses.fields(cls): field_name = field.name @@ -193,7 +193,7 @@ class SchemaBase(abc.ABC): try: for key, val in inv_dict.items(): if key in fields: - field: dataclasses.Field = fields[key] + field = fields[key] key = field.name spec = field.metadata.get("spec") # Not a real key, an internal var on our dataclass