Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit55fd173

Browse files
Harmon758Byron
authored andcommitted
Remove and replace compat.text_type
1 parent768b9ff commit55fd173

File tree

5 files changed

+8
-13
lines changed

5 files changed

+8
-13
lines changed

‎git/compat.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414

1515
fromgitdb.utils.encodingimport (
16-
text_type,# @UnusedImport
1716
force_bytes,# @UnusedImport
1817
force_text# @UnusedImport
1918
)

‎git/objects/commit.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
parse_actor_and_date,
2525
from_timestamp,
2626
)
27-
fromgit.compatimporttext_type
2827

2928
fromtimeimport (
3029
time,
@@ -436,7 +435,7 @@ def _serialize(self, stream):
436435
write(b"\n")
437436

438437
# write plain bytes, be sure its encoded according to our encoding
439-
ifisinstance(self.message,text_type):
438+
ifisinstance(self.message,str):
440439
write(self.message.encode(self.encoding))
441440
else:
442441
write(self.message)

‎git/objects/fun.py‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
fromstatimportS_ISDIR
33
fromgit.compatimport (
44
safe_decode,
5-
defenc,
6-
text_type
5+
defenc
76
)
87

98
__all__= ('tree_to_stream','tree_entries_from_data','traverse_trees_recursive',
@@ -33,7 +32,7 @@ def tree_to_stream(entries, write):
3332
# hence we must convert to an utf8 string for it to work properly.
3433
# According to my tests, this is exactly what git does, that is it just
3534
# takes the input literally, which appears to be utf8 on linux.
36-
ifisinstance(name,text_type):
35+
ifisinstance(name,str):
3736
name=name.encode(defenc)
3837
write(b''.join((mode_str,b' ',name,b'\0',binsha)))
3938
# END for each item

‎git/repo/base.py‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
handle_process_output
1616
)
1717
fromgit.compatimport (
18-
text_type,
1918
defenc,
2019
safe_decode,
2120
is_win,
@@ -476,7 +475,7 @@ def commit(self, rev=None):
476475
:return: ``git.Commit``"""
477476
ifrevisNone:
478477
returnself.head.commit
479-
returnself.rev_parse(text_type(rev)+"^0")
478+
returnself.rev_parse(str(rev)+"^0")
480479

481480
defiter_trees(self,*args,**kwargs):
482481
""":return: Iterator yielding Tree objects
@@ -498,7 +497,7 @@ def tree(self, rev=None):
498497
operations might have unexpected results."""
499498
ifrevisNone:
500499
returnself.head.commit.tree
501-
returnself.rev_parse(text_type(rev)+"^{tree}")
500+
returnself.rev_parse(str(rev)+"^{tree}")
502501

503502
defiter_commits(self,rev=None,paths='',**kwargs):
504503
"""A list of Commit objects representing the history of a given ref/commit

‎git/test/test_commit.py‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
Actor,
1818
)
1919
fromgitimportRepo
20-
fromgit.compatimporttext_type
2120
fromgit.objects.utilimporttzoffset,utc
2221
fromgit.repo.funimporttouch
2322
fromgit.test.libimport (
@@ -142,7 +141,7 @@ def test_unicode_actor(self):
142141
self.assertEqual(len(name),9)
143142
special=Actor._from_string(u"%s <something@this.com>"%name)
144143
self.assertEqual(special.name,name)
145-
assertisinstance(special.name,text_type)
144+
assertisinstance(special.name,str)
146145

147146
deftest_traversal(self):
148147
start=self.rorepo.commit("a4d06724202afccd2b5c54f81bcf2bf26dea7fff")
@@ -286,8 +285,8 @@ def test_serialization_unicode_support(self):
286285
# create a commit with unicode in the message, and the author's name
287286
# Verify its serialization and deserialization
288287
cmt=self.rorepo.commit('0.1.6')
289-
assertisinstance(cmt.message,text_type)# it automatically decodes it as such
290-
assertisinstance(cmt.author.name,text_type)# same here
288+
assertisinstance(cmt.message,str)# it automatically decodes it as such
289+
assertisinstance(cmt.author.name,str)# same here
291290

292291
cmt.message=u"üäêèß"
293292
self.assertEqual(len(cmt.message),5)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp