From cbf887ed027d082dda1240712fd22613bc79377a Mon Sep 17 00:00:00 2001 From: Patrick Kanzler Date: Wed, 19 Apr 2023 20:37:08 +0200 Subject: [PATCH 1/4] adapt confDir config for sphinx integration --- .vscode/settings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index ca826d1..66e4d9e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,5 @@ { - "restructuredtext.confPath": "${workspaceFolder}/doc", + "esbonio.sphinx.confDir": "${workspaceFolder}/doc", "files.watcherExclude": { "**/.git/objects/**": true, "**/.git/subtree-cache/**": true, From 70d4da13640a138f0ebd030963b996e25830f1c3 Mon Sep 17 00:00:00 2001 From: Patrick Kanzler Date: Wed, 19 Apr 2023 22:11:09 +0200 Subject: [PATCH 2/4] 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: From 0a8d8ae6c49783a9785b6f636e34a65e93edaa13 Mon Sep 17 00:00:00 2001 From: Patrick Kanzler Date: Wed, 19 Apr 2023 22:15:47 +0200 Subject: [PATCH 3/4] py311 in tests --- .github/workflows/pythonpackage.yml | 2 +- setup.cfg | 2 +- tox.ini | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index de64106..e0a0145 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] steps: - uses: actions/checkout@v3 diff --git a/setup.cfg b/setup.cfg index ef78c82..96c029c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -18,11 +18,11 @@ classifiers = Operating System :: OS Independent Programming Language :: Python Programming Language :: Python :: 3 - Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 Programming Language :: Python :: Implementation :: CPython Topic :: Software Development :: Libraries :: Python Modules Topic :: Office/Business :: Financial :: Point-Of-Sale diff --git a/tox.ini b/tox.ini index ea27473..73c7671 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py35, py36, py37, py38, py39, py310, docs, flake8 +envlist = py37, py38, py39, py310, py311, docs, flake8 [gh-actions] python = @@ -9,6 +9,7 @@ python = 3.8: py38 3.9: py39 3.10: py310 + 3.11: py311 [testenv] deps = nose From 757fe3328ccd148744ec7e2372f8897d2857de54 Mon Sep 17 00:00:00 2001 From: Patrick Kanzler Date: Wed, 19 Apr 2023 22:18:25 +0200 Subject: [PATCH 4/4] fix passenv --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 73c7671..dbc2a0e 100644 --- a/tox.ini +++ b/tox.ini @@ -23,7 +23,7 @@ deps = nose hypothesis>4 python-barcode commands = pytest --cov escpos -passenv = ESCPOS_CAPABILITIES_PICKLE_DIR ESCPOS_CAPABILITIES_FILE CI TRAVIS TRAVIS_* APPVEYOR APPVEYOR_* CODECOV_* +passenv = ESCPOS_CAPABILITIES_PICKLE_DIR, ESCPOS_CAPABILITIES_FILE, CI, TRAVIS, TRAVIS_*, APPVEYOR, APPVEYOR_*, CODECOV_* [testenv:docs] basepython = python