Skip to content

Upgrade and broaden flake8, fixing style problems and bugs #1673

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
merged 5 commits into from
Sep 21, 2023
Next Next commit
Upgrade flake8 in pre-commit and fix new warnings
Upgrading flake8 from 6.0.0 to 6.1.0 causes its pycodestyle dependency to be upgraded from 2.10.* to 2.11.*, which is desirable because: - Spurious "E231 missing whitespace after ':'" warnings on 3.12 due to the lack of full compatibility with Python 3.12 are gone. - New warnings appear, at least one of which, "E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()`", does identify something we can improve. This upgrades flake8 in pre-commit and fixes the new warnings.
  • Loading branch information
EliahKagan committed Sep 21, 2023
commit bf7af69306ed8f14b33528165473ca3591a76246
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
rev: 6.1.0
hooks:
- id: flake8
additional_dependencies:
Expand Down
2 changes: 1 addition & 1 deletion git/objects/submodule/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1403,7 +1403,7 @@ def iter_items(
# END handle critical error

# Make sure we are looking at a submodule object
if type(sm) != git.objects.submodule.base.Submodule:
if type(sm) is not git.objects.submodule.base.Submodule:
continue

# fill in remaining info - saves time as it doesn't have to be parsed again
Expand Down
2 changes: 1 addition & 1 deletion git/refs/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def entry_at(cls, filepath: PathLike, index: int) -> "RefLogEntry":
for i in range(index + 1):
line = fp.readline()
if not line:
raise IndexError(f"Index file ended at line {i+1}, before given index was reached")
raise IndexError(f"Index file ended at line {i + 1}, before given index was reached")
# END abort on eof
# END handle runup

Expand Down
2 changes: 1 addition & 1 deletion git/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1136,7 +1136,7 @@ class IterableClassWatcher(type):

def __init__(cls, name: str, bases: Tuple, clsdict: Dict) -> None:
for base in bases:
if type(base) == IterableClassWatcher:
if type(base) is IterableClassWatcher:
warnings.warn(
f"GitPython Iterable subclassed by {name}. "
"Iterable is deprecated due to naming clash since v3.1.18"
Expand Down