refactor: simplified expressions, remove unused import

This commit is contained in:
Patrick Kanzler 2016-06-19 11:51:52 +02:00
parent adf73f3790
commit e814396bd8
4 changed files with 5 additions and 7 deletions

View File

@ -196,7 +196,7 @@ class Escpos(object):
outp = b'' outp = b''
for _ in range(0, out_bytes): for _ in range(0, out_bytes):
outp += six.int2byte(inp_number % 256) outp += six.int2byte(inp_number % 256)
inp_number = inp_number // 256 inp_number //= 256
return outp return outp
def charcode(self, code): def charcode(self, code):
@ -481,12 +481,12 @@ class Escpos(object):
else: else:
raise SetVariableError() raise SetVariableError()
# Upside down # Upside down
if flip == True: if flip:
self._raw(TXT_FLIP_ON) self._raw(TXT_FLIP_ON)
else: else:
self._raw(TXT_FLIP_OFF) self._raw(TXT_FLIP_OFF)
# Smoothing # Smoothing
if smooth == True: if smooth:
self._raw(TXT_SMOOTH_ON) self._raw(TXT_SMOOTH_ON)
else: else:
self._raw(TXT_SMOOTH_OFF) self._raw(TXT_SMOOTH_OFF)

View File

@ -277,8 +277,6 @@ class Dummy(Escpos):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
""" """
:param devfile : Device file under dev filesystem
""" """
Escpos.__init__(self, *args, **kwargs) Escpos.__init__(self, *args, **kwargs)
self._output_list = [] self._output_list = []

View File

@ -54,4 +54,4 @@ def _load_and_check_img(filename, width_expected, height_expected, raster_format
i = 0 i = 0
for row in im.to_column_format(False): for row in im.to_column_format(False):
assert(row == column_format_expected[i]) assert(row == column_format_expected[i])
i = i + 1 i += 1

View File

@ -14,7 +14,7 @@ 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
import os
def test_with_statement(): def test_with_statement():
"""Use with statement""" """Use with statement"""