cleanup imports, second part

This commit is contained in:
Patrick Kanzler 2018-05-16 01:57:37 +02:00
parent 9b8e56cd59
commit 594ab83fc3
No known key found for this signature in database
GPG Key ID: F07F07153306FCEF
9 changed files with 53 additions and 39 deletions

View File

@ -16,5 +16,6 @@ require-code = True
# FI16 __future__ import "nested_scopes" missing
# FI17 __future__ import "generators" missing
# FI5x __future__ import "xxx" present
ignore = FI12,FI15,FI16,FI17,FI5
# I101 Imported names are in the wrong order.
ignore = FI12,FI15,FI16,FI17,FI5, I101
copyright-check = True

View File

@ -3,17 +3,17 @@ from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import re
from os import environ, path
import pickle
import logging
import pickle
import platform
import re
import time
from os import environ, path
from tempfile import gettempdir
import six
import yaml
from tempfile import gettempdir
import platform
import yaml
logging.basicConfig()
logger = logging.getLogger(__name__)

View File

@ -15,13 +15,15 @@ from __future__ import print_function
from __future__ import unicode_literals
import argparse
import sys
try:
import argcomplete
except ImportError:
# this CLI works nevertheless without argcomplete
pass # noqa
import sys
import six
from . import config
from . import version

View File

@ -1,3 +1,8 @@
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from .capabilities import CAPABILITIES

View File

@ -10,11 +10,13 @@ from __future__ import print_function
from __future__ import unicode_literals
import os
import appdirs
import yaml
from . import printer
from . import exceptions
from . import printer
class Config(object):

View File

@ -15,42 +15,41 @@ from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import qrcode
import os
import textwrap
import six
import time
from abc import ABCMeta, abstractmethod # abstract base class support
from re import match as re_match
import barcode
from barcode.writer import ImageWriter
import os
import qrcode
from .constants import ESC, GS, NUL, QR_ECLEVEL_L, QR_ECLEVEL_M, QR_ECLEVEL_H, QR_ECLEVEL_Q
from .constants import QR_MODEL_1, QR_MODEL_2, QR_MICRO, BARCODE_TYPES, BARCODE_HEIGHT, BARCODE_WIDTH
import six
from .capabilities import BARCODE_B, get_profile
from .constants import BARCODE_FONT_A, BARCODE_FONT_B, BARCODE_FORMATS
from .constants import BARCODE_TXT_OFF, BARCODE_TXT_BTH, BARCODE_TXT_ABV, BARCODE_TXT_BLW
from .constants import TXT_SIZE, TXT_NORMAL
from .constants import SET_FONT
from .constants import BARCODE_TYPES, BARCODE_HEIGHT, BARCODE_WIDTH
from .constants import CD_KICK_DEC_SEQUENCE, CD_KICK_5, CD_KICK_2, PAPER_FULL_CUT, PAPER_PART_CUT
from .constants import CTL_VT, CTL_CR, CTL_FF, CTL_LF, CTL_SET_HT, PANEL_BUTTON_OFF, PANEL_BUTTON_ON
from .constants import ESC, GS, NUL, QR_ECLEVEL_L, QR_ECLEVEL_M, QR_ECLEVEL_H, QR_ECLEVEL_Q
from .constants import HW_INIT, HW_RESET, HW_SELECT
from .constants import LINESPACING_FUNCS, LINESPACING_RESET
from .constants import LINE_DISPLAY_OPEN, LINE_DISPLAY_CLEAR, LINE_DISPLAY_CLOSE
from .constants import CD_KICK_DEC_SEQUENCE, CD_KICK_5, CD_KICK_2, PAPER_FULL_CUT, PAPER_PART_CUT
from .constants import HW_RESET, HW_SELECT, HW_INIT
from .constants import CTL_VT, CTL_CR, CTL_FF, CTL_LF, CTL_SET_HT, PANEL_BUTTON_OFF, PANEL_BUTTON_ON
from .constants import TXT_STYLE
from .constants import RT_STATUS_ONLINE, RT_MASK_ONLINE
from .constants import QR_MODEL_1, QR_MODEL_2, QR_MICRO
from .constants import RT_MASK_ONLINE, RT_STATUS_ONLINE
from .constants import RT_STATUS_PAPER, RT_MASK_PAPER, RT_MASK_LOWPAPER, RT_MASK_NOPAPER
from .exceptions import BarcodeTypeError, BarcodeSizeError, TabPosError
from .exceptions import CashDrawerError, SetVariableError, BarcodeCodeError
from .exceptions import ImageWidthError
from .constants import SET_FONT
from .constants import TXT_SIZE, TXT_NORMAL
from .constants import TXT_STYLE
from .exceptions import BarcodeCodeError, BarcodeSizeError, BarcodeTypeError
from .exceptions import CashDrawerError, ImageWidthError
from .exceptions import SetVariableError, TabPosError
from .image import EscposImage
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
@six.add_metaclass(ABCMeta)
class Escpos(object):
@ -409,17 +408,17 @@ class Escpos(object):
if bc in BARCODE_TYPES['B']:
if not self.profile.supports(BARCODE_B):
raise BarcodeTypeError((
'Barcode type '{bc} not supported for '
"Barcode type '{bc}' not supported for "
'the current printer profile').format(bc=bc))
function_type = 'B'
else:
raise BarcodeTypeError((
'Barcode type '{bc} is not valid').format(bc=bc))
"Barcode type '{bc}' is not valid").format(bc=bc))
bc_types = BARCODE_TYPES[function_type.upper()]
if bc.upper() not in bc_types.keys():
raise BarcodeTypeError((
'Barcode '{bc}' not valid for barcode function type '
"Barcode '{bc}' not valid for barcode function type "
'{function_type}').format(
bc=bc,
function_type=function_type,
@ -427,7 +426,7 @@ class Escpos(object):
if check and not self.check_barcode(bc, code):
raise BarcodeCodeError((
'Barcode '{code}' not in a valid format for type '{bc}'').format(
"Barcode '{code}' not in a valid format for type '{bc}'").format(
code=code,
bc=bc,
))
@ -671,7 +670,7 @@ class Escpos(object):
mode = mode.upper()
if mode not in ('FULL', 'PART'):
raise ValueError('Mode must be one of ('FULL', 'PART')')
raise ValueError("Mode must be one of ('FULL', 'PART')")
if mode == 'PART':
if self.profile.supports('paperPartCut'):

View File

@ -14,6 +14,7 @@ from __future__ import print_function
from __future__ import unicode_literals
import math
from PIL import Image, ImageOps

View File

@ -18,10 +18,12 @@ from __future__ import print_function
from __future__ import unicode_literals
from builtins import bytes
import six
from .codepages import CodePages
from .constants import CODEPAGE_CHANGE
from .exceptions import Error
from .codepages import CodePages
import six
class Encoder(object):

View File

@ -13,10 +13,12 @@ from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import socket
import serial
import usb.core
import usb.util
import serial
import socket
from .escpos import Escpos
from .exceptions import USBNotFoundError