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

Commitf89d065

Browse files
committed
Fix git.objects.__all__ and make submodules explicit
The submodules being made explicit here are of course Pythonsubmodules, not git submodules.The git.objects.submodule Python submodule (which is *about* gitsubmodules) is made explicit here (as are the names imported fromthat Python submodule's own Python submodules) along with the otherPython submodules of git.objects.Unlike some other submodules, but like the top-level git moduleuntil#1659, git.objects already defined __all__ but it wasdynamically constructed. As with git.__all__ previously (as notedin#1859), I have usedhttps://github.com/EliahKagan/deltall hereto check that it is safe, sufficient, and probably necessary toreplace this dynamically constructed __all__ with a literal list ofstrings in which all of the original elements are included. See:https://gist.github.com/EliahKagan/e627603717ca5f9cafaf8de9d9f27ad7Running the modattrs.py script, and diffing against the output frombefore the current import refactoring began, reveals two changes tomodule contents as a result of the change here:- git.objects no longer contains `inspect`, which it imported just to build the dynamically constructed __all__. Because this was not itself included in that __all__ or otherwise made public or used out of git.objects, that is okay. This is exactly analogous to the situation in8197e90, which removed it from the top-level git module after#1659.- The top-level git module now has has new attributes blob, commit, submodule, and tree, aliasing the corresponding modules. This has happened as a result of them being put in git.objects.__all__ along with various names imported from them. (As noted in some prior commits, there are tradeoffs associated with doing this, and it may be that such elements of __all__ should be removed, here and elsewhere.)
1 parent01c95eb commitf89d065

File tree

1 file changed

+26
-11
lines changed

1 file changed

+26
-11
lines changed

‎git/objects/__init__.py

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,30 @@
33

44
"""Import all submodules' main classes into the package space."""
55

6-
importinspect
6+
__all__= [
7+
"base",
8+
"blob",
9+
"commit",
10+
"submodule",
11+
"tag",
12+
"tree",
13+
"IndexObject",
14+
"Object",
15+
"Blob",
16+
"Commit",
17+
"Submodule",
18+
"UpdateProgress",
19+
"RootModule",
20+
"RootUpdateProgress",
21+
"TagObject",
22+
"Tree",
23+
"TreeModifier",
24+
]
725

8-
from .baseimport*# noqa: F403
9-
from .blobimport*# noqa: F403
10-
from .commitimport*# noqa: F403
11-
from .submodule.baseimport*# noqa: F403
12-
from .submodule.rootimport*# noqa: F403
13-
from .tagimport*# noqa: F403
14-
from .treeimport*# noqa: F403
15-
16-
# Must come after submodule was made available.
17-
__all__= [nameforname,objinlocals().items()ifnot (name.startswith("_")orinspect.ismodule(obj))]
26+
from .baseimportIndexObject,Object
27+
from .blobimportBlob
28+
from .commitimportCommit
29+
from .submodule.baseimportSubmodule,UpdateProgress
30+
from .submodule.rootimportRootModule,RootUpdateProgress
31+
from .tagimportTagObject
32+
from .treeimportTree,TreeModifier

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp