Skip to content

Commit

Permalink
chore(python): Bump lint dependencies (#11802)
Browse files Browse the repository at this point in the history
  • Loading branch information
stinodego authored Oct 17, 2023
1 parent 003ca4d commit 32e7a24
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint-global.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
- name: Lint Markdown and TOML
uses: dprint/[email protected]
- name: Spell Check with Typos
uses: crate-ci/[email protected].8
uses: crate-ci/[email protected].20
2 changes: 1 addition & 1 deletion py-polars/polars/series/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def _undecorated(function: Callable[P, T]) -> Callable[P, T]:
def call_expr(func: SeriesMethod) -> SeriesMethod:
"""Dispatch Series method to an expression implementation."""

@wraps(func) # type: ignore[arg-type]
@wraps(func)
def wrapper(self: Any, *args: P.args, **kwargs: P.kwargs) -> Series:
s = wrap_s(self._s)
expr = F.col(s.name)
Expand Down
4 changes: 2 additions & 2 deletions py-polars/polars/utils/_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ def __init__(self) -> None:
"polars.collect_all_async(gevent=True)"
)

from gevent.event import AsyncResult # type: ignore[import]
from gevent.hub import get_hub # type: ignore[import]
from gevent.event import AsyncResult # type: ignore[import-untyped]
from gevent.hub import get_hub # type: ignore[import-untyped]

self._value: None | Exception | PyDataFrame | list[PyDataFrame] = None
self._result = AsyncResult()
Expand Down
2 changes: 1 addition & 1 deletion py-polars/polars/utils/_construction.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ def dict_to_pydf(
lambda t: pl.Series(t[0], t[1])
if isinstance(t[1], np.ndarray)
else t[1],
[(k, v) for k, v in data.items()],
list(data.items()),
),
)
)
Expand Down
6 changes: 3 additions & 3 deletions py-polars/requirements-lint.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
black==23.9.1
blackdoc==0.3.8
mypy==1.5.1
ruff==0.0.287
typos==1.16.8
mypy==1.6.0
ruff==0.1.0
typos==1.16.20
2 changes: 1 addition & 1 deletion py-polars/tests/test_udfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
)
def test_bytecode_parser_expression(col: str, func: str, expected: str) -> None:
try:
import udfs # type: ignore[import]
import udfs # type: ignore[import-not-found]
except ModuleNotFoundError as exc:
assert "No module named 'udfs'" in str(exc) # noqa: PT017
# Skip test if udfs can't be imported because it's not in the path.
Expand Down
1 change: 0 additions & 1 deletion py-polars/tests/unit/operations/test_aggregations.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ def test_quantile_vs_numpy(tp: type, n: int) -> None:
np_result = np.quantile(a, q)
except IndexError:
np_result = None
pass
if np_result:
# nan check
if np_result != np_result:
Expand Down
4 changes: 2 additions & 2 deletions py-polars/tests/unit/series/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1438,10 +1438,10 @@ def test_bitwise() -> None:

# ensure mistaken use of logical 'and'/'or' raises an exception
with pytest.raises(TypeError, match="ambiguous"):
a and b
a and b # type: ignore[redundant-expr]

with pytest.raises(TypeError, match="ambiguous"):
a or b
a or b # type: ignore[redundant-expr]


def test_to_numpy(monkeypatch: Any) -> None:
Expand Down
16 changes: 7 additions & 9 deletions py-polars/tests/unit/sql/test_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -942,20 +942,22 @@ def test_sql_trim(foods_ipc_path: Path) -> None:
"BY NAME",
[(1, "zz"), (2, "yy"), (3, "xx")],
),
(
# note: waiting for "https://github.com/sqlparser-rs/sqlparser-rs/pull/997"
pytest.param(
["c1", "c2"],
["c2", "c1"],
"DISTINCT BY NAME",
None, # [(1, "zz"), (2, "yy"), (3, "xx")],
[(1, "zz"), (2, "yy"), (3, "xx")],
# TODO: Remove xfail marker when supported added in sqlparser-rs
# https://github.com/sqlparser-rs/sqlparser-rs/pull/997
marks=pytest.mark.xfail,
),
],
)
def test_sql_union(
cols1: list[str],
cols2: list[str],
union_subtype: str,
expected: dict[str, list[int] | list[str]] | None,
expected: list[tuple[int, str]],
) -> None:
with pl.SQLContext(
frame1=pl.DataFrame({"c1": [1, 2], "c2": ["zz", "yy"]}),
Expand All @@ -967,11 +969,7 @@ def test_sql_union(
UNION {union_subtype}
SELECT {', '.join(cols2)} FROM frame2
"""
if expected is not None:
assert sorted(ctx.execute(query).rows()) == expected
else:
with pytest.raises(pl.ComputeError, match="sql parser error"):
ctx.execute(query)
assert sorted(ctx.execute(query).rows()) == expected


def test_sql_nullif_coalesce(foods_ipc_path: Path) -> None:
Expand Down
4 changes: 2 additions & 2 deletions py-polars/tests/unit/test_exprs.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,10 +428,10 @@ def test_logical_boolean() -> None:
# note, cannot use expressions in logical
# boolean context (eg: and/or/not operators)
with pytest.raises(TypeError, match="ambiguous"):
pl.col("colx") and pl.col("coly")
pl.col("colx") and pl.col("coly") # type: ignore[redundant-expr]

with pytest.raises(TypeError, match="ambiguous"):
pl.col("colx") or pl.col("coly")
pl.col("colx") or pl.col("coly") # type: ignore[redundant-expr]

df = pl.DataFrame({"a": [1, 2, 3, 4, 5], "b": [1, 2, 3, 4, 5]})

Expand Down

0 comments on commit 32e7a24

Please sign in to comment.