add some type hints

This commit is contained in:
Patrick Kanzler 2023-08-15 00:12:59 +02:00
parent b08f29429f
commit 18c4b5a4f4
2 changed files with 22 additions and 21 deletions

View File

@ -388,7 +388,7 @@ class Escpos(object):
inp_number //= 256 inp_number //= 256
return outp return outp
def charcode(self, code="AUTO"): def charcode(self, code: str = "AUTO"):
"""Set Character Code Table. """Set Character Code Table.
Sets the control sequence from ``CHARCODE`` in :py:mod:`escpos.constants` as active. It will be sent with Sets the control sequence from ``CHARCODE`` in :py:mod:`escpos.constants` as active. It will be sent with
@ -454,15 +454,15 @@ class Escpos(object):
self, self,
code, code,
bc, bc,
height=64, height: int = 64,
width=3, width: int = 3,
pos="BELOW", pos: str = "BELOW",
font="A", font: str = "A",
align_ct=True, align_ct: bool = True,
function_type=None, function_type=None,
check=True, check: bool = True,
force_software=False, force_software: bool = False,
): ) -> None:
"""Print barcode. """Print barcode.
Automatic hardware|software barcode renderer according to the printer capabilities. Automatic hardware|software barcode renderer according to the printer capabilities.
@ -577,13 +577,13 @@ class Escpos(object):
self, self,
code, code,
bc, bc,
height=64, height: int = 64,
width=3, width: int = 3,
pos="BELOW", pos: str = "BELOW",
font="A", font: str = "A",
align_ct=True, align_ct: bool = True,
function_type=None, function_type=None,
check=True, check: bool = True,
): ):
"""Print Barcode. """Print Barcode.
@ -736,12 +736,12 @@ class Escpos(object):
self, self,
barcode_type, barcode_type,
data, data,
impl="bitImageColumn", impl: str = "bitImageColumn",
module_height=5, module_height: int | float = 5,
module_width=0.2, module_width: int | float = 0.2,
text_distance=5, text_distance: int | float = 5,
font_size=10, font_size: int = 10,
center=True, center: bool = True,
): ):
"""Print Barcode. """Print Barcode.

View File

@ -51,4 +51,5 @@ deps = mypy
types-PyYAML types-PyYAML
types-appdirs types-appdirs
types-Pillow types-Pillow
jaconv
commands = mypy src commands = mypy src