Skip to content

Commit

Permalink
Remove builtins / py2 imports (#45)
Browse files Browse the repository at this point in the history
* remove builtins

* remove py2 imports
  • Loading branch information
matmair authored Jun 22, 2024
1 parent 4bbf4b7 commit df4aac8
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 20 deletions.
1 change: 0 additions & 1 deletion brother_ql/backends/generic.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

from builtins import bytes

import logging

Expand Down
2 changes: 0 additions & 2 deletions brother_ql/backends/linux_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
Works on Linux.
"""

from builtins import str

import glob, os, time, select

from .generic import BrotherQLBackendGeneric
Expand Down
2 changes: 0 additions & 2 deletions brother_ql/backends/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
Works cross-platform.
"""

from builtins import str

import socket, time, select

from .generic import BrotherQLBackendGeneric
Expand Down
2 changes: 0 additions & 2 deletions brother_ql/backends/pyusb.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
Install via `pip install pyusb`
"""

from builtins import str, bytes

import time

import usb.core
Expand Down
8 changes: 1 addition & 7 deletions brother_ql/raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
:py:class:`BrotherQLRaster`.
"""

from builtins import bytes

import struct
import logging

Expand All @@ -28,11 +26,7 @@
modesetting

from . import BrotherQLError, BrotherQLUnsupportedCmd, BrotherQLUnknownModel, BrotherQLRasterError

try:
from io import BytesIO
except: # Py2
from cStringIO import StringIO as BytesIO
from io import BytesIO

logger = logging.getLogger(__name__)

Expand Down
7 changes: 1 addition & 6 deletions brother_ql/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
from PIL import Image
from PIL.ImageOps import colorize

from builtins import bytes

logger = logging.getLogger(__name__)

OPCODES = {
Expand Down Expand Up @@ -119,10 +117,7 @@
]

def hex_format(data):
try: # Py3
return ' '.join('{:02X}'.format(byte) for byte in data)
except ValueError: # Py2
return ' '.join('{:02X}'.format(ord(byte)) for byte in data)
return ' '.join('{:02X}'.format(byte) for byte in data)

def chunker(data, raise_exception=False):
"""
Expand Down

0 comments on commit df4aac8

Please sign in to comment.