Skip to content

Commit 1b9d3b9

Browse files
committed
Removed 'from X import *' whereever possible
1 parent c80d727 commit 1b9d3b9

24 files changed

+209
-67
lines changed

git/test/lib/__init__.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
66

77
import inspect
8-
from mock import *
9-
from asserts import *
10-
from helper import *
8+
from .asserts import *
9+
from .helper import *
1110

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

git/test/lib/asserts.py

+16-4
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,27 @@
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
66

77
import re
8-
from nose import tools
9-
from nose.tools import *
108
import stat
119

1210
__all__ = ['assert_instance_of', 'assert_not_instance_of',
1311
'assert_none', 'assert_not_none',
1412
'assert_match', 'assert_not_match', 'assert_mode_644',
15-
'assert_mode_755'] + tools.__all__
16-
13+
'assert_mode_755',
14+
'assert_equal', 'assert_not_equal', 'assert_raises', 'patch', 'raises',
15+
'assert_true', 'assert_false']
16+
17+
from nose.tools import (
18+
assert_equal,
19+
assert_not_equal,
20+
assert_raises,
21+
raises,
22+
assert_true,
23+
assert_false
24+
)
25+
26+
from mock import (
27+
patch
28+
)
1729

1830
def assert_instance_of(expected, actual, msg=None):
1931
"""Verify that object is an instance of expected """

git/test/performance/lib.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"""Contains library functions"""
22
import os
3-
from git.test.lib import *
3+
from git.test.lib import (
4+
TestBase
5+
)
46
from gitdb.test.lib import skip_on_travis_ci
57
import shutil
68
import tempfile

git/test/performance/test_commit.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
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-
from lib import *
8-
from git import *
7+
from .lib import TestBigRepoRW
8+
from git import Commit
99
from gitdb import IStream
1010
from git.test.test_commit import assert_commit_serialization
1111
from cStringIO import StringIO

git/test/performance/test_odb.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from time import time
44
import sys
55

6-
from lib import (
6+
from .lib import (
77
TestBigRepoR
88
)
99

git/test/performance/test_streams.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
"""Performance data streaming performance"""
2-
3-
from git.test.lib import *
4-
from gitdb import *
5-
from gitdb.util import bin_to_hex
6-
72
from time import time
83
import os
94
import sys
105
import subprocess
116

7+
from git.test.lib import (
8+
with_rw_repo
9+
)
10+
from gitdb.util import bin_to_hex
1211
from gitdb.test.lib import make_memory_file
1312

14-
from lib import (
13+
from .lib import (
1514
TestBigRepoR
1615
)
1716

17+
from gitdb import (
18+
LooseObjectDB,
19+
IStream
20+
)
1821

1922
class TestObjDBPerformance(TestBigRepoR):
2023

git/test/performance/test_utils.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from time import time
33
import sys
44

5-
from lib import (
5+
from .lib import (
66
TestBigRepoR
77
)
88

@@ -93,14 +93,14 @@ def test_instantiation(self):
9393
# tuple and tuple direct
9494
st = time()
9595
for i in xrange(ni):
96-
t = (1, 2, 3, 4)
96+
(1, 2, 3, 4)
9797
# END for each item
9898
elapsed = time() - st
9999
print >> sys.stderr, "Created %i tuples (1,2,3,4) in %f s ( %f tuples / s)" % (ni, elapsed, ni / elapsed)
100100

101101
st = time()
102102
for i in xrange(ni):
103-
t = tuple((1, 2, 3, 4))
103+
tuple((1, 2, 3, 4))
104104
# END for each item
105105
elapsed = time() - st
106106
print >> sys.stderr, "Created %i tuples tuple((1,2,3,4)) in %f s ( %f tuples / s)" % (ni, elapsed, ni / elapsed)

git/test/test_actor.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
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-
from git.test.lib import *
8-
from git import *
9-
7+
from git.test.lib import assert_equal
8+
from git import Actor
109

1110
class TestActor(object):
1211

git/test/test_base.py

+12-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,18 @@
77
import git.objects.base as base
88
import os
99

10-
from git.test.lib import *
11-
from git import *
10+
from git.test.lib import (
11+
TestBase,
12+
assert_raises,
13+
with_rw_repo,
14+
with_rw_and_rw_remote_repo
15+
)
16+
from git import (
17+
Blob,
18+
Tree,
19+
Commit,
20+
TagObject
21+
)
1222
from git.objects.util import get_object_type_by_name
1323
from gitdb.util import hex_to_bin
1424

git/test/test_blob.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
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-
from git.test.lib import *
8-
from git import *
7+
from git.test.lib import (
8+
TestBase,
9+
assert_equal
10+
)
11+
from git import Blob
912

1013

1114
class TestBlob(TestBase):

git/test/test_commit.py

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

8-
from git.test.lib import *
9-
from git import *
8+
from git.test.lib import (
9+
TestBase,
10+
assert_equal,
11+
assert_not_equal,
12+
with_rw_repo,
13+
fixture_path,
14+
StringProcessAdapter
15+
)
16+
from git import (
17+
Commit,
18+
Actor,
19+
)
1020
from gitdb import IStream
1121
from gitdb.util import hex_to_bin
1222

git/test/test_config.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@
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-
from git.test.lib import *
8-
from git import *
7+
from git.test.lib import (
8+
TestCase,
9+
fixture_path
10+
)
11+
from git import (
12+
GitConfigParser
13+
)
914
import StringIO
1015
from copy import copy
1116
from ConfigParser import NoSectionError

git/test/test_db.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
#
44
# This module is part of GitPython and is released under
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
6-
from git.test.lib import *
7-
from git.db import *
6+
from git.test.lib import TestBase
7+
from git.db import GitCmdObjectDB
88
from gitdb.util import bin_to_hex
99
from git.exc import BadObject
1010
import os

git/test/test_diff.py

+13-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,19 @@
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-
from git.test.lib import *
8-
from git import *
9-
7+
from git.test.lib import (
8+
TestBase,
9+
StringProcessAdapter,
10+
fixture,
11+
assert_equal,
12+
assert_true,
13+
14+
)
15+
16+
from git import (
17+
Diff,
18+
DiffIndex
19+
)
1020

1121
class TestDiff(TestBase):
1222

git/test/test_fun.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
from git.test.lib import *
1+
from git.test.lib import (
2+
TestBase,
3+
with_rw_repo
4+
)
25
from git.objects.fun import (
36
traverse_tree_recursive,
47
traverse_trees_recursive,
@@ -78,7 +81,7 @@ def mktree(self, odb, entries):
7881
@with_rw_repo('0.1.6')
7982
def test_three_way_merge(self, rwrepo):
8083
def mkfile(name, sha, executable=0):
81-
return (sha, S_IFREG | 0644 | executable * 0111, name)
84+
return (sha, S_IFREG | 0o644 | executable * 0o111, name)
8285

8386
def mkcommit(name, sha):
8487
return (sha, S_IFDIR | S_IFLNK, name)

git/test/test_index.py

+17-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,23 @@
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-
from git.test.lib import *
8-
from git import *
7+
from git.test.lib import (
8+
TestBase,
9+
fixture_path,
10+
fixture,
11+
with_rw_repo
12+
)
13+
from git import (
14+
IndexFile,
15+
BlobFilter,
16+
UnmergedEntriesError,
17+
Tree,
18+
Object,
19+
Diff,
20+
GitCommandError,
21+
CheckoutError,
22+
23+
)
924
from gitdb.util import hex_to_bin
1025
import os
1126
import sys

git/test/test_reflog.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
from git.test.lib import *
1+
from git.test.lib import (
2+
TestBase,
3+
fixture_path
4+
)
25
from git.objects import IndexObject
3-
from git.refs import *
6+
from git.refs import (
7+
RefLogEntry,
8+
RefLog
9+
)
410
from git.util import Actor
511

612
import tempfile

git/test/test_refs.py

+14-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,20 @@
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-
from mock import *
8-
from git.test.lib import *
9-
from git import *
7+
from git.test.lib import (
8+
TestBase,
9+
with_rw_repo
10+
)
11+
from git import (
12+
Reference,
13+
Head,
14+
TagReference,
15+
RemoteReference,
16+
Commit,
17+
SymbolicReference,
18+
GitCommandError,
19+
RefLog
20+
)
1021
import git.refs as refs
1122
from git.util import Actor
1223
from git.objects.tag import TagObject

git/test/test_remote.py

+18-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,24 @@
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-
from git.test.lib import *
8-
from git import *
7+
from git.test.lib import (
8+
TestBase,
9+
with_rw_repo,
10+
with_rw_and_rw_remote_repo
11+
)
12+
from git import (
13+
RemoteProgress,
14+
FetchInfo,
15+
Reference,
16+
SymbolicReference,
17+
Head,
18+
Commit,
19+
PushInfo,
20+
RemoteReference,
21+
TagReference,
22+
Remote,
23+
GitCommandError
24+
)
925
from git.util import IterableList
1026
import tempfile
1127
import shutil

git/test/test_repo.py

+24-9
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,30 @@
33
#
44
# This module is part of GitPython and is released under
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
6-
from git.test.lib import (patch,
7-
TestBase,
8-
with_rw_repo,
9-
fixture,
10-
assert_false,
11-
assert_equal,
12-
assert_true,
13-
raises)
14-
from git import *
6+
from git.test.lib import (
7+
patch,
8+
TestBase,
9+
with_rw_repo,
10+
fixture,
11+
assert_false,
12+
assert_equal,
13+
assert_true,
14+
raises
15+
)
16+
from git import (
17+
InvalidGitRepositoryError,
18+
Repo,
19+
NoSuchPathError,
20+
Head,
21+
Commit,
22+
Tree,
23+
IndexFile,
24+
Git,
25+
Reference,
26+
GitDB,
27+
Submodule,
28+
GitCmdObjectDB
29+
)
1530
from git.util import join_path_native
1631
from git.exc import BadObject
1732
from gitdb.util import bin_to_hex

0 commit comments

Comments
 (0)