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>
This commit is contained in:
parent
142fc4af71
commit
cb30d7a881
|
@ -27,25 +27,6 @@ Style-Guide
|
|||
|
||||
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
|
||||
^^^^
|
||||
The entire codebase adheres to the rules of PEP8.
|
||||
|
|
|
@ -194,8 +194,8 @@ An USB-printer could be defined by::
|
|||
|
||||
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
|
||||
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.
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import six
|
||||
import sys
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
# Check out his github: https://github.com/AdamWhitcroft/climacons
|
||||
|
||||
|
||||
from __future__ import print_function
|
||||
from datetime import datetime
|
||||
import calendar
|
||||
import urllib
|
||||
|
|
|
@ -63,10 +63,6 @@ tests_require =
|
|||
verbosity=3
|
||||
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]
|
||||
exclude = .git,.tox,.github,.eggs,__pycache__,doc/conf.py,build,dist,capabilities-data,test,src/escpos/constants.py
|
||||
max-line-length = 120
|
||||
|
|
4
setup.py
4
setup.py
|
@ -22,10 +22,6 @@ setuptools_scm_template = """\
|
|||
# coding: utf-8
|
||||
# file generated by setuptools_scm
|
||||
# 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}'
|
||||
"""
|
||||
|
|
|
@ -2,10 +2,6 @@
|
|||
"""
|
||||
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"]
|
||||
|
||||
|
|
|
@ -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
|
||||
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 appdirs
|
||||
|
|
|
@ -11,10 +11,6 @@ moved to `capabilities` as in `escpos-php by @mike42 <https://github.com/mike42/
|
|||
:license: MIT
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import six
|
||||
|
||||
|
|
|
@ -10,10 +10,6 @@ This module contains the abstract base class :py:class:`Escpos`.
|
|||
:license: MIT
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import qrcode
|
||||
import textwrap
|
||||
|
|
|
@ -25,11 +25,6 @@ Result/Exit codes:
|
|||
:license: MIT
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
class Error(Exception):
|
||||
""" Base class for ESC/POS errors """
|
||||
|
|
|
@ -8,10 +8,6 @@ This module contains the image format handler :py:class:`EscposImage`.
|
|||
:license: MIT
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import math
|
||||
from PIL import Image, ImageOps
|
||||
|
|
|
@ -4,11 +4,6 @@
|
|||
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:
|
||||
import jaconv
|
||||
|
|
|
@ -12,10 +12,6 @@ The code is based on the encoding-code in py-xml-escpos by @fvdsn.
|
|||
: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 .constants import CODEPAGE_CHANGE
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
:license: MIT
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
import serial
|
||||
import socket
|
||||
|
|
|
@ -7,10 +7,6 @@
|
|||
: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
|
||||
|
||||
|
|
|
@ -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 sys
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
#!/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
|
||||
from escpos.constants import BARCODE_TYPE_A, BARCODE_TYPE_B
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
#!/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
|
||||
from escpos.exceptions import CashDrawerError
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
#!/usr/bin/python
|
||||
# -*- 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 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
|
||||
|
||||
|
|
|
@ -7,10 +7,6 @@
|
|||
:license: MIT
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import pytest
|
||||
|
||||
|
|
|
@ -7,10 +7,6 @@
|
|||
: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
|
||||
|
||||
|
|
|
@ -7,10 +7,6 @@
|
|||
: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
|
||||
|
||||
|
|
|
@ -7,10 +7,6 @@
|
|||
: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
|
||||
import pytest
|
||||
|
|
|
@ -8,10 +8,6 @@
|
|||
:license: MIT
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import pytest
|
||||
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
|
||||
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
#!/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 pytest
|
||||
|
|
|
@ -7,10 +7,6 @@
|
|||
:license: MIT
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import pytest
|
||||
import mock
|
||||
|
|
|
@ -7,10 +7,6 @@
|
|||
: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
|
||||
|
||||
|
|
|
@ -8,10 +8,6 @@
|
|||
:license: MIT
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import pytest
|
||||
from nose.tools import raises, assert_raises
|
||||
|
|
|
@ -8,10 +8,6 @@
|
|||
:license: MIT
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import six
|
||||
|
||||
|
|
|
@ -7,10 +7,6 @@
|
|||
:license: MIT
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import pytest
|
||||
import escpos
|
||||
|
|
|
@ -7,10 +7,6 @@
|
|||
: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.escpos as escpos
|
||||
|
|
Loading…
Reference in New Issue