Skip to content

Commit 53d94b8

Browse files
trym-bByron
authored andcommitted
Replace wildcard imports with concrete imports
All `from <module> import *` has now been replaced by `from <module> import X, Y, ...`. Contributes to #1349
1 parent 5e73cab commit 53d94b8

File tree

6 files changed

+32
-30
lines changed

6 files changed

+32
-30
lines changed

git/__init__.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
66
# flake8: noqa
77
#@PydevCodeAnalysisIgnore
8-
from git.exc import * # @NoMove @IgnorePep8
8+
from git.exc import GitError, GitCommandError, GitCommandNotFound, UnmergedEntriesError, CheckoutError, InvalidGitRepositoryError, NoSuchPathError, BadName # @NoMove @IgnorePep8
99
import inspect
1010
import os
1111
import sys
@@ -39,16 +39,16 @@ def _init_externals() -> None:
3939
#{ Imports
4040

4141
try:
42-
from git.config import GitConfigParser # @NoMove @IgnorePep8
43-
from git.objects import * # @NoMove @IgnorePep8
44-
from git.refs import * # @NoMove @IgnorePep8
45-
from git.diff import * # @NoMove @IgnorePep8
46-
from git.db import * # @NoMove @IgnorePep8
47-
from git.cmd import Git # @NoMove @IgnorePep8
48-
from git.repo import Repo # @NoMove @IgnorePep8
49-
from git.remote import * # @NoMove @IgnorePep8
50-
from git.index import * # @NoMove @IgnorePep8
51-
from git.util import ( # @NoMove @IgnorePep8
42+
from git.config import GitConfigParser # @NoMove @IgnorePep8
43+
from git.objects import Blob, Commit, Object, Submodule, Tree # @NoMove @IgnorePep8
44+
from git.refs import Head, Reference, RefLog, RemoteReference, SymbolicReference, TagReference # @NoMove @IgnorePep8
45+
from git.diff import Diff, DiffIndex, NULL_TREE # @NoMove @IgnorePep8
46+
from git.db import GitCmdObjectDB, GitDB # @NoMove @IgnorePep8
47+
from git.cmd import Git # @NoMove @IgnorePep8
48+
from git.repo import Repo # @NoMove @IgnorePep8
49+
from git.remote import FetchInfo, PushInfo, Remote, RemoteProgress # @NoMove @IgnorePep8
50+
from git.index import BlobFilter, IndexEntry, IndexFile # @NoMove @IgnorePep8
51+
from git.util import ( # @NoMove @IgnorePep8
5252
LockFile,
5353
BlockingLockFile,
5454
Stats,

git/exc.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
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 BadName, BadObject # NOQA @UnusedWildImport skipcq: PYL-W0401, PYL-W0614
109
from git.compat import safe_decode
1110

1211
# typing ----------------------------------------------------

git/index/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
"""Initialize the index package"""
22
# flake8: noqa
3-
from .base import *
4-
from .typ import *
3+
from .base import IndexFile
4+
from .typ import IndexEntry, BlobFilter

git/objects/__init__.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
# flake8: noqa
55
import inspect
66

7-
from .base import *
8-
from .blob import *
9-
from .commit import *
7+
from .base import Object, IndexObject
8+
from .blob import Blob
9+
from .commit import Commit
1010
from .submodule import util as smutil
11-
from .submodule.base import *
12-
from .submodule.root import *
13-
from .tag import *
14-
from .tree import *
11+
from .submodule.base import Submodule, UpdateProgress
12+
from .submodule.root import RootModule, RootUpdateProgress
13+
from .tag import TagObject
14+
from .tree import Tree
1515
# Fix import dependency - add IndexObject to the util module, so that it can be
1616
# imported by the submodule.base
1717
smutil.IndexObject = IndexObject # type: ignore[attr-defined]

git/refs/__init__.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# flake8: noqa
22
# import all modules in order, fix the names they require
3-
from .symbolic import *
4-
from .reference import *
5-
from .head import *
6-
from .tag import *
7-
from .remote import *
3+
from .symbolic import SymbolicReference
4+
from .reference import Reference
5+
from .head import HEAD, Head
6+
from .tag import TagReference
7+
from .remote import RemoteReference
88

9-
from .log import *
9+
from .log import RefLogEntry, RefLog

test/lib/__init__.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44
# This module is part of GitPython and is released under
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
66

7-
# flake8: noqa
87
import inspect
9-
from .helper import *
8+
9+
from .helper import (GIT_DAEMON_PORT, SkipTest, StringProcessAdapter, TestBase,
10+
TestCase, fixture, fixture_path,
11+
with_rw_and_rw_remote_repo, with_rw_directory,
12+
with_rw_repo)
1013

1114
__all__ = [name for name, obj in locals().items()
1215
if not (name.startswith('_') or inspect.ismodule(obj))]

0 commit comments

Comments
 (0)