Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(python): Remove private DataFrame._read classmethods #15521

Merged
merged 14 commits into from
Apr 7, 2024
2 changes: 1 addition & 1 deletion py-polars/Makefile
Original file line number Diff line number Diff line change
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)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a drive-by: building the docs does not rely on the Polars binary

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
Original file line number Diff line number Diff line change
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
Loading
Loading