mirror of
https://github.com/python-escpos/python-escpos
synced 2025-08-24 09:03:34 +00:00
Fixes from ci (#533)
* break line * remove unused imports * remove unused os import * make flake8 more strict * configure flake for black * fix action * use importlib_resources * rename deprecated methods
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
import re
|
||||
from os import environ, path
|
||||
import pkg_resources
|
||||
import atexit
|
||||
import pickle
|
||||
import logging
|
||||
import time
|
||||
import importlib_resources
|
||||
|
||||
import six
|
||||
import yaml
|
||||
|
||||
from contextlib import ExitStack
|
||||
from tempfile import mkdtemp
|
||||
import platform
|
||||
|
||||
@@ -20,10 +22,13 @@ pickle_dir = environ.get("ESCPOS_CAPABILITIES_PICKLE_DIR", mkdtemp())
|
||||
pickle_path = path.join(
|
||||
pickle_dir, "{v}.capabilities.pickle".format(v=platform.python_version())
|
||||
)
|
||||
# get a temporary file from pkg_resources if no file is specified in env
|
||||
# get a temporary file from importlib_resources if no file is specified in env
|
||||
file_manager = ExitStack()
|
||||
atexit.register(file_manager.close)
|
||||
ref = importlib_resources.files(__name__) / "capabilities.json"
|
||||
capabilities_path = environ.get(
|
||||
"ESCPOS_CAPABILITIES_FILE",
|
||||
pkg_resources.resource_filename(__name__, "capabilities.json"),
|
||||
file_manager.enter_context(importlib_resources.as_file(ref)),
|
||||
)
|
||||
|
||||
# Load external printer database
|
||||
|
@@ -20,8 +20,6 @@ from re import match as re_match
|
||||
import barcode
|
||||
from barcode.writer import ImageWriter
|
||||
|
||||
import os
|
||||
|
||||
from .constants import (
|
||||
ESC,
|
||||
GS,
|
||||
@@ -84,7 +82,7 @@ from .magicencode import MagicEncode
|
||||
|
||||
from abc import ABCMeta, abstractmethod # abstract base class support
|
||||
from escpos.image import EscposImage
|
||||
from escpos.capabilities import get_profile, BARCODE_B
|
||||
from escpos.capabilities import get_profile
|
||||
|
||||
|
||||
# Remove special characters and whitespaces of the supported barcode names,
|
||||
@@ -510,7 +508,8 @@ class Escpos(object):
|
||||
.. note::
|
||||
Get all supported formats at:
|
||||
- Hardware: :py:const:`~escpos.constants.BARCODE_FORMATS`
|
||||
- Software: `Python barcode documentation <https://python-barcode.readthedocs.io/en/stable/supported-formats.html>`_
|
||||
- Software:
|
||||
`Python barcode documentation <https://python-barcode.readthedocs.io/en/stable/supported-formats.html>`_
|
||||
"""
|
||||
hw_modes = ["barcodeA", "barcodeB"]
|
||||
sw_modes = ["graphics", "bitImageColumn", "bitImageRaster"]
|
||||
|
Reference in New Issue
Block a user