Skip to content

STYLE: upgrade flake8 #48061

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

Closed
MarcoGorelli opened this issue Aug 12, 2022 · 7 comments · Fixed by #48069
Closed

STYLE: upgrade flake8 #48061

MarcoGorelli opened this issue Aug 12, 2022 · 7 comments · Fixed by #48069
Assignees
Labels
Code Style Code style, linting, code_checks good first issue

Comments

@MarcoGorelli
Copy link
Member

Issue here is:

  1. checkout the create-pr-action/pre-commit-config-update-0 branch
  2. run pre-commit run flake8 --all-files. You should see some errors like:
pandas/tests/indexes/categorical/test_formats.py:24:89: E501 line too long (98 > 88 characters)
pandas/tests/indexes/categorical/test_formats.py:55:89: E501 line too long (98 > 88 characters)
pandas/tests/indexes/categorical/test_formats.py:89:89: E501 line too long (90 > 88 characters)
pandas/tests/frame/test_query_eval.py:917:17: B020 Found for loop that reassigns the iterable it is iterating with each iterable value.
pandas/tests/frame/test_query_eval.py:917:26: B020 Found for loop that reassigns the iterable it is iterating with each iterable value.
pandas/tests/frame/test_query_eval.py:958:17: B020 Found for loop that reassigns the iterable it is iterating with each iterable value.
pandas/tests/frame/test_query_eval.py:958:26: B020 Found for loop that reassigns the iterable it is iterating with each iterable value.
pandas/core/strings/object_array.py:375:69: B023 Function definition does not bind loop variable 'pat'.
pandas/tests/window/test_rolling.py:819:10: B020 Found for loop that reassigns the iterable it is iterating with each iterable value.
pandas/tests/window/test_rolling.py:867:10: B020 Found for loop that reassigns the iterable it is iterating with each iterable value.
pandas/tests/window/test_rolling.py:917:10: B020 Found for loop that reassigns the iterable it is iterating with each iterable value.
pandas/tests/window/test_rolling.py:969:10: B020 Found for loop that reassigns the iterable it is iterating with each iterable value.
pandas/tests/io/parser/test_c_parser_only.py:194:49: B023 Function definition does not bind loop variable 'actual_val'.
pandas/tests/window/test_expanding.py:221:10: B020 Found for loop that reassigns the iterable it is iterating with each iterable value.
pandas/tests/window/test_expanding.py:240:10: B020 Found for loop that reassigns the iterable it is iterating with each iterable value.
pandas/tests/arrays/categorical/test_repr.py:321:89: E501 line too long (97 > 88 characters)
pandas/tests/arrays/categorical/test_repr.py:354:89: E501 line too long (97 > 88 characters)
pandas/io/formats/excel.py:175:6: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks. The cache may retain instance references, preventing garbage collection.
pandas/tests/arrays/masked/test_arithmetic.py:58:9: B020 Found for loop that reassigns the iterable it is iterating with each iterable value.
pandas/tests/arrays/masked/test_arithmetic.py:217:9: B020 Found for loop that reassigns the iterable it is iterating with each iterable value.
pandas/tests/groupby/transform/test_transform.py:760:9: B020 Found for loop that reassigns the iterable it is iterating with each iterable value.
pandas/tests/indexes/multi/test_formats.py:186:89: E501 line too long (95 > 88 characters)
scripts/no_bool_in_generic.py:42:21: B020 Found for loop that reassigns the iterable it is iterating with each iterable value.
pandas/tests/io/sas/test_sas7bdat.py:323:17: B020 Found for loop that reassigns the iterable it is iterating with each iterable value.
pandas/io/pytables.py:4131:38: B023 Function definition does not bind loop variable 'obj'.
pandas/io/pytables.py:4[132](https://github.com/pandas-dev/pandas/runs/7809209712?check_suite_focus=true#step:4:134):39: B023 Function definition does not bind loop variable 'obj'.
pandas/io/pytables.py:4133:39: B023 Function definition does not bind loop variable 'obj'.
pandas/io/pytables.py:4144:38: B023 Function definition does not bind loop variable 'op'.
pandas/io/pytables.py:4145:36: B023 Function definition does not bind loop variable 'obj'.
pandas/io/pytables.py:4151:59: B023 Function definition does not bind loop variable 'obj'.
pandas/io/pytables.py:4155:43: B023 Function definition does not bind loop variable 'obj'.
pandas/io/pytables.py:4157:38: B023 Function definition does not bind loop variable 'op'.
pandas/io/pytables.py:4158:36: B023 Function definition does not bind loop variable 'obj'.
  1. Fixup these errors, and when pre-commit run flake8 --all-files passes, stage, commit, and push!
@MarcoGorelli MarcoGorelli added Code Style Code style, linting, code_checks good first issue labels Aug 12, 2022
@jmoro0408
Copy link
Contributor

take

@jmoro0408
Copy link
Contributor

Hello, I'll try taking this on as my first contribution.

@twoertwein
Copy link
Member

A few of them are new checks from flake8-bugbear. Might need some discussion on whether some of the should purposefully be disabled (generally/line-by-line):

B019 Use of functools.lru_cache or functools.cache on methods can lead to memory leaks. The cache may retain instance references, preventing garbage collection.
B020 Found for loop that reassigns the iterable it is iterating with each iterable value.
B023 Function definition does not bind loop variable '...'.

@MarcoGorelli
Copy link
Member Author

Could we just ignore them for now, so we can get the upgraded versions, and have a todo or an issue about enabling them?

@jmoro0408
Copy link
Contributor

Sounds good to me. I'll just add some "# noqa" comments to the bugbear issues for now, and can discuss enabling them in a later issue.

@MarcoGorelli
Copy link
Member Author

Might be easier to ignore them in the setup. Cfg file if they're codes that need discussion or that we might want to enable later

@jmoro0408
Copy link
Contributor

Yep that definitely makes more sense, thanks! I'll try to get to this today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Style Code style, linting, code_checks good first issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants