Skip to content

STYLE: upgrade flake8 #48069

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -46,20 +46,19 @@ 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.4
hooks:
- id: flake8
additional_dependencies: &flake8_dependencies
- flake8==4.0.1
- flake8-comprehensions==3.7.0
- flake8-bugbear==21.3.2
- flake8==5.0.4
- flake8-bugbear==22.7.1
- pandas-dev-flaker==0.5.0
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
- id: isort
- repo: https://github.com/asottile/pyupgrade
rev: v2.34.0
rev: v2.37.3
hooks:
- id: pyupgrade
args: [--py38-plus]
Expand Down Expand Up @@ -239,8 +238,8 @@ repos:
types: [pyi]
language: python
additional_dependencies:
- flake8==4.0.1
- flake8-pyi==22.7.0
- flake8==5.0.4
- flake8-pyi==22.8.1
- id: future-annotations
name: import annotations from __future__
entry: 'from __future__ import annotations'
Expand Down
5 changes: 2 additions & 3 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,8 @@ dependencies:
# code checks
- black=22.3.0
- cpplint
- flake8=4.0.1
- flake8-bugbear=21.3.2 # used by flake8, find likely bugs
- flake8-comprehensions=3.7.0 # used by flake8, linting of unnecessary comprehensions
- flake8=5.0.4
- 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
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/arrays/categorical/test_repr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions pandas/tests/indexes/categorical/test_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/indexes/multi/test_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__()
Expand Down
5 changes: 2 additions & 3 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,8 @@ flask
asv
black==22.3.0
cpplint
flake8==4.0.1
flake8-bugbear==21.3.2
flake8-comprehensions==3.7.0
flake8==5.0.4
flake8-bugbear==22.7.1
isort>=5.2.1
mypy==0.971
pre-commit>=2.15.0
Expand Down
6 changes: 6 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down