diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2d5cd9e841df3..b81b9ba070a44 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,7 +19,7 @@ ci: skip: [pyright, mypy] repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.7 + rev: v0.5.0 hooks: - id: ruff args: [--exit-non-zero-on-fix] @@ -73,7 +73,7 @@ repos: hooks: - id: isort - repo: https://github.com/asottile/pyupgrade - rev: v3.15.2 + rev: v3.16.0 hooks: - id: pyupgrade args: [--py310-plus] @@ -93,7 +93,7 @@ repos: - id: sphinx-lint args: ["--enable", "all", "--disable", "line-too-long"] - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v18.1.5 + rev: v18.1.8 hooks: - id: clang-format files: ^pandas/_libs/src|^pandas/_libs/include diff --git a/pandas/core/common.py b/pandas/core/common.py index 1423ea456384b..ec0473a20458b 100644 --- a/pandas/core/common.py +++ b/pandas/core/common.py @@ -145,7 +145,7 @@ def is_bool_indexer(key: Any) -> bool: elif isinstance(key, list): # check if np.array(key).dtype would be bool if len(key) > 0: - if type(key) is not list: # noqa: E721 + if type(key) is not list: # GH#42461 cython will raise TypeError if we pass a subclass key = list(key) return lib.is_bool_list(key) diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 71dfff520113c..7d43498d4267b 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -7528,7 +7528,7 @@ def ensure_index(index_like: Axes, copy: bool = False) -> Index: index_like = list(index_like) if isinstance(index_like, list): - if type(index_like) is not list: # noqa: E721 + if type(index_like) is not list: # must check for exactly list here because of strict type # check in clean_index_list index_like = list(index_like) diff --git a/pandas/core/internals/construction.py b/pandas/core/internals/construction.py index 23572975a1112..0d149f47fd08c 100644 --- a/pandas/core/internals/construction.py +++ b/pandas/core/internals/construction.py @@ -842,7 +842,7 @@ def _list_of_dict_to_arrays( # assure that they are of the base dict class and not of derived # classes - data = [d if type(d) is dict else dict(d) for d in data] # noqa: E721 + data = [d if type(d) is dict else dict(d) for d in data] content = lib.dicts_to_array(data, list(columns)) return content, columns diff --git a/pandas/core/tools/datetimes.py b/pandas/core/tools/datetimes.py index 9b8970f86ed6d..0e91bfa99e887 100644 --- a/pandas/core/tools/datetimes.py +++ b/pandas/core/tools/datetimes.py @@ -129,7 +129,7 @@ class FulldatetimeDict(YearMonthDayDict, total=False): def _guess_datetime_format_for_array(arr, dayfirst: bool | None = False) -> str | None: # Try to guess the format based on the first non-NaN element, return None if can't if (first_non_null := tslib.first_non_null(arr)) != -1: - if type(first_non_nan_element := arr[first_non_null]) is str: # noqa: E721 + if type(first_non_nan_element := arr[first_non_null]) is str: # GH#32264 np.str_ object guessed_format = guess_datetime_format( first_non_nan_element, dayfirst=dayfirst diff --git a/pandas/tests/frame/test_repr.py b/pandas/tests/frame/test_repr.py index f6e0251d52de1..f799495d8025a 100644 --- a/pandas/tests/frame/test_repr.py +++ b/pandas/tests/frame/test_repr.py @@ -38,10 +38,10 @@ def test_repr_should_return_str(self): index1 = ["\u03c3", "\u03c4", "\u03c5", "\u03c6"] cols = ["\u03c8"] df = DataFrame(data, columns=cols, index=index1) - assert type(df.__repr__()) is str # noqa: E721 + assert type(df.__repr__()) is str ser = df[cols[0]] - assert type(ser.__repr__()) is str # noqa: E721 + assert type(ser.__repr__()) is str def test_repr_bytes_61_lines(self): # GH#12857 diff --git a/pyproject.toml b/pyproject.toml index 661e8efbb95fc..9156c73efbb35 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -318,6 +318,8 @@ ignore = [ "RUF007", # mutable-class-default "RUF012", + # type-comparison + "E721", # Additional pylint rules # literal-membership