Skip to content

Commit

Permalink
moved db construction to where it is used (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
gecBurton authored Jan 30, 2021
1 parent b65a47c commit 162b14c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions inference_logic/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@


def search(db: List, query: ImmutableDict) -> Iterator[Dict[Variable, Any]]:
db = [Rule(item) if not isinstance(item, Rule) else item for item in db]
query = construct(query)

i = 0
Expand All @@ -38,6 +37,8 @@ def search(db: List, query: ImmutableDict) -> Iterator[Dict[Variable, Any]]:
pass
else:
for rule in db:
if not isinstance(rule, Rule):
rule = Rule(rule)
i += 1
rule = new_frame(rule, i)

Expand All @@ -54,8 +55,8 @@ def search(db: List, query: ImmutableDict) -> Iterator[Dict[Variable, Any]]:
),
)

for x in new_terms:
stack.append((Rule(*x), new_known))
for terms in new_terms:
stack.append((Rule(*terms), new_known))

solutions = new_known.solutions(to_solve_for)

Expand Down

0 comments on commit 162b14c

Please sign in to comment.