Skip to content

Commit

Permalink
Clean up __all__ in main, and explicit imports in exc
Browse files Browse the repository at this point in the history
- explicit imports in exc added to avoid linting errors in __init__
  • Loading branch information
DeflateAwning committed Oct 6, 2023
1 parent c862845 commit 8edc53b
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 13 deletions.
88 changes: 77 additions & 11 deletions git/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,83 @@ def _init_externals() -> None:

# __all__ must be statically defined by py.typed support
# __all__ = [name for name, obj in locals().items() if not (name.startswith("_") or inspect.ismodule(obj))]
__all__ = ['BadName', 'safe_decode',
'remove_password_if_present', 'List', 'Sequence', 'Tuple', 'Union', 'TYPE_CHECKING',
'PathLike', 'GitError', 'InvalidGitRepositoryError', 'WorkTreeRepositoryUnsupported',
'NoSuchPathError', 'UnsafeProtocolError', 'UnsafeOptionError', 'CommandError', 'GitCommandNotFound',
'GitCommandError', 'CheckoutError', 'CacheError', 'UnmergedEntriesError', 'HookExecutionError',
'RepositoryDirtyError', 'Optional', 'GitConfigParser', 'Object', 'IndexObject', 'Blob', 'Commit',
'Submodule', 'UpdateProgress', 'RootModule', 'RootUpdateProgress', 'TagObject', 'TreeModifier',
'Tree', 'SymbolicReference', 'Reference', 'HEAD', 'Head', 'TagReference', 'Tag', 'RemoteReference',
'RefLog', 'RefLogEntry', 'Diffable', 'DiffIndex', 'Diff', 'NULL_TREE', 'GitCmdObjectDB', 'GitDB',
'Git', 'Repo', 'RemoteProgress', 'PushInfo', 'FetchInfo', 'Remote', 'IndexFile', 'StageType',
'BlobFilter', 'BaseIndexEntry', 'IndexEntry', 'LockFile', 'BlockingLockFile', 'Stats', 'Actor', 'rmtree']
__all__ = [
'Actor',
'AmbiguousObjectName',
'BadName',
'BadObject',
'BadObjectType',
'BaseIndexEntry',
'Blob',
'BlobFilter',
'BlockingLockFile',
'CacheError',
'CheckoutError',
'CommandError',
'Commit',
'Diff',
'DiffIndex',
'Diffable',
'FetchInfo',
'Git',
'GitCmdObjectDB',
'GitCommandError',
'GitCommandNotFound',
'GitConfigParser',
'GitDB',
'GitError',
'HEAD',
'Head',
'HookExecutionError',
'IndexEntry',
'IndexFile',
'IndexObject',
'InvalidDBRoot',
'InvalidGitRepositoryError',
'List',
'LockFile',
'NULL_TREE',
'NoSuchPathError',
'ODBError',
'Object',
'Optional',
'ParseError',
'PathLike',
'PushInfo',
'RefLog',
'RefLogEntry',
'Reference',
'Remote',
'RemoteProgress',
'RemoteReference',
'Repo',
'RepositoryDirtyError',
'RootModule',
'RootUpdateProgress',
'Sequence',
'StageType',
'Stats',
'Submodule',
'SymbolicReference',
'TYPE_CHECKING',
'Tag',
'TagObject',
'TagReference',
'Tree',
'TreeModifier',
'Tuple',
'Union',
'UnmergedEntriesError',
'UnsafeOptionError',
'UnsafeProtocolError',
'UnsupportedOperation',
'UpdateProgress',
'WorkTreeRepositoryUnsupported',
'remove_password_if_present',
'rmtree',
'safe_decode',
'to_hex_sha',
]

# { Initialize git executable path
GIT_OK = None
Expand Down
13 changes: 11 additions & 2 deletions git/exc.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,17 @@
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
""" Module containing all exceptions thrown throughout the git package, """

from gitdb.exc import BadName # NOQA @UnusedWildImport skipcq: PYL-W0401, PYL-W0614
from gitdb.exc import * # NOQA @UnusedWildImport skipcq: PYL-W0401, PYL-W0614
from gitdb.exc import (
AmbiguousObjectName,
BadName,
BadObject,
BadObjectType,
InvalidDBRoot,
ODBError,
ParseError,
UnsupportedOperation,
to_hex_sha,
) # NOQA @UnusedWildImport skipcq: PYL-W0401, PYL-W0614
from git.compat import safe_decode
from git.util import remove_password_if_present

Expand Down

0 comments on commit 8edc53b

Please sign in to comment.