diff --git a/.travis.yml b/.travis.yml index 0932316..78fa8ad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,6 +25,8 @@ matrix: env: TOXENV=pypy3 - python: 2.7 env: TOXENV=docs + - python: 3.4 + env: TOXENV=flake8 allow_failures: - python: 3.5-dev - python: nightly diff --git a/setup.cfg b/setup.cfg index 95c89af..ea43f22 100644 --- a/setup.cfg +++ b/setup.cfg @@ -9,3 +9,4 @@ 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 +# future-imports = absolute_import, division, print_function, unicode_literals # we are not there yet diff --git a/setup.py b/setup.py index adcac2a..c699c5a 100755 --- a/setup.py +++ b/setup.py @@ -50,6 +50,9 @@ 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}' diff --git a/src/escpos/cli.py b/src/escpos/cli.py index 62742dd..dad2dfb 100644 --- a/src/escpos/cli.py +++ b/src/escpos/cli.py @@ -33,9 +33,11 @@ def str_to_bool(string): """ return string.lower() in ('y', 'yes', '1', 'true') + # A list of functions that work better with a newline to be sent after them. REQUIRES_NEWLINE = ('qr', 'barcode', 'text', 'block_text') + # Used in demo method # Key: The name of escpos function and the argument passed on the CLI. Some # manual translation is done in the case of barcodes_a -> barcode. @@ -568,5 +570,6 @@ def demo(printer, **kwargs): command(**params) printer.cut() + if __name__ == '__main__': main() diff --git a/src/escpos/codepages.py b/src/escpos/codepages.py index e22e1d0..ca63ef3 100644 --- a/src/escpos/codepages.py +++ b/src/escpos/codepages.py @@ -20,4 +20,5 @@ class CodePageManager: def get_encoding(self, encoding): return self.data[encoding] + CodePages = CodePageManager(CAPABILITIES['encodings']) diff --git a/tox.ini b/tox.ini index f2d6389..5dc5d64 100644 --- a/tox.ini +++ b/tox.ini @@ -22,5 +22,6 @@ commands = sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html [testenv:flake8] basepython = python +# TODO add flake8-future deps = flake8 commands = flake8