Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace int2byte from six with string literals or bytes(...) #28748

Merged
merged 1 commit into from
Apr 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions encoding/resources/single-byte-raw.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from six import int2byte

def main(request, response):
response.headers.set(b"Content-Type", b"text/plain;charset=" + request.GET.first(b"label"))
response.content = b"".join(int2byte(byte) for byte in range(255))
response.content = bytes(range(255))
4 changes: 1 addition & 3 deletions xhr/resources/invalid-utf8-html.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from six import int2byte

def main(request, response):
headers = [(b"Content-type", b"text/html;charset=utf-8")]
content = int2byte(0xff)
content = b"\xff"

return headers, content
4 changes: 1 addition & 3 deletions xhr/resources/shift-jis-html.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from six import int2byte

def main(request, response):
headers = [(b"Content-type", b"text/html;charset=shift-jis")]
# Shift-JIS bytes for katakana TE SU TO ('test')
content = int2byte(0x83) + int2byte(0x65) + int2byte(0x83) + int2byte(0x58) + int2byte(0x83) + int2byte(0x67)
content = bytes([0x83, 0x65, 0x83, 0x58, 0x83, 0x67])

return headers, content
4 changes: 1 addition & 3 deletions xhr/resources/win-1252-xml.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from six import int2byte

def main(request, response):
headers = [(b"Content-type", b"application/xml;charset=windows-1252")]
content = b'<' + int2byte(0xff) + b'/>'
content = b'<\xff/>'

return headers, content