Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6318eea

Browse filesBrowse files
committed
Make F401 "unused import" suppressions more specific
In git.compat and git.util. This applies them individually to each name that is known to be an unused import, rather than to entire import statements (except where the entire statement fit on one line and everything it imported is known to be unused). Either Ruff has the ability to accept this more granular style of suppression, or I had been unaware of it from flake8 (used before). I have veriifed that the suppressions are not superfluous: with no suppressions, Ruff does warn. This commit makes no change in git.types because it looks like no suppression at all may be needed there anymore; that will be covered in the next commit. This also removes the old `@UnusedImport` comments, which had been kept before because they were more granular; this specificity is now achieved by comments the tools being used can recognize.
1 parent 3d4e476 commit 6318eea
Copy full SHA for 6318eea

File tree

Expand file treeCollapse file tree

2 files changed

+16
-16
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+16
-16
lines changed

‎git/compat.py

Copy file name to clipboardExpand all lines: git/compat.py
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@
1414
import os
1515
import sys
1616

17-
from gitdb.utils.encoding import force_bytes, force_text # noqa: F401 # @UnusedImport
17+
from gitdb.utils.encoding import force_bytes, force_text # noqa: F401
1818

1919
# typing --------------------------------------------------------------------
2020

21-
from typing import ( # noqa: F401
22-
Any,
21+
from typing import (
22+
Any, # noqa: F401
2323
AnyStr,
24-
Dict,
25-
IO,
24+
Dict, # noqa: F401
25+
IO, # noqa: F401
2626
Optional,
27-
Tuple,
28-
Type,
27+
Tuple, # noqa: F401
28+
Type, # noqa: F401
2929
Union,
3030
overload,
3131
)

‎git/util.py

Copy file name to clipboardExpand all lines: git/util.py
+9-9Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,16 @@
5151
# gitdb all the time in their imports. They are not in __all__, at least currently,
5252
# because they could be removed or changed at any time, and so should not be considered
5353
# conceptually public to code outside GitPython. Linters of course do not like it.
54-
from gitdb.util import ( # noqa: F401 # @IgnorePep8
55-
LazyMixin, # @UnusedImport
56-
LockedFD, # @UnusedImport
57-
bin_to_hex, # @UnusedImport
58-
file_contents_ro_filepath, # @UnusedImport
59-
file_contents_ro, # @UnusedImport
60-
hex_to_bin, # @UnusedImport
54+
from gitdb.util import (
55+
LazyMixin, # noqa: F401
56+
LockedFD, # noqa: F401
57+
bin_to_hex, # noqa: F401
58+
file_contents_ro_filepath, # noqa: F401
59+
file_contents_ro, # noqa: F401
60+
hex_to_bin, # noqa: F401
6161
make_sha,
62-
to_bin_sha, # @UnusedImport
63-
to_hex_sha, # @UnusedImport
62+
to_bin_sha, # noqa: F401
63+
to_hex_sha, # noqa: F401
6464
)
6565

6666
# typing ---------------------------------------------------------

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.