normalize whitespace

This commit is contained in:
Patrick Kanzler 2017-01-30 01:50:27 +01:00
parent ca880dd8ec
commit ce94a1fc18
No known key found for this signature in database
GPG Key ID: F07F07153306FCEF
4 changed files with 16 additions and 16 deletions

View File

@ -126,7 +126,7 @@ class Escpos(object):
def _image_send_graphics_data(self, m, fn, data):
"""
Wrapper for GS ( L, to calculate and send correct data length.
:param m: Modifier//variant for function. Usually '0'
:param fn: Function number to use, as byte
:param data: Data to send
@ -203,7 +203,7 @@ class Escpos(object):
@staticmethod
def _int_low_high(inp_number, out_bytes):
""" Generate multiple bytes for a number: In lower and higher parts, or more parts as needed.
:param inp_number: Input number
:param out_bytes: The number of bytes to output (1 - 4).
"""
@ -259,7 +259,7 @@ class Escpos(object):
.. todo:: If further barcode-types are needed they could be rendered transparently as an image. (This could also
be of help if the printer does not support types that others do.)
:param code: alphanumeric data to be printed as bar code
:param bc: barcode format, possible values are for type A are:
@ -555,7 +555,7 @@ class Escpos(object):
Without any arguments the paper will be cut completely. With 'mode=PART' a partial cut will
be attempted. Note however, that not all models can do a partial cut. See the documentation of
your printer for details.
.. todo:: Check this function on TM-T88II.
:param mode: set to 'PART' for a partial cut

View File

@ -28,7 +28,7 @@ class EscposImage(object):
def __init__(self, img_source):
"""
Load in an image
:param img_source: PIL.Image, or filename to load one from.
"""
if isinstance(img_source, Image.Image):
@ -45,12 +45,12 @@ class EscposImage(object):
im = Image.new("RGB", img_original.size, (255, 255, 255))
im.paste(img_original, mask=img_original.split()[3])
# Convert down to greyscale
im = im.convert("L")
im = im.convert("L")
# Invert: Only works on 'L' images
im = ImageOps.invert(im)
# Pure black and white
self._im = im.convert("1")
@property
def width(self):
"""

View File

@ -70,9 +70,9 @@ class Encoder(object):
@staticmethod
def _get_codepage_char_list(encoding):
"""Get codepage character list
Gets characters 128-255 for a given code page, as an array.
:param encoding: The name of the encoding. This must appear in the CodePage list
"""
codepage = CodePages.get_encoding(encoding)
@ -94,12 +94,12 @@ class Encoder(object):
def _get_codepage_char_map(self, encoding):
""" Get codepage character map
Process an encoding and return a map of UTF-characters to code points
in this encoding.
This is generated once only, and returned from a cache.
:param encoding: The name of the encoding.
"""
# Skip things that were loaded previously
@ -112,7 +112,7 @@ class Encoder(object):
def can_encode(self, encoding, char):
"""Determine if a character is encodeable in the given code page.
:param encoding: The name of the encoding.
:param char: The character to attempt to encode.
"""
@ -130,7 +130,7 @@ class Encoder(object):
@staticmethod
def _encode_char(char, charmap, defaultchar):
""" Encode a single character with the given encoding map
:param char: char to encode
:param charmap: dictionary for mapping characters in this code page
"""
@ -142,7 +142,7 @@ class Encoder(object):
def encode(self, text, encoding, defaultchar='?'):
""" Encode text under the given encoding
:param text: Text to encode
:param encoding: Encoding name to use (must be defined in capabilities)
:param defaultchar: Fallback for non-encodable characters

View File

@ -34,7 +34,7 @@ class Usb(Escpos):
"""
def __init__(self, idVendor, idProduct, timeout=0, in_ep=0x82, out_ep=0x01, *args, **kwargs):
def __init__(self, idVendor, idProduct, timeout=0, in_ep=0x82, out_ep=0x01, *args, **kwargs): # noqa: N803
"""
:param idVendor: Vendor ID
:param idProduct: Product ID