Skip to content

Commit

Permalink
feat(python)!: Remove deprecated argument aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
stinodego committed Jan 2, 2023
1 parent 935e04b commit c57e6aa
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 @@ -23,7 +23,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, accessor, deprecated_alias
from polars.utils import _timedelta_to_pl_duration, accessor

try:
from polars.polars import PyExpr
Expand Down Expand Up @@ -1880,7 +1880,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 @@ -1090,7 +1089,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 @@ -26,7 +26,6 @@
_datetime_to_pl_timestamp,
_time_to_pl_time,
_timedelta_to_pl_timedelta,
deprecated_alias,
)

try:
Expand Down Expand Up @@ -2128,14 +2127,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 @@ -2158,8 +2155,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 @@ -43,7 +43,6 @@
_prepare_row_count_args,
_process_null_values,
_timedelta_to_pl_duration,
deprecated_alias,
format_path,
)

Expand Down Expand Up @@ -656,7 +655,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 @@ -680,7 +678,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 @@ -922,7 +919,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 @@ -1069,7 +1065,6 @@ def profile(

return df, timings

@deprecated_alias(allow_streaming="streaming")
def collect(
self,
*,
Expand Down Expand Up @@ -1253,7 +1248,6 @@ def sink_parquet(
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 @@ -825,7 +824,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 @@ -869,7 +867,3 @@ 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()
)
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, format_path, handle_projection_columns
from polars.utils import format_path, handle_projection_columns

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 @@ -408,7 +402,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 @@ -582,7 +575,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 @@ -636,7 +628,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 @@ -749,7 +740,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 @@ -779,7 +769,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 @@ -865,7 +854,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 @@ -971,7 +959,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 c57e6aa

Please sign in to comment.