Skip to content

Commit

Permalink
refactor(python): Remove private DataFrame._read classmethods (#15521)
Browse files Browse the repository at this point in the history
  • Loading branch information
stinodego committed Apr 7, 2024
1 parent 293833d commit 49e4244
Show file tree
Hide file tree
Showing 12 changed files with 584 additions and 788 deletions.
2 changes: 1 addition & 1 deletion py-polars/Makefile
Expand Up @@ -85,7 +85,7 @@ doctest: .venv build ## Run doctests
$(VENV_BIN)/pytest tests/docs/test_user_guide.py -m docs

.PHONY: docs
docs: .venv build ## Build Python docs (incremental)
docs: .venv ## Build Python docs (incremental)
@$(MAKE) -s -C docs html

.PHONY: docs-clean
Expand Down
25 changes: 0 additions & 25 deletions py-polars/polars/_utils/various.py
Expand Up @@ -158,31 +158,6 @@ def range_to_slice(rng: range) -> slice:
return slice(rng.start, rng.stop, rng.step)


def handle_projection_columns(
columns: Sequence[str] | Sequence[int] | str | None,
) -> tuple[list[int] | None, Sequence[str] | None]:
"""Disambiguates between columns specified as integers vs. strings."""
projection: list[int] | None = None
new_columns: Sequence[str] | None = None
if columns is not None:
if isinstance(columns, str):
new_columns = [columns]
elif is_int_sequence(columns):
projection = list(columns)
elif not is_str_sequence(columns):
msg = "`columns` arg should contain a list of all integers or all strings values"
raise TypeError(msg)
else:
new_columns = columns
if columns and len(set(columns)) != len(columns):
msg = f"`columns` arg should only have unique values, got {columns!r}"
raise ValueError(msg)
if projection and len(set(projection)) != len(projection):
msg = f"`columns` arg should only have unique values, got {projection!r}"
raise ValueError(msg)
return projection, new_columns


def _prepare_row_index_args(
row_index_name: str | None = None,
row_index_offset: int = 0,
Expand Down

0 comments on commit 49e4244

Please sign in to comment.