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

Commitc5f3c58

Browse files
Harmon758Byron
authored andcommitted
Remove and replace compat._unichr
1 parentc7392d6 commitc5f3c58

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

‎git/compat.py‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,8 @@ def b(data):
118118
returndata
119119

120120
ifPY3:
121-
_unichr=chr
122121
bytes_chr=lambdacode:bytes((code,))
123122
else:
124-
_unichr=unichr
125123
bytes_chr=chr
126124

127125
defsurrogateescape_handler(exc):
@@ -176,9 +174,9 @@ def replace_surrogate_encode(mystring, exc):
176174
# 0x80 | (code & 0x3f)]
177175
# Is this a good idea?
178176
if0xDC00<=code<=0xDC7F:
179-
decoded.append(_unichr(code-0xDC00))
177+
decoded.append(chr(code-0xDC00))
180178
elifcode<=0xDCFF:
181-
decoded.append(_unichr(code-0xDC00))
179+
decoded.append(chr(code-0xDC00))
182180
else:
183181
raiseNotASurrogateError
184182
returnstr().join(decoded)
@@ -197,9 +195,9 @@ def replace_surrogate_decode(mybytes):
197195
else:
198196
code=ord(ch)
199197
if0x80<=code<=0xFF:
200-
decoded.append(_unichr(0xDC00+code))
198+
decoded.append(chr(0xDC00+code))
201199
elifcode<=0x7F:
202-
decoded.append(_unichr(code))
200+
decoded.append(chr(code))
203201
else:
204202
# # It may be a bad byte
205203
# # Try swallowing it.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp