From 01c95ebcc7d41bc68e1f64f9b1ec01c30f29d591 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Mon, 18 Mar 2024 16:38:39 -0400 Subject: [PATCH] Don't patch IndexObject and Object into git.objects.submodule.util Such patching, which was introduced in 9519f18, seems no longer to be necessary. Since git.objects.submodule.util.__all__ has existed for a long time without including those names, they are not conceptually public attributes of git.objects.submodule.util, so they should not be in use by any code outside GitPython either. The modattrs.py script shows the change, as expected, showing these two names as no longer being in the git.objects.submodule.util module dictionary, in output of: python modattrs.py >b git diff --no-index a b However, because the removal is intentional, this is okay. --- git/objects/__init__.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/git/objects/__init__.py b/git/objects/__init__.py index 1061ec874..d636873a0 100644 --- a/git/objects/__init__.py +++ b/git/objects/__init__.py @@ -8,17 +8,10 @@ from .base import * # noqa: F403 from .blob import * # noqa: F403 from .commit import * # noqa: F403 -from .submodule import util as smutil from .submodule.base import * # noqa: F403 from .submodule.root import * # noqa: F403 from .tag import * # noqa: F403 from .tree import * # noqa: F403 -# Fix import dependency - add IndexObject to the util module, so that it can be imported -# by the submodule.base. -smutil.IndexObject = IndexObject # type: ignore[attr-defined] # noqa: F405 -smutil.Object = Object # type: ignore[attr-defined] # noqa: F405 -del smutil - # Must come after submodule was made available. __all__ = [name for name, obj in locals().items() if not (name.startswith("_") or inspect.ismodule(obj))]