cleanup imports, second part
This commit is contained in:
parent
9b8e56cd59
commit
594ab83fc3
|
@ -16,5 +16,6 @@ require-code = True
|
||||||
# FI16 __future__ import "nested_scopes" missing
|
# FI16 __future__ import "nested_scopes" missing
|
||||||
# FI17 __future__ import "generators" missing
|
# FI17 __future__ import "generators" missing
|
||||||
# FI5x __future__ import "xxx" present
|
# 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
|
copyright-check = True
|
||||||
|
|
|
@ -3,17 +3,17 @@ from __future__ import division
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
|
||||||
from os import environ, path
|
|
||||||
import pickle
|
|
||||||
import logging
|
import logging
|
||||||
|
import pickle
|
||||||
|
import platform
|
||||||
|
import re
|
||||||
import time
|
import time
|
||||||
|
from os import environ, path
|
||||||
|
from tempfile import gettempdir
|
||||||
|
|
||||||
import six
|
import six
|
||||||
import yaml
|
|
||||||
|
|
||||||
from tempfile import gettempdir
|
import yaml
|
||||||
import platform
|
|
||||||
|
|
||||||
logging.basicConfig()
|
logging.basicConfig()
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
|
@ -15,13 +15,15 @@ from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import sys
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import argcomplete
|
import argcomplete
|
||||||
except ImportError:
|
except ImportError:
|
||||||
# this CLI works nevertheless without argcomplete
|
# this CLI works nevertheless without argcomplete
|
||||||
pass # noqa
|
pass # noqa
|
||||||
import sys
|
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from . import config
|
from . import config
|
||||||
from . import version
|
from . import version
|
||||||
|
|
||||||
|
|
|
@ -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
|
from .capabilities import CAPABILITIES
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,11 +10,13 @@ from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import appdirs
|
import appdirs
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from . import printer
|
|
||||||
from . import exceptions
|
from . import exceptions
|
||||||
|
from . import printer
|
||||||
|
|
||||||
|
|
||||||
class Config(object):
|
class Config(object):
|
||||||
|
|
|
@ -15,42 +15,41 @@ from __future__ import division
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import qrcode
|
import os
|
||||||
import textwrap
|
import textwrap
|
||||||
import six
|
|
||||||
import time
|
import time
|
||||||
|
from abc import ABCMeta, abstractmethod # abstract base class support
|
||||||
from re import match as re_match
|
from re import match as re_match
|
||||||
|
|
||||||
import barcode
|
import barcode
|
||||||
from barcode.writer import ImageWriter
|
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
|
import six
|
||||||
from .constants import QR_MODEL_1, QR_MODEL_2, QR_MICRO, BARCODE_TYPES, BARCODE_HEIGHT, BARCODE_WIDTH
|
|
||||||
|
from .capabilities import BARCODE_B, get_profile
|
||||||
from .constants import BARCODE_FONT_A, BARCODE_FONT_B, BARCODE_FORMATS
|
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 BARCODE_TXT_OFF, BARCODE_TXT_BTH, BARCODE_TXT_ABV, BARCODE_TXT_BLW
|
||||||
from .constants import TXT_SIZE, TXT_NORMAL
|
from .constants import BARCODE_TYPES, BARCODE_HEIGHT, BARCODE_WIDTH
|
||||||
from .constants import SET_FONT
|
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 LINESPACING_FUNCS, LINESPACING_RESET
|
||||||
from .constants import LINE_DISPLAY_OPEN, LINE_DISPLAY_CLEAR, LINE_DISPLAY_CLOSE
|
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 QR_MODEL_1, QR_MODEL_2, QR_MICRO
|
||||||
from .constants import HW_RESET, HW_SELECT, HW_INIT
|
from .constants import RT_MASK_ONLINE, RT_STATUS_ONLINE
|
||||||
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 RT_STATUS_PAPER, RT_MASK_PAPER, RT_MASK_LOWPAPER, RT_MASK_NOPAPER
|
from .constants import RT_STATUS_PAPER, RT_MASK_PAPER, RT_MASK_LOWPAPER, RT_MASK_NOPAPER
|
||||||
|
from .constants import SET_FONT
|
||||||
from .exceptions import BarcodeTypeError, BarcodeSizeError, TabPosError
|
from .constants import TXT_SIZE, TXT_NORMAL
|
||||||
from .exceptions import CashDrawerError, SetVariableError, BarcodeCodeError
|
from .constants import TXT_STYLE
|
||||||
from .exceptions import ImageWidthError
|
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 .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)
|
@six.add_metaclass(ABCMeta)
|
||||||
class Escpos(object):
|
class Escpos(object):
|
||||||
|
@ -409,17 +408,17 @@ class Escpos(object):
|
||||||
if bc in BARCODE_TYPES['B']:
|
if bc in BARCODE_TYPES['B']:
|
||||||
if not self.profile.supports(BARCODE_B):
|
if not self.profile.supports(BARCODE_B):
|
||||||
raise BarcodeTypeError((
|
raise BarcodeTypeError((
|
||||||
'Barcode type '{bc} not supported for '
|
"Barcode type '{bc}' not supported for "
|
||||||
'the current printer profile').format(bc=bc))
|
'the current printer profile').format(bc=bc))
|
||||||
function_type = 'B'
|
function_type = 'B'
|
||||||
else:
|
else:
|
||||||
raise BarcodeTypeError((
|
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()]
|
bc_types = BARCODE_TYPES[function_type.upper()]
|
||||||
if bc.upper() not in bc_types.keys():
|
if bc.upper() not in bc_types.keys():
|
||||||
raise BarcodeTypeError((
|
raise BarcodeTypeError((
|
||||||
'Barcode '{bc}' not valid for barcode function type '
|
"Barcode '{bc}' not valid for barcode function type "
|
||||||
'{function_type}').format(
|
'{function_type}').format(
|
||||||
bc=bc,
|
bc=bc,
|
||||||
function_type=function_type,
|
function_type=function_type,
|
||||||
|
@ -427,7 +426,7 @@ class Escpos(object):
|
||||||
|
|
||||||
if check and not self.check_barcode(bc, code):
|
if check and not self.check_barcode(bc, code):
|
||||||
raise BarcodeCodeError((
|
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,
|
code=code,
|
||||||
bc=bc,
|
bc=bc,
|
||||||
))
|
))
|
||||||
|
@ -671,7 +670,7 @@ class Escpos(object):
|
||||||
|
|
||||||
mode = mode.upper()
|
mode = mode.upper()
|
||||||
if mode not in ('FULL', 'PART'):
|
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 mode == 'PART':
|
||||||
if self.profile.supports('paperPartCut'):
|
if self.profile.supports('paperPartCut'):
|
||||||
|
|
|
@ -14,6 +14,7 @@ from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import math
|
import math
|
||||||
|
|
||||||
from PIL import Image, ImageOps
|
from PIL import Image, ImageOps
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,10 +18,12 @@ from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from builtins import bytes
|
from builtins import bytes
|
||||||
|
|
||||||
|
import six
|
||||||
|
|
||||||
|
from .codepages import CodePages
|
||||||
from .constants import CODEPAGE_CHANGE
|
from .constants import CODEPAGE_CHANGE
|
||||||
from .exceptions import Error
|
from .exceptions import Error
|
||||||
from .codepages import CodePages
|
|
||||||
import six
|
|
||||||
|
|
||||||
|
|
||||||
class Encoder(object):
|
class Encoder(object):
|
||||||
|
|
|
@ -13,10 +13,12 @@ from __future__ import division
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import socket
|
||||||
|
|
||||||
|
import serial
|
||||||
|
|
||||||
import usb.core
|
import usb.core
|
||||||
import usb.util
|
import usb.util
|
||||||
import serial
|
|
||||||
import socket
|
|
||||||
|
|
||||||
from .escpos import Escpos
|
from .escpos import Escpos
|
||||||
from .exceptions import USBNotFoundError
|
from .exceptions import USBNotFoundError
|
||||||
|
|
Loading…
Reference in New Issue