Skip to content

Commit

Permalink
feat(python)!: Remove deprecated argument aliases (#5993)
Browse files Browse the repository at this point in the history
  • Loading branch information
stinodego committed Jan 26, 2023
1 parent 8f8b7e7 commit f6b7c07
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 35 deletions.
3 changes: 1 addition & 2 deletions py-polars/polars/internals/expr/expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from polars.internals.expr.meta import ExprMetaNameSpace
from polars.internals.expr.string import ExprStringNameSpace
from polars.internals.expr.struct import ExprStructNameSpace
from polars.utils import _timedelta_to_pl_duration, deprecated_alias, sphinx_accessor
from polars.utils import _timedelta_to_pl_duration, sphinx_accessor

try:
from polars.polars import PyExpr
Expand Down Expand Up @@ -1968,7 +1968,6 @@ def sort_by(

return wrap_expr(self._pyexpr.sort_by(by, reverse))

@deprecated_alias(index="indices")
def take(
self, indices: int | list[int] | Expr | pli.Series | np.ndarray[Any, Any]
) -> Expr:
Expand Down
2 changes: 0 additions & 2 deletions py-polars/polars/internals/expr/string.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
Time,
is_polars_dtype,
)
from polars.utils import deprecated_alias

if TYPE_CHECKING:
from polars.internals.type_aliases import TransferEncoding
Expand Down Expand Up @@ -1104,7 +1103,6 @@ def replace_all(
self._pyexpr.str_replace_all(pattern._pyexpr, value._pyexpr, literal)
)

@deprecated_alias(start="offset")
def slice(self, offset: int, length: int | None = None) -> pli.Expr:
"""
Create subslices of the string values of a Utf8 Series.
Expand Down
5 changes: 0 additions & 5 deletions py-polars/polars/internals/lazy_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
_datetime_to_pl_timestamp,
_time_to_pl_time,
_timedelta_to_pl_timedelta,
deprecated_alias,
)

try:
Expand Down Expand Up @@ -2176,14 +2175,12 @@ def concat_list(exprs: Sequence[str | pli.Expr | pli.Series] | pli.Expr) -> pli.
return pli.wrap_expr(_concat_lst(exprs))


@deprecated_alias(allow_streaming="streaming")
def collect_all(
lazy_frames: Sequence[pli.LazyFrame],
type_coercion: bool = True,
predicate_pushdown: bool = True,
projection_pushdown: bool = True,
simplify_expression: bool = True,
string_cache: bool = False,
no_optimization: bool = False,
slice_pushdown: bool = True,
common_subplan_elimination: bool = True,
Expand All @@ -2206,8 +2203,6 @@ def collect_all(
Do projection pushdown optimization.
simplify_expression
Run simplify expressions optimization.
string_cache
This argument is deprecated and will be ignored
no_optimization
Turn off optimizations.
slice_pushdown
Expand Down
6 changes: 0 additions & 6 deletions py-polars/polars/internals/lazyframe/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
_prepare_row_count_args,
_process_null_values,
_timedelta_to_pl_duration,
deprecated_alias,
normalise_filepath,
)

Expand Down Expand Up @@ -682,7 +681,6 @@ def describe_plan(self, *, optimized: bool = False) -> str:
return self._ldf.describe_optimized_plan()
return self._ldf.describe_plan()

@deprecated_alias(allow_streaming="streaming")
def describe_optimized_plan(
self,
type_coercion: bool = True,
Expand All @@ -706,7 +704,6 @@ def describe_optimized_plan(

return ldf.describe_optimized_plan()

@deprecated_alias(allow_streaming="streaming")
def show_graph(
self,
optimized: bool = True,
Expand Down Expand Up @@ -951,7 +948,6 @@ def sort(
by = pli.selection_to_pyexpr_list(by)
return self._from_pyldf(self._ldf.sort_by_exprs(by, reverse, nulls_last))

@deprecated_alias(allow_streaming="streaming")
def profile(
self,
type_coercion: bool = True,
Expand Down Expand Up @@ -1098,7 +1094,6 @@ def profile(

return df, timings

@deprecated_alias(allow_streaming="streaming")
def collect(
self,
*,
Expand Down Expand Up @@ -1353,7 +1348,6 @@ def sink_ipc(
maintain_order=maintain_order,
)

@deprecated_alias(allow_streaming="streaming")
def fetch(
self,
n_rows: int = 500,
Expand Down
6 changes: 0 additions & 6 deletions py-polars/polars/internals/series/string.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import polars.internals as pli
from polars.datatypes import PolarsTemporalType
from polars.internals.series.utils import expr_dispatch
from polars.utils import deprecated_alias

if TYPE_CHECKING:
from polars.internals.type_aliases import TransferEncoding
Expand Down Expand Up @@ -836,7 +835,6 @@ def to_lowercase(self) -> pli.Series:
def to_uppercase(self) -> pli.Series:
"""Modify the strings to their uppercase equivalent."""

@deprecated_alias(start="offset")
def slice(self, offset: int, length: int | None = None) -> pli.Series:
"""
Create subslices of the string values of a Utf8 Series.
Expand Down Expand Up @@ -880,10 +878,6 @@ def slice(self, offset: int, length: int | None = None) -> pli.Series:
]
"""
s = pli.wrap_s(self._s)
return (
s.to_frame().select(pli.col(s.name).str.slice(offset, length)).to_series()
)

def explode(self) -> pli.Series:
"""
Expand Down
15 changes: 1 addition & 14 deletions py-polars/polars/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from polars.dependencies import pyarrow as pa
from polars.internals import DataFrame, LazyFrame, _scan_ds
from polars.internals.io import _prepare_file_arg
from polars.utils import deprecated_alias, handle_projection_columns, normalise_filepath
from polars.utils import handle_projection_columns, normalise_filepath

if TYPE_CHECKING:
from polars.internals.type_aliases import CsvEncoding, ParallelStrategy
Expand All @@ -54,12 +54,6 @@ def _check_arg_is_1byte(
)


@deprecated_alias(
has_headers="has_header",
dtype="dtypes",
stop_after_n_rows="n_rows",
projection="columns",
)
def read_csv(
file: str | TextIO | BytesIO | Path | BinaryIO | bytes,
has_header: bool = True,
Expand Down Expand Up @@ -413,7 +407,6 @@ def read_csv(
return df


@deprecated_alias(has_headers="has_header", dtype="dtypes", stop_after_n_rows="n_rows")
def scan_csv(
file: str | Path,
has_header: bool = True,
Expand Down Expand Up @@ -592,7 +585,6 @@ def scan_csv(
)


@deprecated_alias(stop_after_n_rows="n_rows")
def scan_ipc(
file: str | Path,
n_rows: int | None = None,
Expand Down Expand Up @@ -646,7 +638,6 @@ def scan_ipc(
)


@deprecated_alias(stop_after_n_rows="n_rows")
def scan_parquet(
file: str | Path,
n_rows: int | None = None,
Expand Down Expand Up @@ -759,7 +750,6 @@ def scan_ndjson(
)


@deprecated_alias(projection="columns")
def read_avro(
file: str | Path | BytesIO | BinaryIO,
columns: list[int] | list[str] | None = None,
Expand Down Expand Up @@ -789,7 +779,6 @@ def read_avro(
return DataFrame._read_avro(file, n_rows=n_rows, columns=columns)


@deprecated_alias(stop_after_n_rows="n_rows", projection="columns")
def read_ipc(
file: str | BinaryIO | BytesIO | Path | bytes,
columns: list[int] | list[str] | None = None,
Expand Down Expand Up @@ -875,7 +864,6 @@ def read_ipc(
)


@deprecated_alias(stop_after_n_rows="n_rows", projection="columns")
def read_parquet(
source: str | Path | BinaryIO | BytesIO | bytes,
columns: list[int] | list[str] | None = None,
Expand Down Expand Up @@ -981,7 +969,6 @@ def read_parquet(
)


@deprecated_alias(source="file")
def read_json(file: str | Path | IOBase, json_lines: bool | None = None) -> DataFrame:
"""
Read into a DataFrame from a JSON file.
Expand Down

0 comments on commit f6b7c07

Please sign in to comment.