From 70d4da13640a138f0ebd030963b996e25830f1c3 Mon Sep 17 00:00:00 2001 From: Patrick Kanzler Date: Wed, 19 Apr 2023 22:11:09 +0200 Subject: [PATCH] format with black --- doc/conf.py | 16 ++++++++-------- examples/weather.py | 2 +- src/escpos/escpos.py | 2 +- src/escpos/magicencode.py | 2 +- test/test_magicencode.py | 10 +++++----- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index 24d0b05..33290d6 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -66,8 +66,8 @@ source_suffix = ".rst" master_doc = "index" # General information about the project. -project = u"python-escpos" -copyright = u"2016, Manuel F Martinez and others" +project = "python-escpos" +copyright = "2016, Manuel F Martinez and others" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -229,8 +229,8 @@ latex_documents = [ ( "index", "python-escpos.tex", - u"python-escpos Documentation", - u"Manuel F Martinez and others", + "python-escpos Documentation", + "Manuel F Martinez and others", "manual", ), ] @@ -264,8 +264,8 @@ man_pages = [ ( "index", "python-escpos", - u"python-escpos Documentation", - [u"Manuel F Martinez and others"], + "python-escpos Documentation", + ["Manuel F Martinez and others"], 1, ) ] @@ -283,8 +283,8 @@ texinfo_documents = [ ( "index", "python-escpos", - u"python-escpos Documentation", - u"Manuel F Martinez and others", + "python-escpos Documentation", + "Manuel F Martinez and others", "python-escpos", "One line description of project.", "Miscellaneous", diff --git a/examples/weather.py b/examples/weather.py index 2584a4d..033f3b9 100644 --- a/examples/weather.py +++ b/examples/weather.py @@ -68,7 +68,7 @@ def forecast(idx): printer.text(deg) printer.text("\n") # take care of pesky unicode dash - printer.text(cond.replace(u"\u2013", "-").encode("utf-8")) + printer.text(cond.replace("\u2013", "-").encode("utf-8")) printer.text("\n \n") diff --git a/src/escpos/escpos.py b/src/escpos/escpos.py index c714d31..4ee6026 100644 --- a/src/escpos/escpos.py +++ b/src/escpos/escpos.py @@ -1078,7 +1078,7 @@ class EscposIO(object): for line in lines: self.printer.set(**params) if isinstance(text, six.text_type): - self.printer.text(u"{0}\n".format(line)) + self.printer.text("{0}\n".format(line)) else: self.printer.text("{0}\n".format(line)) diff --git a/src/escpos/magicencode.py b/src/escpos/magicencode.py index 3e37f03..4b6f9cb 100644 --- a/src/escpos/magicencode.py +++ b/src/escpos/magicencode.py @@ -77,7 +77,7 @@ class Encoder(object): assert len(encodable_chars) == 128 return encodable_chars elif "python_encode" in codepage: - encodable_chars = [u" "] * 128 + encodable_chars = [" "] * 128 for i in range(0, 128): codepoint = i + 128 try: diff --git a/test/test_magicencode.py b/test/test_magicencode.py index f45e1f0..5debbbe 100644 --- a/test/test_magicencode.py +++ b/test/test_magicencode.py @@ -24,13 +24,13 @@ class TestEncoder: """ def test_can_encode(self): - assert not Encoder({"CP437": 1}).can_encode("CP437", u"€") - assert Encoder({"CP437": 1}).can_encode("CP437", u"á") + assert not Encoder({"CP437": 1}).can_encode("CP437", "€") + assert Encoder({"CP437": 1}).can_encode("CP437", "á") assert not Encoder({"foobar": 1}).can_encode("foobar", "a") def test_find_suitable_encoding(self): - assert not Encoder({"CP437": 1}).find_suitable_encoding(u"€") - assert Encoder({"CP858": 1}).find_suitable_encoding(u"€") == "CP858" + assert not Encoder({"CP437": 1}).find_suitable_encoding("€") + assert Encoder({"CP858": 1}).find_suitable_encoding("€") == "CP858" @raises(ValueError) def test_get_encoding(self): @@ -90,7 +90,7 @@ class TestMagicEncode: encoder=Encoder({"CP437": 1}), encoding="CP437", ) - encode.write(u"€ ist teuro.") + encode.write("€ ist teuro.") assert driver.output == b"_ ist teuro." class TestForceEncoding: