run isort & black

This commit is contained in:
Alexandre Detiste 2023-12-10 22:47:32 +01:00
parent 6aec41fbd8
commit 5bd936b585
8 changed files with 12 additions and 19 deletions

View File

@ -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

View File

@ -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)

View File

@ -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 = (

View File

@ -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
@ -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.

View File

@ -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

View File

@ -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