remove some six usage
This commit is contained in:
parent
bea4f29d28
commit
35565d5564
@ -11,7 +11,6 @@ from tempfile import mkdtemp
|
||||
from typing import Any, Dict, Optional, Type
|
||||
|
||||
import importlib_resources
|
||||
import six
|
||||
import yaml
|
||||
|
||||
logging.basicConfig()
|
||||
@ -113,7 +112,7 @@ class BaseProfile(object):
|
||||
Makes sure that the requested `font` is valid.
|
||||
"""
|
||||
font = {"a": 0, "b": 1}.get(font, font)
|
||||
if not six.text_type(font) in self.fonts:
|
||||
if not str(font) in self.fonts:
|
||||
raise NotSupported(
|
||||
'"{}" is not a valid font in the current profile'.format(font)
|
||||
)
|
||||
@ -122,7 +121,7 @@ class BaseProfile(object):
|
||||
def get_columns(self, font):
|
||||
"""Return the number of columns for the given font."""
|
||||
font = self.get_font(font)
|
||||
return self.fonts[six.text_type(font)]["columns"]
|
||||
return self.fonts[str(font)]["columns"]
|
||||
|
||||
def supports(self, feature):
|
||||
"""Return true/false for the given feature."""
|
||||
|
@ -20,8 +20,6 @@ except ImportError:
|
||||
pass # noqa
|
||||
import sys
|
||||
|
||||
import six
|
||||
|
||||
from . import config
|
||||
from . import printer as escpos_printer_module
|
||||
from . import version
|
||||
@ -581,7 +579,7 @@ def main():
|
||||
parser.print_help()
|
||||
sys.exit()
|
||||
command_arguments = dict(
|
||||
[k, v] for k, v in six.iteritems(args_dict) if v is not None
|
||||
[k, v] for k, v in args_dict.items() if v is not None
|
||||
)
|
||||
|
||||
# If version should be printed, do this, then exit
|
||||
|
@ -866,8 +866,7 @@ class Escpos(object):
|
||||
:param txt: text to be printed
|
||||
:raises: :py:exc:`~escpos.exceptions.TextError`
|
||||
"""
|
||||
txt = six.text_type(txt)
|
||||
self.magic.write(txt)
|
||||
self.magic.write(str(txt))
|
||||
|
||||
def textln(self, txt=""):
|
||||
"""Print alpha-numeric text with a newline.
|
||||
@ -1420,7 +1419,7 @@ class EscposIO(object):
|
||||
params = dict(self.params)
|
||||
params.update(kwargs)
|
||||
|
||||
if isinstance(text, six.text_type):
|
||||
if isinstance(text, str):
|
||||
lines = text.split("\n")
|
||||
elif isinstance(text, list) or isinstance(text, tuple):
|
||||
lines = text
|
||||
@ -1433,9 +1432,6 @@ class EscposIO(object):
|
||||
# TODO flush? or on print? (this should prob rather be handled by the _raw-method)
|
||||
for line in lines:
|
||||
self.printer.set(**params)
|
||||
if isinstance(text, six.text_type):
|
||||
self.printer.text("{0}\n".format(line))
|
||||
else:
|
||||
self.printer.text("{0}\n".format(line))
|
||||
|
||||
def close(self):
|
||||
|
@ -292,7 +292,7 @@ class MagicEncode(object):
|
||||
|
||||
def write_with_encoding(self, encoding, text):
|
||||
"""Write the text and inject necessary codepage switches."""
|
||||
if text is not None and type(text) is not six.text_type:
|
||||
if text is not None and type(text) is not str:
|
||||
raise Error(
|
||||
"The supplied text has to be unicode, but is of type {type}.".format(
|
||||
type=type(text)
|
||||
|
@ -1,5 +1,3 @@
|
||||
import six
|
||||
|
||||
import escpos.printer as printer
|
||||
from escpos.constants import GS
|
||||
|
||||
@ -8,5 +6,5 @@ def test_cut_without_feed():
|
||||
"""Test cut without feeding paper"""
|
||||
instance = printer.Dummy()
|
||||
instance.cut(feed=False)
|
||||
expected = GS + b"V" + six.int2byte(66) + b"\x00"
|
||||
expected = GS + b"V" + bytes((66,)) + b"\x00"
|
||||
assert instance.output == expected
|
||||
|
Loading…
x
Reference in New Issue
Block a user