From 74e8d708918c47bda9a955a477154e2821b1de7b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Feb 2023 08:36:09 +0100 Subject: [PATCH] chore(python): bump black from 22.12.0 to 23.1.0 in /py-polars (#6611) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Stijn de Gooijer --- py-polars/polars/internals/batched.py | 1 - py-polars/polars/internals/dataframe/frame.py | 5 ++--- py-polars/polars/internals/io.py | 1 + py-polars/polars/internals/series/series.py | 1 - py-polars/polars/testing/asserts.py | 3 +-- py-polars/pyproject.toml | 1 + py-polars/requirements-lint.txt | 2 +- py-polars/tests/unit/test_cfg.py | 1 - py-polars/tests/unit/test_groupby.py | 2 +- py-polars/tests/unit/test_interop.py | 2 +- py-polars/tests/unit/test_lazy.py | 1 + py-polars/tests/unit/test_rolling.py | 3 +-- py-polars/tests/unit/test_sort.py | 1 - py-polars/tests/unit/test_struct.py | 2 +- 14 files changed, 11 insertions(+), 15 deletions(-) diff --git a/py-polars/polars/internals/batched.py b/py-polars/polars/internals/batched.py index 002671a46a6a1..369c1948be46f 100644 --- a/py-polars/polars/internals/batched.py +++ b/py-polars/polars/internals/batched.py @@ -55,7 +55,6 @@ def __init__( eol_char: str = "\n", new_columns: list[str] | None = None, ): - path: str | None if isinstance(file, (str, Path)): path = normalise_filepath(file) diff --git a/py-polars/polars/internals/dataframe/frame.py b/py-polars/polars/internals/dataframe/frame.py index ef981ad15f2cd..1dd40d0a82b60 100644 --- a/py-polars/polars/internals/dataframe/frame.py +++ b/py-polars/polars/internals/dataframe/frame.py @@ -1479,7 +1479,6 @@ def __getitem__( # df[:, unknown] if isinstance(row_selection, slice): - # multiple slices # df[:, :] if isinstance(col_selection, slice): @@ -1512,7 +1511,7 @@ def __getitem__( f" boolean mask. Got {len(col_selection)}." ) series_list = [] - for (i, val) in enumerate(col_selection): + for i, val in enumerate(col_selection): if val: series_list.append(self.to_series(i)) @@ -1631,7 +1630,7 @@ def __setitem__( # todo! we can parallelize this by calling from_numpy columns = [] - for (i, name) in enumerate(key): + for i, name in enumerate(key): columns.append(pli.Series(name, value[:, i])) self._df = self.with_columns(columns)._df diff --git a/py-polars/polars/internals/io.py b/py-polars/polars/internals/io.py index 95e641e2921b2..a0d908b4192fd 100644 --- a/py-polars/polars/internals/io.py +++ b/py-polars/polars/internals/io.py @@ -75,6 +75,7 @@ def _prepare_file_arg( fsspec too. """ + # Small helper to use a variable as context @contextmanager def managed_file(file: Any) -> Iterator[Any]: diff --git a/py-polars/polars/internals/series/series.py b/py-polars/polars/internals/series/series.py index d6764303191c9..00be821d2074c 100644 --- a/py-polars/polars/internals/series/series.py +++ b/py-polars/polars/internals/series/series.py @@ -767,7 +767,6 @@ def __getitem__( int | Series | range | slice | np.ndarray[Any, Any] | list[int] | list[bool] ), ) -> Any: - if isinstance(item, Series) and item.dtype in { UInt8, UInt16, diff --git a/py-polars/polars/testing/asserts.py b/py-polars/polars/testing/asserts.py index 411039e8020f5..5891b64080ff6 100644 --- a/py-polars/polars/testing/asserts.py +++ b/py-polars/polars/testing/asserts.py @@ -389,8 +389,7 @@ def is_categorical_dtype(data_type: Any) -> bool: def assert_frame_equal_local_categoricals( df_a: pli.DataFrame, df_b: pli.DataFrame ) -> None: - - for ((a_name, a_value), (b_name, b_value)) in zip( + for (a_name, a_value), (b_name, b_value) in zip( df_a.schema.items(), df_b.schema.items() ): if a_name != b_name: diff --git a/py-polars/pyproject.toml b/py-polars/pyproject.toml index bfb6a63c98738..7596dd8b8b658 100644 --- a/py-polars/pyproject.toml +++ b/py-polars/pyproject.toml @@ -143,6 +143,7 @@ ignore = [ # pydocstyle: http://www.pydocstyle.org/en/stable/error_codes.html # numpy convention with a few additional lints "D107", + "D202", # No blank lines allowed after function docstring -> clashes with Black "D203", "D212", "D401", diff --git a/py-polars/requirements-lint.txt b/py-polars/requirements-lint.txt index dd0eaa534bba2..90cbef14f1f50 100644 --- a/py-polars/requirements-lint.txt +++ b/py-polars/requirements-lint.txt @@ -1,3 +1,3 @@ -black==22.12.0 +black==23.1.0 blackdoc==0.3.7 ruff==0.0.237 diff --git a/py-polars/tests/unit/test_cfg.py b/py-polars/tests/unit/test_cfg.py index df790e997d36a..2f23d03ca77bf 100644 --- a/py-polars/tests/unit/test_cfg.py +++ b/py-polars/tests/unit/test_cfg.py @@ -100,7 +100,6 @@ def test_set_tbl_cols() -> None: def test_set_tbl_rows() -> None: - df = pl.DataFrame({"a": [1, 2, 3, 4], "b": [5, 6, 7, 8], "c": [9, 10, 11, 12]}) ser = pl.Series("ser", [1, 2, 3, 4, 5]) diff --git a/py-polars/tests/unit/test_groupby.py b/py-polars/tests/unit/test_groupby.py index 008598a47a080..a32f36229918b 100644 --- a/py-polars/tests/unit/test_groupby.py +++ b/py-polars/tests/unit/test_groupby.py @@ -253,7 +253,7 @@ def test_groupby_rolling_negative_offset_3914() -> None: } ) - assert df.groupby_rolling(index_column="ints", period="2i", offset="-5i",).agg( + assert df.groupby_rolling(index_column="ints", period="2i", offset="-5i").agg( [pl.col("ints").alias("matches")] )["matches"].to_list() == [ [], diff --git a/py-polars/tests/unit/test_interop.py b/py-polars/tests/unit/test_interop.py index e7ea28f878ac3..736dab33d2a33 100644 --- a/py-polars/tests/unit/test_interop.py +++ b/py-polars/tests/unit/test_interop.py @@ -582,7 +582,7 @@ def test_arrow_list_null_5697() -> None: df = pl.from_arrow(pa_table) pa_table = df.to_arrow() # again to polars to test the schema - assert pl.from_arrow(pa_table,).schema == { # type: ignore[union-attr] + assert pl.from_arrow(pa_table).schema == { # type: ignore[union-attr] "mycol": pl.List(pl.Null) } diff --git a/py-polars/tests/unit/test_lazy.py b/py-polars/tests/unit/test_lazy.py index 04522f37bf84c..53ef62e183139 100644 --- a/py-polars/tests/unit/test_lazy.py +++ b/py-polars/tests/unit/test_lazy.py @@ -1367,6 +1367,7 @@ def test_self_join() -> None: def test_preservation_of_subclasses() -> None: """Test for LazyFrame inheritance.""" + # We should be able to inherit from polars.LazyFrame class SubClassedLazyFrame(pl.LazyFrame): pass diff --git a/py-polars/tests/unit/test_rolling.py b/py-polars/tests/unit/test_rolling.py index 6e6b782d90e2e..05c02e440958c 100644 --- a/py-polars/tests/unit/test_rolling.py +++ b/py-polars/tests/unit/test_rolling.py @@ -194,7 +194,6 @@ def test_rolling_groupby_extrema() -> None: ) for df in [sorted_df, not_sorted_df]: - assert ( df.groupby_rolling( index_column="row_nr", @@ -317,7 +316,7 @@ def test_overlapping_groups_4628() -> None: } ) assert ( - df.groupby_rolling(index_column="index", period="3i",).agg( + df.groupby_rolling(index_column="index", period="3i").agg( [ pl.col("val").diff(n=1).alias("val.diff"), (pl.col("val") - pl.col("val").shift(1)).alias("val - val.shift"), diff --git a/py-polars/tests/unit/test_sort.py b/py-polars/tests/unit/test_sort.py index 596aa6ee0a36f..d2268ef3322a5 100644 --- a/py-polars/tests/unit/test_sort.py +++ b/py-polars/tests/unit/test_sort.py @@ -356,7 +356,6 @@ def test_sort_by_in_over_5499() -> None: def test_merge_sorted() -> None: - df_a = ( pl.date_range(datetime(2022, 1, 1), datetime(2022, 12, 1), "1mo") .to_frame("range") diff --git a/py-polars/tests/unit/test_struct.py b/py-polars/tests/unit/test_struct.py index e73a882c1beb4..fd5586e99a651 100644 --- a/py-polars/tests/unit/test_struct.py +++ b/py-polars/tests/unit/test_struct.py @@ -458,7 +458,7 @@ def test_struct_comparison() -> None: def test_struct_order() -> None: - assert pl.DataFrame({"col1": [{"a": 1, "b": 2}, {"b": 4, "a": 3}],}).to_dict( + assert pl.DataFrame({"col1": [{"a": 1, "b": 2}, {"b": 4, "a": 3}]}).to_dict( False ) == {"col1": [{"a": 1, "b": 2}, {"a": 3, "b": 4}]}