Skip to content

Commit

Permalink
refactor: fix A001 check
Browse files Browse the repository at this point in the history
  • Loading branch information
ELC committed Jul 9, 2024
1 parent 964d80d commit 935009a
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 6 deletions.
2 changes: 2 additions & 0 deletions narwhals/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# flake8: noqa: A001

from narwhals import selectors
from narwhals import stable
from narwhals.dataframe import DataFrame
Expand Down
4 changes: 2 additions & 2 deletions narwhals/_arrow/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ def to_string(self, format: str) -> ArrowSeries: # noqa: A002
# PyArrow differs from other libraries in that %S also prints out
# the fractional part of the second...:'(
# https://arrow.apache.org/docs/python/generated/pyarrow.compute.strftime.html
format = format.replace("%S.%f", "%S").replace("%S%.f", "%S")
format_ = format.replace("%S.%f", "%S").replace("%S%.f", "%S")
return self._series._from_native_series(
pc.strftime(self._series._native_series, format)
pc.strftime(self._series._native_series, format_)
)


Expand Down
6 changes: 3 additions & 3 deletions narwhals/_pandas_like/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -757,9 +757,9 @@ def to_string(self, format: str) -> PandasSeries: # noqa: A002
# PyArrow interprets `'%S'` as "seconds, plus fractional seconds"
# and doesn't support `%f`
if "pyarrow" not in str(self._series._native_series.dtype):
format = format.replace("%S%.f", "%S.%f")
format_ = format.replace("%S%.f", "%S.%f")
else:
format = format.replace("%S.%f", "%S").replace("%S%.f", "%S")
format_ = format.replace("%S.%f", "%S").replace("%S%.f", "%S")
return self._series._from_native_series(
self._series._native_series.dt.strftime(format)
self._series._native_series.dt.strftime(format_)
)
2 changes: 2 additions & 0 deletions narwhals/expression.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# flake8: noqa: A001

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
2 changes: 2 additions & 0 deletions narwhals/selectors.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# flake8: noqa: A001

from __future__ import annotations

from typing import Any
Expand Down
2 changes: 2 additions & 0 deletions narwhals/stable/v1.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# flake8: noqa: A001

from __future__ import annotations

from functools import wraps
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ lint.select = [
"ALL",
]
lint.ignore = [
'A001',
'A003',
'ANN101',
'ANN401',
Expand Down

0 comments on commit 935009a

Please sign in to comment.