From 8360f70024330eeeb5c53d29e4a05194f872b511 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Mon, 17 Oct 2016 15:15:22 +1300 Subject: 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. --- netlib/websockets/frame.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'netlib/websockets/frame.py') 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): """ -- cgit v1.2.3