Skip to content

Commit b14539d

Browse files
committed
PEP-0008 code styling
1 parent 158b0f0 commit b14539d

7 files changed

Lines changed: 27 additions & 9 deletions

File tree

quirc/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
__version__ = '0.6.2'
77

88
import api
9-
from base import decode
9+
from base import decode

quirc/api/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
import constants, exceptions, structures
4-
from functions import *
3+
import constants
4+
import exceptions
5+
import structures
6+
from functions import *

quirc/api/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@
3030
5: 'Unknown data type',
3131
6: 'Data overflow',
3232
7: 'Data underflow',
33-
}
33+
}

quirc/api/exceptions.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
# -*- coding: utf-8 -*-
22

3+
34
class QuircException(BaseException):
5+
# TODO: docstring
46
pass
57

68

79
class DecodeException(QuircException, ValueError):
10+
# TODO: docstring
811

912
def __init__(self, message):
1013
self._message = message
1114

1215
def __str__(self):
13-
return self._message
16+
return self._message

quirc/api/functions.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
_new.argtypes = ()
2424
_new.restype = QuircPointer
2525

26+
2627
def new():
2728
"""Construct a new QR-code recognizer.
2829
@@ -38,6 +39,7 @@ def new():
3839
_destroy.argtypes = (QuircPointer,)
3940
_destroy.restype = None
4041

42+
4143
def destroy(structure):
4244
"""Destroy a QR-code recognizer.
4345
@@ -51,6 +53,7 @@ def destroy(structure):
5153
_resize.argtypes = (QuircPointer, ctypes.c_int, ctypes.c_int)
5254
_resize.restype = ctypes.c_int
5355

56+
5457
def resize(structure, width, height):
5558
"""Resize the QR-code recognizer.
5659
@@ -66,6 +69,7 @@ def resize(structure, width, height):
6669
_begin.argtypes = (QuircPointer, c_int_pointer, c_int_pointer)
6770
_begin.restype = c_uint8_pointer
6871

72+
6973
def begin(structure, width, height):
7074
# TODO: docstring
7175
# TODO: parameter type check
@@ -76,6 +80,7 @@ def begin(structure, width, height):
7680
_end.argtypes = (QuircPointer,)
7781
_end.restype = None
7882

83+
7984
def end(structure):
8085
# TODO: docstring
8186
# TODO: parameter type check
@@ -85,6 +90,7 @@ def end(structure):
8590
_count.argtypes = (QuircPointer,)
8691
_count.restype = ctypes.c_int
8792

93+
8894
def count(structure):
8995
# TODO: docstring
9096
# TODO: parameter type check
@@ -95,18 +101,24 @@ def count(structure):
95101
_extract.argtypes = (QuircPointer, ctypes.c_int, CodePointer)
96102
_extract.restype = ctypes.c_int
97103

104+
98105
def extract(structure, idx, code):
99106
# TODO: doctring
100107
# TODO: parameter type check
101108
_extract(structure, idx, ctypes.byref(code))
102109

110+
103111
def _decode_errcheck(result, func, arguments):
104112
if result:
105113
raise DecodeException(constants._DECODE_ERRORS[result])
106114

107115
_decode = libquirc.quirc_decode
108116
_decode.argtypes = (CodePointer, DataPointer)
109-
_decode.restype = ctypes.c_int # TODO: return proper value
117+
_decode.restype = ctypes.c_int # TODO: return proper value
110118
_decode.errcheck = _decode_errcheck
119+
120+
111121
def decode(code, data):
112-
return _decode(ctypes.byref(code), ctypes.byref(data))
122+
# TODO: docstring
123+
# TODO: parameter type check
124+
return _decode(ctypes.byref(code), ctypes.byref(data))

quirc/api/structures.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ class Code(ctypes.Structure):
3333
"""This structure is used to return information about detected QR codes in the input image."""
3434

3535
_fields_ = (
36-
('corners', Point*4), # The four corners of the QR-code, from top left, clockwise
36+
('corners', Point * 4), # The four corners of the QR-code, from top left, clockwise
3737
('size', ctypes.c_int),
38-
('cell_bitmap', ctypes.c_uint8*constants.MAX_BITMAP),
38+
('cell_bitmap', ctypes.c_uint8 * constants.MAX_BITMAP),
3939
)
4040

4141
CodePointer = ctypes.POINTER(Code)

quirc/base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
except ImportError:
1414
USING_PIL = False
1515

16+
1617
def decode(image):
1718
"""Recognize image and return generator with all the available QR codes
1819

0 commit comments

Comments
 (0)