Skip to content

Commit

Permalink
Upgrade flake8 in pre-commit and fix new warnings
Browse files Browse the repository at this point in the history
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
1 parent a5a6464 commit bf7af69
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
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

0 comments on commit bf7af69

Please sign in to comment.