Skip to content

Commit df4aac8

Browse files
authored
Remove builtins / py2 imports (#45)
* remove builtins * remove py2 imports
1 parent 4bbf4b7 commit df4aac8

File tree

6 files changed

+2
-20
lines changed

6 files changed

+2
-20
lines changed

brother_ql/backends/generic.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11

2-
from builtins import bytes
32

43
import logging
54

brother_ql/backends/linux_kernel.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
Works on Linux.
66
"""
77

8-
from builtins import str
9-
108
import glob, os, time, select
119

1210
from .generic import BrotherQLBackendGeneric

brother_ql/backends/network.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
Works cross-platform.
66
"""
77

8-
from builtins import str
9-
108
import socket, time, select
119

1210
from .generic import BrotherQLBackendGeneric

brother_ql/backends/pyusb.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
Install via `pip install pyusb`
99
"""
1010

11-
from builtins import str, bytes
12-
1311
import time
1412

1513
import usb.core

brother_ql/raster.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
:py:class:`BrotherQLRaster`.
88
"""
99

10-
from builtins import bytes
11-
1210
import struct
1311
import logging
1412

@@ -28,11 +26,7 @@
2826
modesetting
2927

3028
from . import BrotherQLError, BrotherQLUnsupportedCmd, BrotherQLUnknownModel, BrotherQLRasterError
31-
32-
try:
33-
from io import BytesIO
34-
except: # Py2
35-
from cStringIO import StringIO as BytesIO
29+
from io import BytesIO
3630

3731
logger = logging.getLogger(__name__)
3832

brother_ql/reader.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
from PIL import Image
99
from PIL.ImageOps import colorize
1010

11-
from builtins import bytes
12-
1311
logger = logging.getLogger(__name__)
1412

1513
OPCODES = {
@@ -119,10 +117,7 @@
119117
]
120118

121119
def hex_format(data):
122-
try: # Py3
123-
return ' '.join('{:02X}'.format(byte) for byte in data)
124-
except ValueError: # Py2
125-
return ' '.join('{:02X}'.format(ord(byte)) for byte in data)
120+
return ' '.join('{:02X}'.format(byte) for byte in data)
126121

127122
def chunker(data, raise_exception=False):
128123
"""

0 commit comments

Comments
 (0)