Skip to content

Commit

Permalink
refactor: accept code_reginement
Browse files Browse the repository at this point in the history
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
  • Loading branch information
lisphilar and sourcery-ai[bot] authored Apr 26, 2024
1 parent fb67e37 commit 3b4a9b5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions py-polars/polars/dataframe/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -1291,9 +1291,11 @@ def _repr_html_(self, *, _from_series: bool = False) -> str:
max_rows = self.height

overall_alignment = os.environ.get("POLARS_FMT_TABLE_CELL_ALIGNMENT", "RIGHT")
if overall_alignment not in {"LEFT", "CENTER", "RIGHT"}:
msg = f"invalid table cell alignment: {overall_alignment!r}"
raise ValueError(msg)
def validate_alignment(alignment, valid_options={"LEFT", "CENTER", "RIGHT"}):
if alignment not in valid_options:
raise ValueError(f"invalid table cell alignment: {alignment!r}")

validate_alignment(overall_alignment)

numeric_alignment = os.environ.get(
"POLARS_FMT_TABLE_CELL_NUMERIC_ALIGNMENT",
Expand Down

0 comments on commit 3b4a9b5

Please sign in to comment.