Commit Graph

22 Commits

Author SHA1 Message Date
Patrick Kanzler b66dafc90e
improve type annotations in tests (#613) 2023-12-17 01:15:59 +01:00
Alexandre Detiste 66a2e78e16
start removal of six and improve type annotation (#607)
* fix unfinished Python2 -> 3 translation
* remove some six usage
* annotate
* fix regression in Six removal
* mypy: self.enf is always defined
* fix return type of cups.py
* Usb idVendor/idProduct are integers
* self.default_args is always defined
* tweak usb_args, PEP589 is better
* lp.py: reassure mypy
* correctly cast call to CashDrawerError()
* update CUPS test
* add missing close() method in metaclass
* document a bug in typeshed
* query_status() returns bytes as seen in constants.py
* remove more SIX usage
* test examples too
* remove type comment where type is annotated
* adapt behavior of cups printer to match other implementations

---------

Co-authored-by: Patrick Kanzler <dev@pkanzler.de>
Co-authored-by: Patrick Kanzler <4189642+patkan@users.noreply.github.com>
2023-12-16 22:02:24 +01:00
Patrick Kanzler a70e1604d6
Magic encoder: fix codepage usage (#580)
* add unit test for issue pointed out by @scott-r in #570

* swap order of encoder search

As described by @scott-r in
Magic encoder does not use
previously used code pages
when possible #570
Thank you!
2023-10-05 14:55:12 +02:00
Patrick Kanzler fbabd8ed88
Drop Py37, improve typing and docstrings (#544)
Drops Py3.7, improves typing and adds a mypy config, improves the docstrings and isorts the imports.

* configure isort
* sort with isort
* add github action
* enable flake8-docstrings
* fix docstrings
* add mypy env
* no implicit optional
* add type for raw
* add some type hints
2023-08-15 01:03:36 +02:00
Patrick Kanzler 4c2dcdfac6
Clean up tests and migrate (#540)
* migrate
  * abstract base class test
  * remove assert_equal in test_cli
  * remove nose from test_cli
  * remove nose dependencies
  * use tempfile
* configure coverage
  * flag python version in name
  * enable comment
* drop EOL py37
2023-08-10 00:18:02 +02:00
Patrick Kanzler 70d4da1364 format with black 2023-04-19 22:11:09 +02:00
Patrick Kanzler 435f2bba24 reformat codebase 2021-10-30 18:15:22 +02:00
Romain Porte cb30d7a881 drop Python 2.7 support
Python 2.7 EOL is arriving on 2020-01-01: https://pythonclock.org/

This will allow us to use Python 3 only libraries, like python-barcode,
which can maintain a reduced, simpler codebase, due to only one version
to support.

Closes #371.

Signed-off-by: Romain Porte <microjoe@microjoe.org>
2020-05-10 10:55:44 +02:00
Patrick Kanzler 3ee787e8b1
change license to MIT 2017-01-31 03:55:50 +01:00
Patrick Kanzler c2fc464c55
reformat PEP8 and similar issues 2017-01-30 00:10:14 +01:00
Patrick Kanzler e4a21e94fc
improve doc, improve codepage_tables.py 2017-01-29 23:36:33 +01:00
Patrick Kanzler 1b2f509758
use jaconv instead of jcconv for japanese chars
jaconv is available for more Python-versions and seems to be more
professional. Apart from that I added jaconv to the test-requirements
but not the requirements. (If the katakana-stuff really works we can
later add it as a real dependency)
2016-09-27 20:31:39 +02:00
Patrick Kanzler b795c02dd4
DOC remove incode TODOs
I will add them as issues where applicable.
2016-09-27 20:05:24 +02:00
Michael Billington 7b68d97f5f test fixes - just case-changes to match code page names, seems to need 'future' pip module 2016-09-13 20:28:54 +10:00
Michael Billington 9a65945fcd re-work encoder to consult the capabilities database and use custom code pages or python encoder as necessary 2016-09-11 21:03:55 +10:00
Michael Elsdörfer a435b66006 jcconf not available on Python 3. 2016-08-30 18:10:32 +02:00
Michael Elsdörfer 2f89f3fe3a Port to current version of escpos-printer-db. 2016-08-30 17:08:27 +02:00
Michael Elsdörfer c7864fd785 Largely rewrite the magic text encoding feature. 2016-08-27 11:28:52 +02:00
Patrick Kanzler 87a6647053 fix force-encoding REBASE (contains todos)
* fixed the code of forced-encoding in order to make it work
* extended unittest for forced-encoding
* fixed the constant for Katakana-encoding
2016-08-02 04:42:21 +02:00
Patrick Kanzler 046a08896c Ideen für unittest REBASE 2016-08-02 04:42:21 +02:00
Patrick Kanzler 0cfedb5706 add automatic codepage-changing
This code is adapted from the works by Frédéric Van der Essen in
pyxmlescpos.
I had to adapt the code completely in order to make it compatible with
modern unicode-handling

Further changes:
* improve text unittests in CLI and MagicEncode with hypothesis
* add feature force_encoding in order to enable old behaviour
* disable cli_text_test (for now)
* fix charcode(): it does now cooperate with the new structure
* remove redundant variable codepage from class Escpos
2016-08-02 04:42:21 +02:00
Patrick Kanzler 3546e0c4bb improve the exceptions
also adds a stump for the tests for MagicEncode
2016-08-02 04:42:21 +02:00