| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 768b9ff commit 55fd173
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,7 +13,6 @@ | |||
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | 15 | from gitdb.utils.encoding import ( | |
| 16 | - text_type, # @UnusedImport | ||
| 17 | 16 | force_bytes, # @UnusedImport | |
| 18 | 17 | force_text # @UnusedImport | |
| 19 | 18 | ) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,7 +24,6 @@ | |||
| 24 | 24 | parse_actor_and_date, | |
| 25 | 25 | from_timestamp, | |
| 26 | 26 | ) | |
| 27 | - from git.compat import text_type | ||
| 28 | 27 | ||
| 29 | 28 | from time import ( | |
| 30 | 29 | time, | |
@@ -436,7 +435,7 @@ def _serialize(self, stream): | |||
| 436 | 435 | write(b"\n") | |
| 437 | 436 | ||
| 438 | 437 | # write plain bytes, be sure its encoded according to our encoding | |
| 439 | - if isinstance(self.message, text_type): | ||
| 438 | + if isinstance(self.message, str): | ||
| 440 | 439 | write(self.message.encode(self.encoding)) | |
| 441 | 440 | else: | |
| 442 | 441 | write(self.message) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,8 +2,7 @@ | |||
| 2 | 2 | from stat import S_ISDIR | |
| 3 | 3 | from git.compat import ( | |
| 4 | 4 | safe_decode, | |
| 5 | - defenc, | ||
| 6 | - text_type | ||
| 5 | + defenc | ||
| 7 | 6 | ) | |
| 8 | 7 | ||
| 9 | 8 | __all__ = ('tree_to_stream', 'tree_entries_from_data', 'traverse_trees_recursive', | |
@@ -33,7 +32,7 @@ def tree_to_stream(entries, write): | |||
| 33 | 32 | # hence we must convert to an utf8 string for it to work properly. | |
| 34 | 33 | # According to my tests, this is exactly what git does, that is it just | |
| 35 | 34 | # takes the input literally, which appears to be utf8 on linux. | |
| 36 | - if isinstance(name, text_type): | ||
| 35 | + if isinstance(name, str): | ||
| 37 | 36 | name = name.encode(defenc) | |
| 38 | 37 | write(b''.join((mode_str, b' ', name, b'\0', binsha))) | |
| 39 | 38 | # END for each item | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,7 +15,6 @@ | |||
| 15 | 15 | handle_process_output | |
| 16 | 16 | ) | |
| 17 | 17 | from git.compat import ( | |
| 18 | - text_type, | ||
| 19 | 18 | defenc, | |
| 20 | 19 | safe_decode, | |
| 21 | 20 | is_win, | |
@@ -476,7 +475,7 @@ def commit(self, rev=None): | |||
| 476 | 475 | :return: ``git.Commit``""" | |
| 477 | 476 | if rev is None: | |
| 478 | 477 | return self.head.commit | |
| 479 | - return self.rev_parse(text_type(rev) + "^0") | ||
| 478 | + return self.rev_parse(str(rev) + "^0") | ||
| 480 | 479 | ||
| 481 | 480 | def iter_trees(self, *args, **kwargs): | |
| 482 | 481 | """:return: Iterator yielding Tree objects | |
@@ -498,7 +497,7 @@ def tree(self, rev=None): | |||
| 498 | 497 | operations might have unexpected results.""" | |
| 499 | 498 | if rev is None: | |
| 500 | 499 | return self.head.commit.tree | |
| 501 | - return self.rev_parse(text_type(rev) + "^{tree}") | ||
| 500 | + return self.rev_parse(str(rev) + "^{tree}") | ||
| 502 | 501 | ||
| 503 | 502 | def iter_commits(self, rev=None, paths='', **kwargs): | |
| 504 | 503 | """A list of Commit objects representing the history of a given ref/commit | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,7 +17,6 @@ | |||
| 17 | 17 | Actor, | |
| 18 | 18 | ) | |
| 19 | 19 | from git import Repo | |
| 20 | - from git.compat import text_type | ||
| 21 | 20 | from git.objects.util import tzoffset, utc | |
| 22 | 21 | from git.repo.fun import touch | |
| 23 | 22 | from git.test.lib import ( | |
@@ -142,7 +141,7 @@ def test_unicode_actor(self): | |||
| 142 | 141 | self.assertEqual(len(name), 9) | |
| 143 | 142 | special = Actor._from_string(u"%s <something@this.com>" % name) | |
| 144 | 143 | self.assertEqual(special.name, name) | |
| 145 | - assert isinstance(special.name, text_type) | ||
| 144 | + assert isinstance(special.name, str) | ||
| 146 | 145 | ||
| 147 | 146 | def test_traversal(self): | |
| 148 | 147 | start = self.rorepo.commit("a4d06724202afccd2b5c54f81bcf2bf26dea7fff") | |
@@ -286,8 +285,8 @@ def test_serialization_unicode_support(self): | |||
| 286 | 285 | # create a commit with unicode in the message, and the author's name | |
| 287 | 286 | # Verify its serialization and deserialization | |
| 288 | 287 | cmt = self.rorepo.commit('0.1.6') | |
| 289 | - assert isinstance(cmt.message, text_type) # it automatically decodes it as such | ||
| 290 | - assert isinstance(cmt.author.name, text_type) # same here | ||
| 288 | + assert isinstance(cmt.message, str) # it automatically decodes it as such | ||
| 289 | + assert isinstance(cmt.author.name, str) # same here | ||
| 291 | 290 | ||
| 292 | 291 | cmt.message = u"üäêèß" | |
| 293 | 292 | self.assertEqual(len(cmt.message), 5) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments