Skip to content

Commit

Permalink
debug option
Browse files Browse the repository at this point in the history
  • Loading branch information
majidaldo committed Feb 8, 2025
1 parent 99e2c34 commit dff503d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/rdf_engine/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# reset to 0 if issues
__version__ = "211"
__version__ = "212"

from .engine import Engine, logger
5 changes: 5 additions & 0 deletions src/rdf_engine/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def __init__(self,
# typically expecting the engine to be used in a stand-alone program
# so it helps to have log_print.
log: bool=True, log_print: bool=False,
debug: bool = False,
) -> None:
self.rules = list(rules)
self.db = db
Expand Down Expand Up @@ -55,6 +56,7 @@ def __init__(self,
print = log_print,
log = defaultdict(list),
delta = namedtuple('delta', ['before', 'after'] ))
self.debug = debug

# TODO: make a method for applying one rule
def run1(self) -> Store:
Expand Down Expand Up @@ -96,6 +98,9 @@ def process(qs):
from .db import ingest
for _ in rules_trigger():
_ = process(_)
if self.debug:
_ = tuple(_)
for q in _: logger.debug(f"{q}")
# so if a rule returns a string,
# it /could/ go in fast in the case of no processing (canon/deanon)
ingest(self.db, _, flush=True)
Expand Down

0 comments on commit dff503d

Please sign in to comment.