From 3896d27c710cce6de1ec3ffd3436bb7b63b1bb34 Mon Sep 17 00:00:00 2001 From: MarcoGorelli Date: Mon, 1 Aug 2022 07:06:21 +0000 Subject: [PATCH 1/7] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20UPGRADE:=20Autoupdate?= =?UTF-8?q?=20pre-commit=20config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index dbddba57ef21c..bfefa13195525 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,7 +11,7 @@ repos: - id: absolufy-imports files: ^pandas/ - repo: https://github.com/jendrikseipp/vulture - rev: 'v2.4' + rev: 'v2.5' hooks: - id: vulture entry: python scripts/run_vulture.py @@ -46,7 +46,7 @@ repos: exclude: ^pandas/_libs/src/(klib|headers)/ args: [--quiet, '--extensions=c,h', '--headers=h', --recursive, '--filter=-readability/casting,-runtime/int,-build/include_subdir'] - repo: https://github.com/PyCQA/flake8 - rev: 4.0.1 + rev: 5.0.1 hooks: - id: flake8 additional_dependencies: &flake8_dependencies @@ -59,7 +59,7 @@ repos: hooks: - id: isort - repo: https://github.com/asottile/pyupgrade - rev: v2.34.0 + rev: v2.37.3 hooks: - id: pyupgrade args: [--py38-plus] From a5fd41757a8569580c9030979c7a785c938adfb6 Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Wed, 10 Aug 2022 20:54:03 +0200 Subject: [PATCH 2/7] sync flake8 version --- .pre-commit-config.yaml | 6 +++--- environment.yml | 2 +- requirements-dev.txt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bfefa13195525..64c84a60106d4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -46,11 +46,11 @@ repos: exclude: ^pandas/_libs/src/(klib|headers)/ args: [--quiet, '--extensions=c,h', '--headers=h', --recursive, '--filter=-readability/casting,-runtime/int,-build/include_subdir'] - repo: https://github.com/PyCQA/flake8 - rev: 5.0.1 + rev: 5.0.4 hooks: - id: flake8 additional_dependencies: &flake8_dependencies - - flake8==4.0.1 + - flake8==5.0.4 - flake8-comprehensions==3.7.0 - flake8-bugbear==21.3.2 - pandas-dev-flaker==0.5.0 @@ -239,7 +239,7 @@ repos: types: [pyi] language: python additional_dependencies: - - flake8==4.0.1 + - flake8==5.0.4 - flake8-pyi==22.7.0 - id: future-annotations name: import annotations from __future__ diff --git a/environment.yml b/environment.yml index 8866b1b3b7df6..333a1a8472f72 100644 --- a/environment.yml +++ b/environment.yml @@ -85,7 +85,7 @@ dependencies: # code checks - black=22.3.0 - cpplint - - flake8=4.0.1 + - flake8=5.0.4 - flake8-bugbear=21.3.2 # used by flake8, find likely bugs - flake8-comprehensions=3.7.0 # used by flake8, linting of unnecessary comprehensions - isort>=5.2.1 # check that imports are in the right order diff --git a/requirements-dev.txt b/requirements-dev.txt index a6e0f9e98b52a..7548f8b3af833 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -64,7 +64,7 @@ flask asv black==22.3.0 cpplint -flake8==4.0.1 +flake8==5.0.4 flake8-bugbear==21.3.2 flake8-comprehensions==3.7.0 isort>=5.2.1 From 8bbbbb5c1c952f04ef79f8a7927a0ff780226c42 Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Wed, 10 Aug 2022 20:55:19 +0200 Subject: [PATCH 3/7] update flake8-pyi version --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 64c84a60106d4..ecdb9d5f0c5bd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -240,7 +240,7 @@ repos: language: python additional_dependencies: - flake8==5.0.4 - - flake8-pyi==22.7.0 + - flake8-pyi==22.8.1 - id: future-annotations name: import annotations from __future__ entry: 'from __future__ import annotations' From 9dc050fd471d84e757b2d390eb8f079cf4fbb413 Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Wed, 10 Aug 2022 20:58:11 +0200 Subject: [PATCH 4/7] remove flake8-comprehensions (unnecessary since pyupgrade) --- .pre-commit-config.yaml | 1 - environment.yml | 1 - requirements-dev.txt | 1 - 3 files changed, 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ecdb9d5f0c5bd..58db7fce3aab2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -51,7 +51,6 @@ repos: - id: flake8 additional_dependencies: &flake8_dependencies - flake8==5.0.4 - - flake8-comprehensions==3.7.0 - flake8-bugbear==21.3.2 - pandas-dev-flaker==0.5.0 - repo: https://github.com/PyCQA/isort diff --git a/environment.yml b/environment.yml index 333a1a8472f72..d31bdd3e8d820 100644 --- a/environment.yml +++ b/environment.yml @@ -87,7 +87,6 @@ dependencies: - cpplint - flake8=5.0.4 - flake8-bugbear=21.3.2 # used by flake8, find likely bugs - - flake8-comprehensions=3.7.0 # used by flake8, linting of unnecessary comprehensions - isort>=5.2.1 # check that imports are in the right order - mypy=0.971 - pre-commit>=2.15.0 diff --git a/requirements-dev.txt b/requirements-dev.txt index 7548f8b3af833..7a1461f5c0315 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -66,7 +66,6 @@ black==22.3.0 cpplint flake8==5.0.4 flake8-bugbear==21.3.2 -flake8-comprehensions==3.7.0 isort>=5.2.1 mypy==0.971 pre-commit>=2.15.0 From e5c9d171c748d5bedeae2365313ce44c5a2a5f14 Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Fri, 12 Aug 2022 17:31:47 +0200 Subject: [PATCH 5/7] bump bugbear --- .pre-commit-config.yaml | 2 +- environment.yml | 2 +- requirements-dev.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 58db7fce3aab2..2ca5b5c9b896b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -51,7 +51,7 @@ repos: - id: flake8 additional_dependencies: &flake8_dependencies - flake8==5.0.4 - - flake8-bugbear==21.3.2 + - flake8-bugbear==22.7.1 - pandas-dev-flaker==0.5.0 - repo: https://github.com/PyCQA/isort rev: 5.10.1 diff --git a/environment.yml b/environment.yml index d31bdd3e8d820..f1472f453b935 100644 --- a/environment.yml +++ b/environment.yml @@ -86,7 +86,7 @@ dependencies: - black=22.3.0 - cpplint - flake8=5.0.4 - - flake8-bugbear=21.3.2 # used by flake8, find likely bugs + - flake8-bugbear=22.7.1 # used by flake8, find likely bugs - isort>=5.2.1 # check that imports are in the right order - mypy=0.971 - pre-commit>=2.15.0 diff --git a/requirements-dev.txt b/requirements-dev.txt index 7a1461f5c0315..60dd738e43ba3 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -65,7 +65,7 @@ asv black==22.3.0 cpplint flake8==5.0.4 -flake8-bugbear==21.3.2 +flake8-bugbear==22.7.1 isort>=5.2.1 mypy==0.971 pre-commit>=2.15.0 From 90fc009a5f25a8eeb5915176a3d57e99a0941748 Mon Sep 17 00:00:00 2001 From: jmoro0408 Date: Sat, 13 Aug 2022 12:37:09 +0000 Subject: [PATCH 6/7] GH48061 set flake8 bugbear errors (B019, B020, B023) to ignore --- setup.cfg | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/setup.cfg b/setup.cfg index 8f7cfc288ecdb..f2314316f7732 100644 --- a/setup.cfg +++ b/setup.cfg @@ -103,6 +103,12 @@ ignore = # tests use comparisons but not their returned value B015, # false positives + B019, + # Use of functools.lru_cache or functools.cache on methods can lead to memory leaks. + B020 + # Loop control variable overrides iterable it iterates + B023 + # Functions defined inside a loop must not use variables redefined in the loop B301, # single-letter variables PDF023, From dcc9696fbf95be6721293cd82df8b98f8d4f1d3c Mon Sep 17 00:00:00 2001 From: jmoro0408 Date: Sat, 13 Aug 2022 12:39:25 +0000 Subject: [PATCH 7/7] GH48061 fix flake8 character length (E501) errors --- pandas/tests/arrays/categorical/test_repr.py | 4 ++-- pandas/tests/indexes/categorical/test_formats.py | 6 +++--- pandas/tests/indexes/multi/test_formats.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pandas/tests/arrays/categorical/test_repr.py b/pandas/tests/arrays/categorical/test_repr.py index 3454c8bb90941..b44af07cee01d 100644 --- a/pandas/tests/arrays/categorical/test_repr.py +++ b/pandas/tests/arrays/categorical/test_repr.py @@ -319,7 +319,7 @@ def test_categorical_repr_timedelta(self): c = Categorical(idx.append(idx), categories=idx) exp = """[1 days, 2 days, 3 days, 4 days, 5 days, 1 days, 2 days, 3 days, 4 days, 5 days] -Categories (5, timedelta64[ns]): [1 days, 2 days, 3 days, 4 days, 5 days]""" +Categories (5, timedelta64[ns]): [1 days, 2 days, 3 days, 4 days, 5 days]""" # noqa:E501 assert repr(c) == exp @@ -352,7 +352,7 @@ def test_categorical_repr_timedelta_ordered(self): c = Categorical(idx.append(idx), categories=idx, ordered=True) exp = """[1 days, 2 days, 3 days, 4 days, 5 days, 1 days, 2 days, 3 days, 4 days, 5 days] -Categories (5, timedelta64[ns]): [1 days < 2 days < 3 days < 4 days < 5 days]""" +Categories (5, timedelta64[ns]): [1 days < 2 days < 3 days < 4 days < 5 days]""" # noqa:E501 assert repr(c) == exp diff --git a/pandas/tests/indexes/categorical/test_formats.py b/pandas/tests/indexes/categorical/test_formats.py index d48f6dc70a2b8..d7812888556ea 100644 --- a/pandas/tests/indexes/categorical/test_formats.py +++ b/pandas/tests/indexes/categorical/test_formats.py @@ -24,7 +24,7 @@ def test_string_categorical_index_repr(self): expected = """CategoricalIndex(['a', 'bb', 'ccc', 'a', 'bb', 'ccc', 'a', 'bb', 'ccc', 'a', 'bb', 'ccc', 'a', 'bb', 'ccc', 'a', 'bb', 'ccc', 'a', 'bb', 'ccc', 'a', 'bb', 'ccc', 'a', 'bb', 'ccc', 'a', 'bb', 'ccc'], - categories=['a', 'bb', 'ccc'], ordered=False, dtype='category')""" + categories=['a', 'bb', 'ccc'], ordered=False, dtype='category')""" # noqa:E501 assert repr(idx) == expected @@ -55,7 +55,7 @@ def test_string_categorical_index_repr(self): expected = """CategoricalIndex(['あ', 'いい', 'ううう', 'あ', 'いい', 'ううう', 'あ', 'いい', 'ううう', 'あ', 'いい', 'ううう', 'あ', 'いい', 'ううう', 'あ', 'いい', 'ううう', 'あ', 'いい', 'ううう', 'あ', 'いい', 'ううう', 'あ', 'いい', 'ううう', 'あ', 'いい', 'ううう'], - categories=['あ', 'いい', 'ううう'], ordered=False, dtype='category')""" + categories=['あ', 'いい', 'ううう'], ordered=False, dtype='category')""" # noqa:E501 assert repr(idx) == expected @@ -90,7 +90,7 @@ def test_string_categorical_index_repr(self): 'ううう', 'あ', 'いい', 'ううう', 'あ', 'いい', 'ううう', 'あ', 'いい', 'ううう', 'あ', 'いい', 'ううう', 'あ', 'いい', 'ううう', 'あ', 'いい', 'ううう', 'あ', 'いい', 'ううう'], - categories=['あ', 'いい', 'ううう'], ordered=False, dtype='category')""" + categories=['あ', 'いい', 'ううう'], ordered=False, dtype='category')""" # noqa:E501 assert repr(idx) == expected diff --git a/pandas/tests/indexes/multi/test_formats.py b/pandas/tests/indexes/multi/test_formats.py index f71472b726fa2..238a3e78169a8 100644 --- a/pandas/tests/indexes/multi/test_formats.py +++ b/pandas/tests/indexes/multi/test_formats.py @@ -184,7 +184,7 @@ def test_tuple_width(self, wide_multi_index): mi = wide_multi_index result = mi[:1].__repr__() expected = """MultiIndex([('a', 9, '2000-01-01 00:00:00', '2000-01-01 00:00:00', ...)], - names=['a', 'b', 'dti_1', 'dti_2', 'dti_3'])""" + names=['a', 'b', 'dti_1', 'dti_2', 'dti_3'])""" # noqa:E501 assert result == expected result = mi[:10].__repr__()