Skip to content

Commit 8edc53b

Browse files
committed
Clean up __all__ in main, and explicit imports in exc
- explicit imports in exc added to avoid linting errors in __init__
1 parent c862845 commit 8edc53b

File tree

2 files changed

+88
-13
lines changed

2 files changed

+88
-13
lines changed

git/__init__.py

+77-11
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,83 @@ def _init_externals() -> None:
6363

6464
# __all__ must be statically defined by py.typed support
6565
# __all__ = [name for name, obj in locals().items() if not (name.startswith("_") or inspect.ismodule(obj))]
66-
__all__ = ['BadName', 'safe_decode',
67-
'remove_password_if_present', 'List', 'Sequence', 'Tuple', 'Union', 'TYPE_CHECKING',
68-
'PathLike', 'GitError', 'InvalidGitRepositoryError', 'WorkTreeRepositoryUnsupported',
69-
'NoSuchPathError', 'UnsafeProtocolError', 'UnsafeOptionError', 'CommandError', 'GitCommandNotFound',
70-
'GitCommandError', 'CheckoutError', 'CacheError', 'UnmergedEntriesError', 'HookExecutionError',
71-
'RepositoryDirtyError', 'Optional', 'GitConfigParser', 'Object', 'IndexObject', 'Blob', 'Commit',
72-
'Submodule', 'UpdateProgress', 'RootModule', 'RootUpdateProgress', 'TagObject', 'TreeModifier',
73-
'Tree', 'SymbolicReference', 'Reference', 'HEAD', 'Head', 'TagReference', 'Tag', 'RemoteReference',
74-
'RefLog', 'RefLogEntry', 'Diffable', 'DiffIndex', 'Diff', 'NULL_TREE', 'GitCmdObjectDB', 'GitDB',
75-
'Git', 'Repo', 'RemoteProgress', 'PushInfo', 'FetchInfo', 'Remote', 'IndexFile', 'StageType',
76-
'BlobFilter', 'BaseIndexEntry', 'IndexEntry', 'LockFile', 'BlockingLockFile', 'Stats', 'Actor', 'rmtree']
66+
__all__ = [
67+
'Actor',
68+
'AmbiguousObjectName',
69+
'BadName',
70+
'BadObject',
71+
'BadObjectType',
72+
'BaseIndexEntry',
73+
'Blob',
74+
'BlobFilter',
75+
'BlockingLockFile',
76+
'CacheError',
77+
'CheckoutError',
78+
'CommandError',
79+
'Commit',
80+
'Diff',
81+
'DiffIndex',
82+
'Diffable',
83+
'FetchInfo',
84+
'Git',
85+
'GitCmdObjectDB',
86+
'GitCommandError',
87+
'GitCommandNotFound',
88+
'GitConfigParser',
89+
'GitDB',
90+
'GitError',
91+
'HEAD',
92+
'Head',
93+
'HookExecutionError',
94+
'IndexEntry',
95+
'IndexFile',
96+
'IndexObject',
97+
'InvalidDBRoot',
98+
'InvalidGitRepositoryError',
99+
'List',
100+
'LockFile',
101+
'NULL_TREE',
102+
'NoSuchPathError',
103+
'ODBError',
104+
'Object',
105+
'Optional',
106+
'ParseError',
107+
'PathLike',
108+
'PushInfo',
109+
'RefLog',
110+
'RefLogEntry',
111+
'Reference',
112+
'Remote',
113+
'RemoteProgress',
114+
'RemoteReference',
115+
'Repo',
116+
'RepositoryDirtyError',
117+
'RootModule',
118+
'RootUpdateProgress',
119+
'Sequence',
120+
'StageType',
121+
'Stats',
122+
'Submodule',
123+
'SymbolicReference',
124+
'TYPE_CHECKING',
125+
'Tag',
126+
'TagObject',
127+
'TagReference',
128+
'Tree',
129+
'TreeModifier',
130+
'Tuple',
131+
'Union',
132+
'UnmergedEntriesError',
133+
'UnsafeOptionError',
134+
'UnsafeProtocolError',
135+
'UnsupportedOperation',
136+
'UpdateProgress',
137+
'WorkTreeRepositoryUnsupported',
138+
'remove_password_if_present',
139+
'rmtree',
140+
'safe_decode',
141+
'to_hex_sha',
142+
]
77143

78144
# { Initialize git executable path
79145
GIT_OK = None

git/exc.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,17 @@
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
66
""" Module containing all exceptions thrown throughout the git package, """
77

8-
from gitdb.exc import BadName # NOQA @UnusedWildImport skipcq: PYL-W0401, PYL-W0614
9-
from gitdb.exc import * # NOQA @UnusedWildImport skipcq: PYL-W0401, PYL-W0614
8+
from gitdb.exc import (
9+
AmbiguousObjectName,
10+
BadName,
11+
BadObject,
12+
BadObjectType,
13+
InvalidDBRoot,
14+
ODBError,
15+
ParseError,
16+
UnsupportedOperation,
17+
to_hex_sha,
18+
) # NOQA @UnusedWildImport skipcq: PYL-W0401, PYL-W0614
1019
from git.compat import safe_decode
1120
from git.util import remove_password_if_present
1221

0 commit comments

Comments
 (0)