Skip to content

Commit b32b382

Browse files
committed
Fix some typing errors.
1 parent 7ee7e66 commit b32b382

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

ddss/egraph.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ def _execute_expr(self, data: Rule) -> typing.Iterator[Rule]:
100100
query = data.conclusion
101101
for target in self.pairs:
102102
if unification := target @ query:
103-
result = target.ground(unification, scope="1")
104-
yield _build_term_to_rule(result)
103+
if result := target.ground(unification, scope="1"):
104+
yield _build_term_to_rule(result)
105105

106106
def _execute_fact(self, data: Rule) -> typing.Iterator[Rule]:
107107
if len(data) != 0:
@@ -116,5 +116,7 @@ def _execute_fact(self, data: Rule) -> typing.Iterator[Rule]:
116116
query = _build_lhs_rhs_to_term(idea, fact)
117117
for target in self.pairs:
118118
if unification := target @ query:
119-
result = target.ground(unification, scope="1")
120-
yield _build_term_to_rule(result.term[2])
119+
if result := target.ground(unification, scope="1"):
120+
term = result.term
121+
if isinstance(term, Term):
122+
yield _build_term_to_rule(term[2])

ddss/utility.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
def str_rule_get_str_idea(data: str) -> str:
1+
def str_rule_get_str_idea(data: str) -> str | None:
22
if not data.startswith("--"):
33
return f"----\n{data.splitlines()[0]}\n"
44
return None

0 commit comments

Comments
 (0)