diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2016-10-17 15:15:22 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2016-10-17 15:18:47 +1300 |
commit | 8360f70024330eeeb5c53d29e4a05194f872b511 (patch) | |
tree | 6bbdcfe54fcce1e41660ca07c9470f42debdec5b /netlib/websockets/frame.py | |
parent | 4918feb7252c76c95d85cd8b2b0334a22aaae274 (diff) | |
download | mitmproxy-8360f70024330eeeb5c53d29e4a05194f872b511.tar.gz mitmproxy-8360f70024330eeeb5c53d29e4a05194f872b511.tar.bz2 mitmproxy-8360f70024330eeeb5c53d29e4a05194f872b511.zip |
First-order conversion to Python3-only
- Zap various occurrences of Python2 in docs and scripts
- Remove six from netlib, and some other places where obvious project-wide
search and replace works.
Diffstat (limited to 'netlib/websockets/frame.py')
-rw-r--r-- | netlib/websockets/frame.py | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/netlib/websockets/frame.py b/netlib/websockets/frame.py index e62d0e87..2b36d461 100644 --- a/netlib/websockets/frame.py +++ b/netlib/websockets/frame.py @@ -3,8 +3,6 @@ import os import struct import io -import six - from netlib import tcp from netlib import strutils from netlib import utils @@ -129,7 +127,7 @@ class FrameHeader(object): second_byte = utils.setbit(self.length_code, 7, self.mask) - b = six.int2byte(first_byte) + six.int2byte(second_byte) + b = bytes([first_byte, second_byte]) if self.payload_length < 126: pass @@ -148,17 +146,12 @@ class FrameHeader(object): b += self.masking_key return b - if six.PY2: - __str__ = __bytes__ - @classmethod def from_file(cls, fp): """ read a websockets frame header """ - first_byte = six.byte2int(fp.safe_read(1)) - second_byte = six.byte2int(fp.safe_read(1)) - + first_byte, second_byte = fp.safe_read(2) fin = utils.getbit(first_byte, 7) rsv1 = utils.getbit(first_byte, 6) rsv2 = utils.getbit(first_byte, 5) @@ -257,9 +250,6 @@ class Frame(object): b += self.payload return b - if six.PY2: - __str__ = __bytes__ - @classmethod def from_file(cls, fp): """ |