Skip to content

Commit

Permalink
remove params when we can just get it from self
Browse files Browse the repository at this point in the history
  • Loading branch information
mccalluc committed Dec 3, 2024
1 parent 7b9c22a commit 2344885
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions dp_wizard/utils/code_generators/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ def make_py(self):
return str(
Template(self.root_template).fill_blocks(
IMPORTS_BLOCK=_make_imports(),
COLUMNS_BLOCK=self._make_columns(self.columns),
COLUMNS_BLOCK=self._make_columns(),
CONTEXT_BLOCK=self._make_context(),
QUERIES_BLOCK=self._make_queries(self.columns.keys()),
QUERIES_BLOCK=self._make_queries(),
**self._make_extra_blocks(),
)
)
Expand Down Expand Up @@ -70,22 +70,23 @@ def _make_margins_dict(self, bin_names: Iterable[str]):
margins_dict = "{" + "".join(margins) + "\n }"
return margins_dict

def _make_columns(self, columns: dict[str, AnalysisPlanColumn]):
def _make_columns(self):
return "\n".join(
make_column_config_block(
name=name,
lower_bound=col.lower_bound,
upper_bound=col.upper_bound,
bin_count=col.bin_count,
)
for name, col in columns.items()
for name, col in self.columns.items()
)

def _make_queries(self, column_names: Iterable[str]):
def _make_queries(self):
confidence_note = (
"The actual value is within the shown range "
f"with {int(confidence * 100)}% confidence."
)
column_names = self.columns.keys()
return f"confidence = {confidence} # {confidence_note}\n\n" + "\n".join(
_make_query(column_name) for column_name in column_names
)
Expand Down

0 comments on commit 2344885

Please sign in to comment.