Skip to content

Commit

Permalink
Restore relative order to fix circular import error
Browse files Browse the repository at this point in the history
This still uses all explicit rather than wildcard imports (and
still omits suppressions that are no longer needed due to wildcard
imports not being used). But it brings back the old relative order
of the `from ... import ...` statements inside the try-block.

Since this fixes the circular import problem, it is possible to run
the modattrs.py script to check for changes. New changes since
replacing wildcard imports, which are probably undesirable, are the
removal of these attributes pointing to indirect Python submodules
of the git module:

    base -> git.index.base
    fun -> git.index.fun
    head -> git.refs.head
    log -> git.refs.log
    reference -> git.refs.reference
    symbolic -> git.refs.symbolic
    tag -> git.refs.tag
    typ -> git.index.typ
  • Loading branch information
EliahKagan committed Mar 19, 2024
1 parent 7745250 commit 64c9efd
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions git/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,27 +119,8 @@
from git.types import PathLike

try:
from git.cmd import Git # @NoMove
from git.compat import safe_decode # @NoMove
from git.config import GitConfigParser # @NoMove
from git.db import GitCmdObjectDB, GitDB # @NoMove
from git.diff import ( # @NoMove
INDEX,
NULL_TREE,
Diff,
DiffConstants,
DiffIndex,
Diffable,
)
from git.index import ( # @NoMove
BaseIndexEntry,
BlobFilter,
CheckoutError,
IndexEntry,
IndexFile,
StageType,
util, # noqa: F401 # For backward compatibility.
)
from git.objects import ( # @NoMove
Blob,
Commit,
Expand All @@ -164,8 +145,27 @@
Tag,
TagReference,
)
from git.remote import FetchInfo, PushInfo, Remote, RemoteProgress # @NoMove
from git.diff import ( # @NoMove
INDEX,
NULL_TREE,
Diff,
DiffConstants,
DiffIndex,
Diffable,
)
from git.db import GitCmdObjectDB, GitDB # @NoMove
from git.cmd import Git # @NoMove
from git.repo import Repo # @NoMove
from git.remote import FetchInfo, PushInfo, Remote, RemoteProgress # @NoMove
from git.index import ( # @NoMove
BaseIndexEntry,
BlobFilter,
CheckoutError,
IndexEntry,
IndexFile,
StageType,
util, # noqa: F401 # For backward compatibility.
)
from git.util import ( # @NoMove
Actor,
BlockingLockFile,
Expand Down

0 comments on commit 64c9efd

Please sign in to comment.