From 10acb62cfac49c0ca79a61133173b2163d5aa720 Mon Sep 17 00:00:00 2001 From: Joscha Schmiedt <joscha@schmiedt.dev> Date: Sat, 20 Apr 2024 20:44:22 +0200 Subject: [PATCH] Add type hint for Entity.role --- src/linkahead/common/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/linkahead/common/models.py b/src/linkahead/common/models.py index 6f38ff40..d8e6a367 100644 --- a/src/linkahead/common/models.py +++ b/src/linkahead/common/models.py @@ -115,6 +115,7 @@ if TYPE_CHECKING: "SUGGESTED", "RECOMMENDED", "ALL", "NONE"] IMPORTANCE = Literal["OBLIGATORY", "RECOMMENDED", "SUGGESTED", "FIX", "NONE"] + ROLE = Literal["Entity", "Record", "RecordType", "Property", "File"] SPECIAL_ATTRIBUTES = ["name", "role", "datatype", "description", "id", "path", "checksum", "size", "value"] @@ -143,7 +144,7 @@ class Entity: **kwargs, ): - self.__role = kwargs["role"] if "role" in kwargs else None + self.__role: Optional[ROLE] = kwargs["role"] if "role" in kwargs else None self._checksum: Optional[str] = None self._size = None self._upload = None -- GitLab