Merge pull request #392 from MicroJoe/python3-only
drop Python 2.7 support
This commit is contained in:
commit
ab210b5996
|
@ -27,25 +27,6 @@ Style-Guide
|
||||||
|
|
||||||
When writing code please try to stick to these rules.
|
When writing code please try to stick to these rules.
|
||||||
|
|
||||||
Python 2 and 3
|
|
||||||
^^^^^^^^^^^^^^
|
|
||||||
We have rewritten the code in order to maintain compatibility with both Python 2 and Python 3.
|
|
||||||
In order to ensure that we do not miss any accidental degradation, please add these imports to the top
|
|
||||||
of every file of code:
|
|
||||||
|
|
||||||
.. code-block:: Python
|
|
||||||
|
|
||||||
from __future__ import absolute_import
|
|
||||||
from __future__ import division
|
|
||||||
from __future__ import print_function
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
Furthermore please be aware of the differences between Python 2 and 3. For
|
|
||||||
example `this guide <https://docs.python.org/3/howto/pyporting.html>`_ is helpful.
|
|
||||||
Special care has to be taken when dealing with strings and byte-strings. Please note
|
|
||||||
that the :py:meth:`~escpos.escpos.Escpos._raw`-method only accepts byte-strings.
|
|
||||||
Often you can achieve compatibility quite easily with a tool from the `six`-package.
|
|
||||||
|
|
||||||
PEP8
|
PEP8
|
||||||
^^^^
|
^^^^
|
||||||
The entire codebase adheres to the rules of PEP8.
|
The entire codebase adheres to the rules of PEP8.
|
||||||
|
|
|
@ -194,8 +194,8 @@ An USB-printer could be defined by::
|
||||||
|
|
||||||
Printing text right
|
Printing text right
|
||||||
-------------------
|
-------------------
|
||||||
Python-escpos is designed to accept unicode. So make sure that you use ``u'strings'`` or import ``unicode_literals``
|
|
||||||
from ``__future__`` if you are on Python 2. On Python 3 you should be fine.
|
Python-escpos is designed to accept unicode.
|
||||||
|
|
||||||
For normal usage you can simply pass your text to the printers ``text()``-function. It will automatically guess
|
For normal usage you can simply pass your text to the printers ``text()``-function. It will automatically guess
|
||||||
the right codepage and then send the encoded data to the printer. If this feature does not work, please try to
|
the right codepage and then send the encoded data to the printer. If this feature does not work, please try to
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
"""Prints code page tables.
|
"""Prints code page tables.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import print_function
|
|
||||||
|
|
||||||
import six
|
import six
|
||||||
import sys
|
import sys
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
# Check out his github: https://github.com/AdamWhitcroft/climacons
|
# Check out his github: https://github.com/AdamWhitcroft/climacons
|
||||||
|
|
||||||
|
|
||||||
from __future__ import print_function
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import calendar
|
import calendar
|
||||||
import urllib
|
import urllib
|
||||||
|
|
|
@ -63,10 +63,6 @@ tests_require =
|
||||||
verbosity=3
|
verbosity=3
|
||||||
with-doctest=1
|
with-doctest=1
|
||||||
|
|
||||||
[bdist_wheel]
|
|
||||||
# This flag says that the code is written to work on both Python 2 and Python 3.
|
|
||||||
universal=1
|
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
exclude = .git,.tox,.github,.eggs,__pycache__,doc/conf.py,build,dist,capabilities-data,test,src/escpos/constants.py
|
exclude = .git,.tox,.github,.eggs,__pycache__,doc/conf.py,build,dist,capabilities-data,test,src/escpos/constants.py
|
||||||
max-line-length = 120
|
max-line-length = 120
|
||||||
|
|
4
setup.py
4
setup.py
|
@ -22,10 +22,6 @@ setuptools_scm_template = """\
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
# file generated by setuptools_scm
|
# file generated by setuptools_scm
|
||||||
# don't change, don't track in version control
|
# don't change, don't track in version control
|
||||||
from __future__ import absolute_import
|
|
||||||
from __future__ import division
|
|
||||||
from __future__ import print_function
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
version = '{version}'
|
version = '{version}'
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
"""
|
"""
|
||||||
python-escpos enables you to manipulate escpos-printers
|
python-escpos enables you to manipulate escpos-printers
|
||||||
"""
|
"""
|
||||||
from __future__ import absolute_import
|
|
||||||
from __future__ import division
|
|
||||||
from __future__ import print_function
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
__all__ = ["constants", "escpos", "exceptions", "printer"]
|
__all__ = ["constants", "escpos", "exceptions", "printer"]
|
||||||
|
|
||||||
|
|
|
@ -9,10 +9,6 @@ It requires you to have a configuration file. See documentation for details.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import absolute_import
|
|
||||||
from __future__ import division
|
|
||||||
from __future__ import print_function
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -4,10 +4,6 @@ This module contains the implentations of abstract base class :py:class:`Config`
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import absolute_import
|
|
||||||
from __future__ import division
|
|
||||||
from __future__ import print_function
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import appdirs
|
import appdirs
|
||||||
|
|
|
@ -11,10 +11,6 @@ moved to `capabilities` as in `escpos-php by @mike42 <https://github.com/mike42/
|
||||||
:license: MIT
|
:license: MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import absolute_import
|
|
||||||
from __future__ import division
|
|
||||||
from __future__ import print_function
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import six
|
import six
|
||||||
|
|
||||||
|
|
|
@ -10,10 +10,6 @@ This module contains the abstract base class :py:class:`Escpos`.
|
||||||
:license: MIT
|
:license: MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import absolute_import
|
|
||||||
from __future__ import division
|
|
||||||
from __future__ import print_function
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import qrcode
|
import qrcode
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|
|
@ -25,11 +25,6 @@ Result/Exit codes:
|
||||||
:license: MIT
|
:license: MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import absolute_import
|
|
||||||
from __future__ import division
|
|
||||||
from __future__ import print_function
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
|
|
||||||
class Error(Exception):
|
class Error(Exception):
|
||||||
""" Base class for ESC/POS errors """
|
""" Base class for ESC/POS errors """
|
||||||
|
|
|
@ -8,10 +8,6 @@ This module contains the image format handler :py:class:`EscposImage`.
|
||||||
:license: MIT
|
:license: MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import absolute_import
|
|
||||||
from __future__ import division
|
|
||||||
from __future__ import print_function
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import math
|
import math
|
||||||
from PIL import Image, ImageOps
|
from PIL import Image, ImageOps
|
||||||
|
|
|
@ -4,11 +4,6 @@
|
||||||
I doubt that this currently works correctly.
|
I doubt that this currently works correctly.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import absolute_import
|
|
||||||
from __future__ import division
|
|
||||||
from __future__ import print_function
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import jaconv
|
import jaconv
|
||||||
|
|
|
@ -12,10 +12,6 @@ The code is based on the encoding-code in py-xml-escpos by @fvdsn.
|
||||||
:license: MIT
|
:license: MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import absolute_import
|
|
||||||
from __future__ import division
|
|
||||||
from __future__ import print_function
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from builtins import bytes
|
from builtins import bytes
|
||||||
from .constants import CODEPAGE_CHANGE
|
from .constants import CODEPAGE_CHANGE
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
:license: MIT
|
:license: MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
|
||||||
|
|
||||||
import serial
|
import serial
|
||||||
import socket
|
import socket
|
||||||
|
|
|
@ -7,10 +7,6 @@
|
||||||
:license: MIT
|
:license: MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import absolute_import
|
|
||||||
from __future__ import division
|
|
||||||
from __future__ import print_function
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from nose.tools import raises
|
from nose.tools import raises
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import absolute_import
|
|
||||||
from __future__ import division
|
|
||||||
from __future__ import print_function
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
from __future__ import absolute_import
|
|
||||||
from __future__ import division
|
|
||||||
from __future__ import print_function
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import escpos.printer as printer
|
import escpos.printer as printer
|
||||||
from escpos.constants import BARCODE_TYPE_A, BARCODE_TYPE_B
|
from escpos.constants import BARCODE_TYPE_A, BARCODE_TYPE_B
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
from __future__ import absolute_import
|
|
||||||
from __future__ import division
|
|
||||||
from __future__ import print_function
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import escpos.printer as printer
|
import escpos.printer as printer
|
||||||
from escpos.exceptions import CashDrawerError
|
from escpos.exceptions import CashDrawerError
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from __future__ import absolute_import
|
|
||||||
from __future__ import division
|
|
||||||
from __future__ import print_function
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import escpos.printer as printer
|
import escpos.printer as printer
|
||||||
import pytest
|
import pytest
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
from __future__ import absolute_import
|
|
||||||
from __future__ import division
|
|
||||||
from __future__ import print_function
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import six
|
import six
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,6 @@
|
||||||
:license: MIT
|
:license: MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import absolute_import
|
|
||||||
from __future__ import division
|
|
||||||
from __future__ import print_function
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,6 @@
|
||||||
:license: MIT
|
:license: MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import absolute_import
|
|
||||||
from __future__ import division
|
|
||||||
from __future__ import print_function
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import escpos.printer as printer
|
import escpos.printer as printer
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,6 @@
|
||||||
:license: MIT
|
:license: MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import absolute_import
|
|
||||||
from __future__ import division
|
|
||||||
from __future__ import print_function
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import escpos.printer as printer
|
import escpos.printer as printer
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,6 @@
|
||||||
:license: MIT
|
:license: MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import absolute_import
|
|
||||||
from __future__ import division
|
|
||||||
from __future__ import print_function
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from nose.tools import raises
|
from nose.tools import raises
|
||||||
import pytest
|
import pytest
|
||||||
|
|
|
@ -8,10 +8,6 @@
|
||||||
:license: MIT
|
:license: MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import absolute_import
|
|
||||||
from __future__ import division
|
|
||||||
from __future__ import print_function
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
import mock
|
import mock
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
from __future__ import absolute_import
|
|
||||||
from __future__ import division
|
|
||||||
from __future__ import print_function
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import six
|
import six
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
from __future__ import absolute_import
|
|
||||||
from __future__ import division
|
|
||||||
from __future__ import print_function
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import escpos.printer as printer
|
import escpos.printer as printer
|
||||||
import pytest
|
import pytest
|
||||||
|
|
|
@ -7,10 +7,6 @@
|
||||||
:license: MIT
|
:license: MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import absolute_import
|
|
||||||
from __future__ import division
|
|
||||||
from __future__ import print_function
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
import mock
|
import mock
|
||||||
|
|
|
@ -7,10 +7,6 @@
|
||||||
:license: MIT
|
:license: MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import absolute_import
|
|
||||||
from __future__ import division
|
|
||||||
from __future__ import print_function
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import escpos.printer as printer
|
import escpos.printer as printer
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,6 @@
|
||||||
:license: MIT
|
:license: MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import absolute_import
|
|
||||||
from __future__ import division
|
|
||||||
from __future__ import print_function
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from nose.tools import raises, assert_raises
|
from nose.tools import raises, assert_raises
|
||||||
|
|
|
@ -8,10 +8,6 @@
|
||||||
:license: MIT
|
:license: MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import absolute_import
|
|
||||||
from __future__ import division
|
|
||||||
from __future__ import print_function
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import six
|
import six
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,6 @@
|
||||||
:license: MIT
|
:license: MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import absolute_import
|
|
||||||
from __future__ import division
|
|
||||||
from __future__ import print_function
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
import escpos
|
import escpos
|
||||||
|
|
|
@ -7,10 +7,6 @@
|
||||||
:license: MIT
|
:license: MIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import absolute_import
|
|
||||||
from __future__ import division
|
|
||||||
from __future__ import print_function
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import escpos.printer as printer
|
import escpos.printer as printer
|
||||||
import escpos.escpos as escpos
|
import escpos.escpos as escpos
|
||||||
|
|
Loading…
Reference in New Issue