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

Commit7745250

Browse files
committed
Replace wildcard imports in top-level git module
- Use explicit imports instead of * imports.- Remove now-unneeded linter suppressions.- Alphabetize inside the try-block, though this will be undone.This currently fails to import due to a cyclic import error, so thethird change, alphabetizing the imports, will have to be undone (atleast in the absence of other changes). It is not merely that theyshould not be reordered in a way that makes them cross into or outof the try-block, but that within the try block not all orders willwork.There will be more to do for backward compatibility, but themodattrs.py script, which imports the top-level git module, cannotbe run until the cyclic import problem is fixed.
1 parentabbe74d commit7745250

File tree

1 file changed

+78
-17
lines changed

1 file changed

+78
-17
lines changed

‎git/__init__.py

Lines changed: 78 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# @PydevCodeAnalysisIgnore
77

8-
__all__= [# noqa: F405
8+
__all__= [
99
"Actor",
1010
"AmbiguousObjectName",
1111
"BadName",
@@ -88,32 +88,93 @@
8888

8989
__version__="git"
9090

91-
fromtypingimportList,Optional,Sequence,Tuple,Union,TYPE_CHECKING
91+
fromtypingimportList,Optional,Sequence,TYPE_CHECKING,Tuple,Union
9292

9393
fromgitdb.utilimportto_hex_sha
94-
fromgit.excimport*# noqa: F403 # @NoMove @IgnorePep8
94+
95+
fromgit.excimport (
96+
AmbiguousObjectName,
97+
BadName,
98+
BadObject,
99+
BadObjectType,
100+
CacheError,
101+
CheckoutError,
102+
CommandError,
103+
GitCommandError,
104+
GitCommandNotFound,
105+
GitError,
106+
HookExecutionError,
107+
InvalidDBRoot,
108+
InvalidGitRepositoryError,
109+
NoSuchPathError,
110+
ODBError,
111+
ParseError,
112+
RepositoryDirtyError,
113+
UnmergedEntriesError,
114+
UnsafeOptionError,
115+
UnsafeProtocolError,
116+
UnsupportedOperation,
117+
WorkTreeRepositoryUnsupported,
118+
)
95119
fromgit.typesimportPathLike
96120

97121
try:
98-
fromgit.compatimportsafe_decode# @NoMove @IgnorePep8
99-
fromgit.configimportGitConfigParser# @NoMove @IgnorePep8
100-
fromgit.objectsimport*# noqa: F403 # @NoMove @IgnorePep8
101-
fromgit.refsimport*# noqa: F403 # @NoMove @IgnorePep8
102-
fromgit.diffimport*# noqa: F403 # @NoMove @IgnorePep8
103-
fromgit.dbimport*# noqa: F403 # @NoMove @IgnorePep8
104-
fromgit.cmdimportGit# @NoMove @IgnorePep8
105-
fromgit.repoimportRepo# @NoMove @IgnorePep8
106-
fromgit.remoteimport*# noqa: F403 # @NoMove @IgnorePep8
107-
fromgit.indeximport*# noqa: F403 # @NoMove @IgnorePep8
108-
fromgit.utilimport (# @NoMove @IgnorePep8
109-
LockFile,
122+
fromgit.cmdimportGit# @NoMove
123+
fromgit.compatimportsafe_decode# @NoMove
124+
fromgit.configimportGitConfigParser# @NoMove
125+
fromgit.dbimportGitCmdObjectDB,GitDB# @NoMove
126+
fromgit.diffimport (# @NoMove
127+
INDEX,
128+
NULL_TREE,
129+
Diff,
130+
DiffConstants,
131+
DiffIndex,
132+
Diffable,
133+
)
134+
fromgit.indeximport (# @NoMove
135+
BaseIndexEntry,
136+
BlobFilter,
137+
CheckoutError,
138+
IndexEntry,
139+
IndexFile,
140+
StageType,
141+
util,# noqa: F401 # For backward compatibility.
142+
)
143+
fromgit.objectsimport (# @NoMove
144+
Blob,
145+
Commit,
146+
IndexObject,
147+
Object,
148+
RootModule,
149+
RootUpdateProgress,
150+
Submodule,
151+
TagObject,
152+
Tree,
153+
TreeModifier,
154+
UpdateProgress,
155+
)
156+
fromgit.refsimport (# @NoMove
157+
HEAD,
158+
Head,
159+
RefLog,
160+
RefLogEntry,
161+
Reference,
162+
RemoteReference,
163+
SymbolicReference,
164+
Tag,
165+
TagReference,
166+
)
167+
fromgit.remoteimportFetchInfo,PushInfo,Remote,RemoteProgress# @NoMove
168+
fromgit.repoimportRepo# @NoMove
169+
fromgit.utilimport (# @NoMove
170+
Actor,
110171
BlockingLockFile,
172+
LockFile,
111173
Stats,
112-
Actor,
113174
remove_password_if_present,
114175
rmtree,
115176
)
116-
exceptGitErroras_exc:# noqa: F405
177+
exceptGitErroras_exc:
117178
raiseImportError("%s: %s"% (_exc.__class__.__name__,_exc))from_exc
118179

119180
# { Initialize git executable path

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp