diff options
-rw-r--r-- | git/compat.py | 1 | ||||
-rw-r--r-- | git/objects/commit.py | 3 | ||||
-rw-r--r-- | git/objects/fun.py | 5 | ||||
-rw-r--r-- | git/repo/base.py | 5 | ||||
-rw-r--r-- | git/test/test_commit.py | 7 |
5 files changed, 8 insertions, 13 deletions
diff --git a/git/compat.py b/git/compat.py index d3240c26..de8a238b 100644 --- a/git/compat.py +++ b/git/compat.py @@ -13,7 +13,6 @@ import sys from gitdb.utils.encoding import ( - text_type, # @UnusedImport force_bytes, # @UnusedImport force_text # @UnusedImport ) diff --git a/git/objects/commit.py b/git/objects/commit.py index f7201d90..8a84dd69 100644 --- a/git/objects/commit.py +++ b/git/objects/commit.py @@ -24,7 +24,6 @@ from .util import ( parse_actor_and_date, from_timestamp, ) -from git.compat import text_type from time import ( time, @@ -436,7 +435,7 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable): write(b"\n") # write plain bytes, be sure its encoded according to our encoding - if isinstance(self.message, text_type): + if isinstance(self.message, str): write(self.message.encode(self.encoding)) else: write(self.message) diff --git a/git/objects/fun.py b/git/objects/fun.py index 1b6cefa2..9b36712e 100644 --- a/git/objects/fun.py +++ b/git/objects/fun.py @@ -2,8 +2,7 @@ from stat import S_ISDIR from git.compat import ( safe_decode, - defenc, - text_type + defenc ) __all__ = ('tree_to_stream', 'tree_entries_from_data', 'traverse_trees_recursive', @@ -33,7 +32,7 @@ def tree_to_stream(entries, write): # hence we must convert to an utf8 string for it to work properly. # According to my tests, this is exactly what git does, that is it just # takes the input literally, which appears to be utf8 on linux. - if isinstance(name, text_type): + if isinstance(name, str): name = name.encode(defenc) write(b''.join((mode_str, b' ', name, b'\0', binsha))) # END for each item diff --git a/git/repo/base.py b/git/repo/base.py index 2691136e..bca44a72 100644 --- a/git/repo/base.py +++ b/git/repo/base.py @@ -15,7 +15,6 @@ from git.cmd import ( handle_process_output ) from git.compat import ( - text_type, defenc, safe_decode, is_win, @@ -476,7 +475,7 @@ class Repo(object): :return: ``git.Commit``""" if rev is None: return self.head.commit - return self.rev_parse(text_type(rev) + "^0") + return self.rev_parse(str(rev) + "^0") def iter_trees(self, *args, **kwargs): """:return: Iterator yielding Tree objects @@ -498,7 +497,7 @@ class Repo(object): operations might have unexpected results.""" if rev is None: return self.head.commit.tree - return self.rev_parse(text_type(rev) + "^{tree}") + return self.rev_parse(str(rev) + "^{tree}") def iter_commits(self, rev=None, paths='', **kwargs): """A list of Commit objects representing the history of a given ref/commit diff --git a/git/test/test_commit.py b/git/test/test_commit.py index ca84f6d7..e41e80bb 100644 --- a/git/test/test_commit.py +++ b/git/test/test_commit.py @@ -17,7 +17,6 @@ from git import ( Actor, ) from git import Repo -from git.compat import text_type from git.objects.util import tzoffset, utc from git.repo.fun import touch from git.test.lib import ( @@ -142,7 +141,7 @@ class TestCommit(TestBase): self.assertEqual(len(name), 9) special = Actor._from_string(u"%s <something@this.com>" % name) self.assertEqual(special.name, name) - assert isinstance(special.name, text_type) + assert isinstance(special.name, str) def test_traversal(self): start = self.rorepo.commit("a4d06724202afccd2b5c54f81bcf2bf26dea7fff") @@ -286,8 +285,8 @@ class TestCommit(TestBase): # create a commit with unicode in the message, and the author's name # Verify its serialization and deserialization cmt = self.rorepo.commit('0.1.6') - assert isinstance(cmt.message, text_type) # it automatically decodes it as such - assert isinstance(cmt.author.name, text_type) # same here + assert isinstance(cmt.message, str) # it automatically decodes it as such + assert isinstance(cmt.author.name, str) # same here cmt.message = u"üäêèß" self.assertEqual(len(cmt.message), 5) |