Skip to content

Commit

Permalink
Merge pull request #57 from singnet/senna-hotfix-6-1
Browse files Browse the repository at this point in the history
Quick fix for bug reported in #6
  • Loading branch information
andre-senna authored Dec 4, 2023
2 parents e0826b2 + fe56d5c commit 6a9786e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions hyperon_das/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import Any, Dict, List, Optional, Set, Tuple, Union

import requests
from hyperon_das_atomdb import WILDCARD
from hyperon_das_atomdb import WILDCARD, NodeDoesNotExistException
from hyperon_das_atomdb.adapters import InMemoryDB, RedisMongoDB

from hyperon_das.cache import (
Expand Down Expand Up @@ -177,10 +177,13 @@ def _recursive_query(
]
return AndEvaluator(sub_expression_results)
elif query["atom_type"] == "node":
atom_handle = self.db.get_node_handle(query["type"], query["name"])
return ListIterator(
[QueryAnswer(self.db.get_atom_as_dict(atom_handle), None)]
)
try:
atom_handle = self.db.get_node_handle(query["type"], query["name"])
return ListIterator(
[QueryAnswer(self.db.get_atom_as_dict(atom_handle), None)]
)
except NodeDoesNotExistException:
return ListIterator([])
elif query["atom_type"] == "link":
matched_targets = []
for target in query["targets"]:
Expand Down

0 comments on commit 6a9786e

Please sign in to comment.