run isort & black
This commit is contained in:
parent
6aec41fbd8
commit
5bd936b585
@ -18,8 +18,8 @@ import calendar
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
from urllib.request import urlopen
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
from urllib.request import urlopen
|
||||||
|
|
||||||
from escpos.printer import Usb
|
from escpos.printer import Usb
|
||||||
|
|
||||||
|
@ -578,9 +578,7 @@ def main() -> None:
|
|||||||
if not args_dict:
|
if not args_dict:
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
sys.exit()
|
sys.exit()
|
||||||
command_arguments = dict(
|
command_arguments = dict([k, v] for k, v in args_dict.items() if v is not None)
|
||||||
[k, v] for k, v in args_dict.items() if v is not None
|
|
||||||
)
|
|
||||||
|
|
||||||
# If version should be printed, do this, then exit
|
# If version should be printed, do this, then exit
|
||||||
print_version = command_arguments.pop("version", None)
|
print_version = command_arguments.pop("version", None)
|
||||||
|
@ -46,7 +46,7 @@ class Config:
|
|||||||
self._printer_name = None
|
self._printer_name = None
|
||||||
self._printer_config = None
|
self._printer_config = None
|
||||||
|
|
||||||
def load(self, config_path = None):
|
def load(self, config_path=None):
|
||||||
"""Load and parse the configuration file using pyyaml.
|
"""Load and parse the configuration file using pyyaml.
|
||||||
|
|
||||||
:param config_path: An optional file path, file handle, or byte string
|
:param config_path: An optional file path, file handle, or byte string
|
||||||
|
@ -46,9 +46,7 @@ HW_RESET: bytes = ESC + b"\x3f\x0a\x00" # Reset printer hardware
|
|||||||
# (TODO: Where is this specified?)
|
# (TODO: Where is this specified?)
|
||||||
|
|
||||||
# Cash Drawer (ESC p <pin> <on time: 2*ms> <off time: 2*ms>)
|
# Cash Drawer (ESC p <pin> <on time: 2*ms> <off time: 2*ms>)
|
||||||
_CASH_DRAWER = (
|
_CASH_DRAWER = lambda m, t1="", t2="": ESC + b"p" + m + bytes((t1, t2))
|
||||||
lambda m, t1="", t2="": ESC + b"p" + m + bytes((t1, t2))
|
|
||||||
)
|
|
||||||
|
|
||||||
#: decimal cash drawer kick sequence
|
#: decimal cash drawer kick sequence
|
||||||
CD_KICK_DEC_SEQUENCE = (
|
CD_KICK_DEC_SEQUENCE = (
|
||||||
|
@ -16,7 +16,7 @@ import warnings
|
|||||||
from abc import ABCMeta, abstractmethod # abstract base class support
|
from abc import ABCMeta, abstractmethod # abstract base class support
|
||||||
from re import match as re_match
|
from re import match as re_match
|
||||||
from types import TracebackType
|
from types import TracebackType
|
||||||
from typing import List, Literal, Optional, Union, Any
|
from typing import Any, List, Literal, Optional, Union
|
||||||
|
|
||||||
import barcode
|
import barcode
|
||||||
import qrcode
|
import qrcode
|
||||||
@ -857,7 +857,7 @@ class Escpos(object, metaclass=ABCMeta):
|
|||||||
image = my_code.writer._image
|
image = my_code.writer._image
|
||||||
self.image(image, impl=impl, center=center)
|
self.image(image, impl=impl, center=center)
|
||||||
|
|
||||||
def text(self, txt:str) -> None:
|
def text(self, txt: str) -> None:
|
||||||
"""Print alpha-numeric text.
|
"""Print alpha-numeric text.
|
||||||
|
|
||||||
The text has to be encoded in the currently selected codepage.
|
The text has to be encoded in the currently selected codepage.
|
||||||
@ -1443,15 +1443,12 @@ class EscposIO:
|
|||||||
"""
|
"""
|
||||||
self.printer.close()
|
self.printer.close()
|
||||||
|
|
||||||
def __enter__(self, **kwargs: Any) -> 'EscposIO':
|
def __enter__(self, **kwargs: Any) -> "EscposIO":
|
||||||
"""Enter context."""
|
"""Enter context."""
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def __exit__(
|
def __exit__(
|
||||||
self,
|
self, type: type[BaseException], value: BaseException, traceback: TracebackType
|
||||||
type: type[BaseException],
|
|
||||||
value: BaseException,
|
|
||||||
traceback: TracebackType
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Cut and close if configured.
|
"""Cut and close if configured.
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ class Error(Exception):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, msg:str, status: Optional[int] = None) -> None:
|
def __init__(self, msg: str, status: Optional[int] = None) -> None:
|
||||||
"""Initialize Error object."""
|
"""Initialize Error object."""
|
||||||
Exception.__init__(self)
|
Exception.__init__(self)
|
||||||
self.msg = msg
|
self.msg = msg
|
||||||
|
@ -10,7 +10,7 @@ This module contains the image format handler :py:class:`EscposImage`.
|
|||||||
|
|
||||||
|
|
||||||
import math
|
import math
|
||||||
from typing import Union, Iterator
|
from typing import Iterator, Union
|
||||||
|
|
||||||
from PIL import Image, ImageOps
|
from PIL import Image, ImageOps
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
import functools
|
import functools
|
||||||
import logging
|
import logging
|
||||||
import tempfile
|
import tempfile
|
||||||
from typing import Literal, Optional, Type, Union, List
|
from typing import List, Literal, Optional, Type, Union
|
||||||
|
|
||||||
from ..escpos import Escpos
|
from ..escpos import Escpos
|
||||||
from ..exceptions import DeviceNotFoundError
|
from ..exceptions import DeviceNotFoundError
|
||||||
|
Loading…
x
Reference in New Issue
Block a user