Skip to content

Commit c09c7de

Browse files
committed
fix: make methods private
1 parent 810bd95 commit c09c7de

2 files changed

Lines changed: 12 additions & 11 deletions

File tree

python/egglog/egraph.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -973,15 +973,15 @@ def _run_schedule(self, schedule: Schedule) -> RunReport:
973973
cmd = self._state.run_schedule_to_egg(schedule.schedule)
974974
(command_output,) = self._run_program(cmd)
975975
assert isinstance(command_output, bindings.RunScheduleOutput)
976-
return RunReport.from_bindings(command_output.report, self._state)
976+
return RunReport._from_bindings(command_output.report, self._state)
977977

978978
def stats(self) -> RunReport:
979979
"""
980980
Returns the overall run report for the egraph.
981981
"""
982982
(output,) = self._run_program(bindings.PrintOverallStatistics(span(1), None))
983983
assert isinstance(output, bindings.OverallStatistics)
984-
return RunReport.from_bindings(output.report, self._state)
984+
return RunReport._from_bindings(output.report, self._state)
985985

986986
def check_bool(self, *facts: FactLike) -> bool:
987987
"""

python/egglog/run_report.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
from collections.abc import Callable
34
from dataclasses import dataclass, field
45
from datetime import timedelta
56

@@ -20,7 +21,7 @@ class RuleReport:
2021
num_matches: int
2122

2223
@classmethod
23-
def from_bindings(cls, report: bindings.RuleReport) -> RuleReport:
24+
def _from_bindings(cls, report: bindings.RuleReport) -> RuleReport:
2425
return cls(
2526
plan=report.plan,
2627
search_and_apply_time=report.search_and_apply_time,
@@ -37,13 +38,13 @@ class RuleSetReport:
3738
_decls: Declarations = field(repr=False, default=None)
3839

3940
@classmethod
40-
def from_bindings(
41-
cls, report: bindings.RuleSetReport, translate_key: callable, decls: Declarations
41+
def _from_bindings(
42+
cls, report: bindings.RuleSetReport, translate_key: Callable[[str], CommandDecl], decls: Declarations
4243
) -> RuleSetReport:
4344
return cls(
4445
changed=report.changed,
4546
rule_reports={
46-
translate_key(k): [RuleReport.from_bindings(rr) for rr in v] for k, v in report.rule_reports.items()
47+
translate_key(k): [RuleReport._from_bindings(rr) for rr in v] for k, v in report.rule_reports.items()
4748
},
4849
search_and_apply_time=report.search_and_apply_time,
4950
merge_time=report.merge_time,
@@ -66,11 +67,11 @@ class IterationReport:
6667
rebuild_time: timedelta
6768

6869
@classmethod
69-
def from_bindings(
70-
cls, report: bindings.IterationReport, translate_key: callable, decls: Declarations
70+
def _from_bindings(
71+
cls, report: bindings.IterationReport, translate_key: Callable[[str], CommandDecl], decls: Declarations
7172
) -> IterationReport:
7273
return cls(
73-
rule_set_report=RuleSetReport.from_bindings(report.rule_set_report, translate_key, decls),
74+
rule_set_report=RuleSetReport._from_bindings(report.rule_set_report, translate_key, decls),
7475
rebuild_time=report.rebuild_time,
7576
)
7677

@@ -102,10 +103,10 @@ def __repr__(self) -> str:
102103
)
103104

104105
@classmethod
105-
def from_bindings(cls, report: bindings.RunReport, state: EGraphState) -> RunReport:
106+
def _from_bindings(cls, report: bindings.RunReport, state: EGraphState) -> RunReport:
106107
return cls(
107108
iterations=[
108-
IterationReport.from_bindings(it, state.translate_rule_key, state.__egg_decls__)
109+
IterationReport._from_bindings(it, state.translate_rule_key, state.__egg_decls__)
109110
for it in report.iterations
110111
],
111112
updated=report.updated,

0 commit comments

Comments
 (0)