You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refine deprecated module attributes and their warnings
- In the top-level git module, import util from git.index so there
is no ambiguity for tools in detecting which module the util
attribute of the top-level git module (i.e., git.util in an
*expression*) is, even though it's subsequently deleted (and then
dynamically supplied when requested, in a way that is opaque to
static type checkers due to being only when `not TYPE_CHECKING`).
This seems to be necessary for some tools.
Curiously, guarding the del statement under `not TYPE_CHECKING`
seems *not* to be needed by any tools of any kind. It should
still possibly be done, but that's not included in these changes.
- Add the missing deprecation warning for git.types.Lit_commit_ish.
- When importing the warnings module, do so with a top-level import
as in the other GitPython modules that have long (and reasonably)
done so.
In git/__init__.py, there already had to be an import of
importlib, which seemed like it should be done locally in case of
delays. Neither the importlib module nor any of its submodules
were already imported anywhere in GitPython, and the code that
uses it will most often not be exercised. So there is a potential
benefit to avoiding loading it when not needed.
When writing a local import for that, I had included the warnings
module as a local import as well. But this obscures the potential
benefit of locally importing importlib, and could lead to
ill-advised changes in the future based on the idea that the
degree of justification to be local imports was the same for them
both.
0 commit comments