From dda32489253f17d645d5c4762c7a337b96cc39bd Mon Sep 17 00:00:00 2001 From: Friedrich Lindenberg Date: Mon, 18 Nov 2024 15:46:31 +0100 Subject: [PATCH] Fix none handling --- nomenklatura/store/level.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/nomenklatura/store/level.py b/nomenklatura/store/level.py index 179bb362..a9deeaa0 100644 --- a/nomenklatura/store/level.py +++ b/nomenklatura/store/level.py @@ -158,7 +158,7 @@ def __init__( ) -> None: super().__init__(store, scope, external=external) self.store: LevelDBStore[DS, CE] = store - self.last_seens: Dict[str, str] = {} + self.last_seens: Dict[str, Optional[str]] = {} def has_entity(self, id: str) -> bool: prefix = b(f"s:{id}:") @@ -188,11 +188,13 @@ def get_entity(self, id: str) -> Optional[CE]: for v in it: statements.append(unpack_statement(v, id, True)) for stmt in statements: - if stmt.dataset not in self.last_seens: + if ( + stmt.dataset not in self.last_seens + or self.last_seens[stmt.dataset] is None + ): ls_val = self.store.db.get(b(f"ls:{stmt.dataset}")) ls = ls_val.decode("utf-8") if ls_val is not None else None - if ls is not None: - self.last_seens[stmt.dataset] = ls + self.last_seens[stmt.dataset] = ls stmt.last_seen = self.last_seens[stmt.dataset] return self.store.assemble(statements)