Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit6318eea

Browse 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 anunused import, rather than to entire import statements (exceptwhere the entire statement fit on one line and everything itimported is known to be unused).Either Ruff has the ability to accept this more granular style ofsuppression, or I had been unaware of it from flake8 (used before).I have veriifed that the suppressions are not superfluous: with nosuppressions, Ruff does warn. This commit makes no change ingit.types because it looks like no suppression at all may beneeded there anymore; that will be covered in the next commit.This also removes the old `@UnusedImport` comments, which had beenkept before because they were more granular; this specificity isnow achieved by comments the tools being used can recognize.
1 parent3d4e476 commit6318eea

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

‎git/compat.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@
1414
importos
1515
importsys
1616

17-
fromgitdb.utils.encodingimportforce_bytes,force_text# noqa: F401 # @UnusedImport
17+
fromgitdb.utils.encodingimportforce_bytes,force_text# noqa: F401
1818

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

21-
fromtypingimport (# noqa: F401
22-
Any,
21+
fromtypingimport (
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

Lines 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-
fromgitdb.utilimport (# 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+
fromgitdb.utilimport (
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)

[8]ページ先頭

©2009-2025 Movatter.jp