diff --git a/git/__init__.py b/git/__init__.py index be8338ddc..05a02a7ff 100644 --- a/git/__init__.py +++ b/git/__init__.py @@ -6,12 +6,11 @@ # flake8: noqa # @PydevCodeAnalysisIgnore from git.exc import * # @NoMove @IgnorePep8 -import inspect import os -import sys import os.path as osp +import sys -from typing import Optional +from typing import List, Optional, Sequence, Tuple, Union, TYPE_CHECKING from git.types import PathLike __version__ = "git" @@ -39,7 +38,10 @@ def _init_externals() -> None: # { Imports +from gitdb.util import to_hex_sha + try: + from git.compat import safe_decode # @NoMove @IgnorePep8 from git.config import GitConfigParser # @NoMove @IgnorePep8 from git.objects import * # @NoMove @IgnorePep8 from git.refs import * # @NoMove @IgnorePep8 @@ -54,6 +56,7 @@ def _init_externals() -> None: BlockingLockFile, Stats, Actor, + remove_password_if_present, rmtree, ) except GitError as _exc: diff --git a/git/db.py b/git/db.py index bff43347b..b1a0d108a 100644 --- a/git/db.py +++ b/git/db.py @@ -1,7 +1,7 @@ """Module with our own gitdb implementation - it uses the git command""" from git.util import bin_to_hex, hex_to_bin from gitdb.base import OInfo, OStream -from gitdb.db import GitDB # @UnusedImport +from gitdb.db import GitDB from gitdb.db import LooseObjectDB from gitdb.exc import BadObject diff --git a/git/exc.py b/git/exc.py index b4ffe7568..32c371d0b 100644 --- a/git/exc.py +++ b/git/exc.py @@ -5,7 +5,34 @@ # the BSD License: https://opensource.org/license/bsd-3-clause/ """ Module containing all exceptions thrown throughout the git package """ -from gitdb.exc import ( # noqa: @UnusedImport +__all__ = [ + # Defined in gitdb.exc: + "AmbiguousObjectName", + "BadName", + "BadObject", + "BadObjectType", + "InvalidDBRoot", + "ODBError", + "ParseError", + "UnsupportedOperation", + # Introduced in this module: + "GitError", + "InvalidGitRepositoryError", + "WorkTreeRepositoryUnsupported", + "NoSuchPathError", + "UnsafeProtocolError", + "UnsafeOptionError", + "CommandError", + "GitCommandNotFound", + "GitCommandError", + "CheckoutError", + "CacheError", + "UnmergedEntriesError", + "HookExecutionError", + "RepositoryDirtyError", +] + +from gitdb.exc import ( AmbiguousObjectName, BadName, BadObject, @@ -14,7 +41,6 @@ ODBError, ParseError, UnsupportedOperation, - to_hex_sha, ) from git.compat import safe_decode from git.util import remove_password_if_present