Isorting
This commit is contained in:
parent
1d57bbca49
commit
1da2e5657e
19 changed files with 57 additions and 44 deletions
5
.isort.cfg
Normal file
5
.isort.cfg
Normal file
|
@ -0,0 +1,5 @@
|
|||
[settings]
|
||||
multi_line_output=4
|
||||
skip=backend/ticketshop/wsgi.py
|
||||
skip-glob=*node_modules/*
|
||||
not_skip=__init__.py
|
3
conv.py
3
conv.py
|
@ -22,9 +22,8 @@ You should have received a copy of the GNU Lesser General Public License
|
|||
along with pyscard; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
"""
|
||||
from functools import reduce
|
||||
|
||||
import sys
|
||||
from functools import reduce
|
||||
|
||||
PACK = 1
|
||||
HEX = 2
|
||||
|
|
10
ecr.py
10
ecr.py
|
@ -8,12 +8,14 @@
|
|||
- see the representation of the packet
|
||||
- ability for incoming and outgoing
|
||||
"""
|
||||
from ecrterm.utils import is_stringlike
|
||||
from ecrterm.packets import *
|
||||
import logging
|
||||
import time
|
||||
|
||||
from ecrterm import transmission
|
||||
from ecrterm.transmission.signals import *
|
||||
import time, logging
|
||||
from ecrterm.common import TERMINAL_STATUS_CODES
|
||||
from ecrterm.packets import *
|
||||
from ecrterm.transmission.signals import *
|
||||
from ecrterm.utils import is_stringlike
|
||||
|
||||
|
||||
class A(object):
|
||||
|
|
|
@ -5,4 +5,3 @@
|
|||
@author g4b
|
||||
"""
|
||||
from ecrterm.packets.base_packets import *
|
||||
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
Classes and Functions which deal with the APDU Layer
|
||||
|
||||
"""
|
||||
from logging import debug
|
||||
import sys
|
||||
from ecrterm import conv
|
||||
from ecrterm.packets.bmp import BMP, int_word_split
|
||||
from ecrterm.packets.bitmaps import BITMAPS_ARGS
|
||||
from ecrterm.utils import is_stringlike
|
||||
from logging import debug
|
||||
|
||||
from ecrterm import conv
|
||||
from ecrterm.packets.bitmaps import BITMAPS_ARGS
|
||||
from ecrterm.packets.bmp import BMP, int_word_split
|
||||
from ecrterm.utils import is_stringlike
|
||||
|
||||
if sys.version_info[0] == 2:
|
||||
range = xrange
|
||||
|
@ -260,4 +260,3 @@ class APDUPacket(object):
|
|||
return instance
|
||||
else:
|
||||
debug('Unknown Packet')
|
||||
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from ecrterm.packets.apdu import APDUPacket, Packets
|
||||
from ecrterm.packets import bmp
|
||||
from ecrterm import conv, common
|
||||
from ecrterm.packets.bmp import BCD
|
||||
import datetime
|
||||
|
||||
from ecrterm import common, conv
|
||||
from ecrterm.packets import bmp
|
||||
from ecrterm.packets.apdu import APDUPacket, Packets
|
||||
from ecrterm.packets.bmp import BCD
|
||||
|
||||
|
||||
class Packet(APDUPacket):
|
||||
wait_for_completion = False
|
||||
completion = None
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
import struct
|
||||
import sys
|
||||
|
||||
from ecrterm.common import Dumpling
|
||||
from ecrterm import conv
|
||||
from ecrterm.common import Dumpling
|
||||
from ecrterm.utils import is_stringlike
|
||||
|
||||
if sys.version_info[0] == 2:
|
||||
|
@ -353,4 +353,3 @@ class BCD(FixedLength):
|
|||
class BYTE(FixedLength):
|
||||
def __repr__(self):
|
||||
return "Bitmap %s, <BYTES %s>" % (self._key, self._length)
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
"""
|
||||
from ecrterm.packets.bmp import BMP
|
||||
|
||||
|
||||
class TLV(BMP):
|
||||
_id = 0x06
|
||||
|
||||
|
@ -65,4 +66,3 @@ class TLV(BMP):
|
|||
data = data[1:]
|
||||
self._data = data[:length]
|
||||
return data[length:]
|
||||
|
||||
|
|
|
@ -3,11 +3,10 @@
|
|||
"""
|
||||
Example script to demonstrate a payment process.
|
||||
"""
|
||||
from ecrterm import packets
|
||||
from ecrterm import transmission
|
||||
from ecrterm import ecr
|
||||
import time
|
||||
|
||||
from ecrterm import ecr, packets, transmission
|
||||
|
||||
if __name__ == '__main__':
|
||||
def printer(lines_of_text):
|
||||
for line in lines_of_text:
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
"""
|
||||
import unittest
|
||||
|
||||
|
||||
def suite():
|
||||
suite = unittest.TestSuite()
|
||||
suite.addTest()
|
||||
|
|
|
@ -13,11 +13,11 @@
|
|||
"""
|
||||
|
||||
import unittest
|
||||
#import sys
|
||||
#sys.path.insert(0, '..')
|
||||
from ecrterm.packets import *
|
||||
from ecrterm.transmission import SerialMessage, ACK, NAK
|
||||
|
||||
from ecrterm import conv
|
||||
from ecrterm.packets import *
|
||||
from ecrterm.transmission import ACK, NAK, SerialMessage
|
||||
|
||||
|
||||
def list_of_bytes(apdu):
|
||||
sm = SerialMessage(apdu)
|
||||
|
|
|
@ -5,10 +5,12 @@
|
|||
@author g4b
|
||||
"""
|
||||
import unittest
|
||||
|
||||
from ecrterm.packets.bmp import *
|
||||
|
||||
#import sys
|
||||
#sys.path.insert(0, '..')
|
||||
|
||||
from ecrterm.packets.bmp import *
|
||||
|
||||
class TestSequenceFunctions(unittest.TestCase):
|
||||
|
||||
|
|
|
@ -3,15 +3,17 @@
|
|||
Incoming Packets should be always parsable.
|
||||
this test tries to look at the parser in detail.
|
||||
"""
|
||||
import unittest
|
||||
import sys
|
||||
import logging
|
||||
#sys.path.insert(0, '..')
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
from ecrterm.packets.bmp import *
|
||||
from ecrterm import conv
|
||||
from ecrterm.ecr import parse_represented_data
|
||||
from ecrterm.packets import *
|
||||
from ecrterm import conv
|
||||
from ecrterm.packets.bmp import *
|
||||
|
||||
#sys.path.insert(0, '..')
|
||||
|
||||
|
||||
class TestParsingMechanisms(unittest.TestCase):
|
||||
|
||||
|
|
|
@ -13,6 +13,6 @@
|
|||
@author g4b
|
||||
"""
|
||||
|
||||
from ecrterm.transmission._transmission import *
|
||||
from ecrterm.transmission import signals, zvt
|
||||
from ecrterm.transmission._transmission import *
|
||||
from ecrterm.transmission.transport_serial import SerialTransport
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
Transmission Basics.
|
||||
@author g4b
|
||||
"""
|
||||
from ecrterm.transmission.signals import *
|
||||
from ecrterm import common
|
||||
from ecrterm.packets.base_packets import PacketReceived
|
||||
from ecrterm.transmission.signals import *
|
||||
|
||||
|
||||
class TransmissionException(common.ApplicationLayerException):
|
||||
|
|
|
@ -8,11 +8,15 @@
|
|||
@author g4b
|
||||
"""
|
||||
|
||||
from ecrterm import crc, conv, common
|
||||
import os # @UnresolvedImport
|
||||
import select
|
||||
import time
|
||||
|
||||
import serial
|
||||
from ecrterm import common, conv, crc
|
||||
from ecrterm.packets.apdu import APDUPacket
|
||||
from ecrterm.utils import is_stringlike, ensure_bytes
|
||||
import os, serial, select, time#@UnresolvedImport
|
||||
from ecrterm.transmission.signals import *
|
||||
from ecrterm.utils import ensure_bytes, is_stringlike
|
||||
|
||||
SERIAL_DEBUG = False
|
||||
def std_serial_log(instance, data, incoming=False):
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import serial # @UnresolvedImport
|
||||
from ecrterm.transmission.transport_serial import *
|
||||
import serial #@UnresolvedImport
|
||||
|
||||
|
||||
class SerialTransportUnbuffered(SerialTransport):
|
||||
class UnbufferedSerial(serial.Serial):
|
||||
|
|
|
@ -4,9 +4,11 @@
|
|||
|
||||
@author g4b
|
||||
"""
|
||||
from ecrterm.transmission.signals import *
|
||||
from ecrterm.transmission._transmission import Transmission, TransmissionException
|
||||
from ecrterm.packets.base_packets import PacketReceived, PacketReceivedError
|
||||
from ecrterm.transmission._transmission import (
|
||||
Transmission, TransmissionException)
|
||||
from ecrterm.transmission.signals import *
|
||||
|
||||
|
||||
class ZVTTransmission(Transmission):
|
||||
"""
|
||||
|
|
3
utils.py
3
utils.py
|
@ -7,8 +7,6 @@
|
|||
"""
|
||||
import sys
|
||||
|
||||
|
||||
|
||||
if sys.version_info[0] == 2:
|
||||
def is_stringlike(v):
|
||||
return isinstance(v, basestring)
|
||||
|
@ -75,4 +73,3 @@ if __name__ == '__main__':
|
|||
print("PT is online at ttyUSB0")
|
||||
else:
|
||||
print("PT cant be found at ttyUSB0")
|
||||
|
||||
|
|
Loading…
Reference in a new issue