Skip to content

Commit

Permalink
Fix none handling
Browse files Browse the repository at this point in the history
  • Loading branch information
pudo committed Nov 18, 2024
1 parent 6c79d06 commit dda3248
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions nomenklatura/store/level.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}:")
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit dda3248

Please sign in to comment.