Skip to content

Commit

Permalink
avoid eval exception
Browse files Browse the repository at this point in the history
  • Loading branch information
levongh committed Mar 23, 2022
1 parent 8a51d43 commit 1a68fdf
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions hub/core/query/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,14 @@ def execute(self) -> List[int]:
for tensor in self._tensors
}
p.update(self._groups)
if eval(self._cquery, p):
idx_map.append(local_idx)
self._pg_callback(local_idx, True)
else:
self._pg_callback(local_idx, False)
try:
if eval(self._cquery, p):
idx_map.append(local_idx)
self._pg_callback(local_idx, True)
else:
self._pg_callback(local_idx, False)
except (NameError, KeyError):
pass
return idx_map

def _wrap_value(self, tensor, val):
Expand Down

0 comments on commit 1a68fdf

Please sign in to comment.