From e814396bd848b27160ed2f6c65254d72739759f7 Mon Sep 17 00:00:00 2001 From: Patrick Kanzler Date: Sun, 19 Jun 2016 11:51:52 +0200 Subject: [PATCH] refactor: simplified expressions, remove unused import --- escpos/escpos.py | 6 +++--- escpos/printer.py | 2 -- test/test_image.py | 2 +- test/test_with_statement.py | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/escpos/escpos.py b/escpos/escpos.py index b0d25ef..40137f7 100644 --- a/escpos/escpos.py +++ b/escpos/escpos.py @@ -196,7 +196,7 @@ class Escpos(object): outp = b'' for _ in range(0, out_bytes): outp += six.int2byte(inp_number % 256) - inp_number = inp_number // 256 + inp_number //= 256 return outp def charcode(self, code): @@ -481,12 +481,12 @@ class Escpos(object): else: raise SetVariableError() # Upside down - if flip == True: + if flip: self._raw(TXT_FLIP_ON) else: self._raw(TXT_FLIP_OFF) # Smoothing - if smooth == True: + if smooth: self._raw(TXT_SMOOTH_ON) else: self._raw(TXT_SMOOTH_OFF) diff --git a/escpos/printer.py b/escpos/printer.py index 654b995..b6ef158 100644 --- a/escpos/printer.py +++ b/escpos/printer.py @@ -277,8 +277,6 @@ class Dummy(Escpos): def __init__(self, *args, **kwargs): """ - - :param devfile : Device file under dev filesystem """ Escpos.__init__(self, *args, **kwargs) self._output_list = [] diff --git a/test/test_image.py b/test/test_image.py index fd49797..dbfe5b0 100644 --- a/test/test_image.py +++ b/test/test_image.py @@ -54,4 +54,4 @@ def _load_and_check_img(filename, width_expected, height_expected, raster_format i = 0 for row in im.to_column_format(False): assert(row == column_format_expected[i]) - i = i + 1 + i += 1 diff --git a/test/test_with_statement.py b/test/test_with_statement.py index a59a719..71efc24 100644 --- a/test/test_with_statement.py +++ b/test/test_with_statement.py @@ -14,7 +14,7 @@ from __future__ import unicode_literals import escpos.printer as printer import escpos.escpos as escpos -import os + def test_with_statement(): """Use with statement"""