Skip to content

Commit 4ce4f77

Browse files
committed
lintylint
1 parent 9149981 commit 4ce4f77

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

adafruit_miniqr.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def setup_timing_pattern(self):
168168

169169
def setup_position_adjust_pattern(self):
170170
"""Add the position adjust data pixels to the matrix"""
171-
pos = QRUtil.getPatternPosition(self.type)
171+
pos = QRUtil.get_pattern_position(self.type)
172172

173173
for row in pos:
174174
for col in pos:
@@ -183,7 +183,7 @@ def setup_position_adjust_pattern(self):
183183

184184
def setup_type_number(self, test):
185185
"""Add the type number pixels to the matrix"""
186-
bits = QRUtil.getBCHTypeNumber(self.type)
186+
bits = QRUtil.get_BCH_type_number(self.type)
187187

188188
for i in range(18):
189189
mod = not test and ((bits >> i) & 1) == 1
@@ -196,7 +196,7 @@ def setup_type_number(self, test):
196196
def setup_type_info(self, test, mask_pattern):
197197
"""Add the type info pixels to the matrix"""
198198
data = (self.ECC << 3) | mask_pattern
199-
bits = QRUtil.getBCHTypeInfo(data)
199+
bits = QRUtil.get_BCH_type_info(data)
200200

201201
#// vertical
202202
for i in range(15):
@@ -238,7 +238,7 @@ def map_data(self, data, mask_pattern):
238238
dark = False
239239
if byte_idx < len(data):
240240
dark = ((data[byte_idx] >> bit_idx) & 1) == 1
241-
mask = QRUtil.getMask(mask_pattern, row, col - c)
241+
mask = QRUtil.get_mask(mask_pattern, row, col - c)
242242
if mask:
243243
dark = not dark
244244
self.matrix[row, col-c] = dark
@@ -318,7 +318,7 @@ def create_bytes(buffer, rs_blocks):
318318
dcdata[r][i] = 0xff & buffer.buffer[i + offset]
319319
offset += dc_count
320320

321-
rs_poly = QRUtil.getErrorCorrectPolynomial(ec_count)
321+
rs_poly = QRUtil.get_error_correct_polynomial(ec_count)
322322
mod_poly = QRPolynomial(dcdata[r], rs_poly.getLength() - 1)
323323

324324
while True:
@@ -373,30 +373,30 @@ class QRUtil(object):
373373
G15_MASK = 0b101010000010010
374374

375375
@staticmethod
376-
def getBCHTypeInfo(data):
376+
def get_BCH_type_info(data):
377377
d = data << 10
378-
while QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) >= 0:
379-
d ^= QRUtil.G15 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15))
378+
while QRUtil.get_BCH_digit(d) - QRUtil.get_BCH_digit(QRUtil.G15) >= 0:
379+
d ^= QRUtil.G15 << (QRUtil.get_BCH_digit(d) - QRUtil.get_BCH_digit(QRUtil.G15))
380380

381381
return ((data << 10) | d) ^ QRUtil.G15_MASK
382382
@staticmethod
383-
def getBCHTypeNumber(data):
383+
def get_BCH_type_number(data):
384384
d = data << 12
385-
while QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) >= 0:
386-
d ^= QRUtil.G18 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18))
385+
while QRUtil.get_BCH_digit(d) - QRUtil.get_BCH_digit(QRUtil.G18) >= 0:
386+
d ^= QRUtil.G18 << (QRUtil.get_BCH_digit(d) - QRUtil.get_BCH_digit(QRUtil.G18))
387387
return (data << 12) | d
388388
@staticmethod
389-
def getBCHDigit(data):
389+
def get_BCH_digit(data):
390390
digit = 0
391391
while data != 0:
392392
digit += 1
393393
data >>= 1
394394
return digit
395395
@staticmethod
396-
def getPatternPosition(type):
396+
def get_pattern_position(type):
397397
return QRUtil.PATTERN_POSITION_TABLE[type - 1]
398398
@staticmethod
399-
def getMask(mask, i, j):
399+
def get_mask(mask, i, j):
400400
if mask == 0: return (i + j) % 2 == 0
401401
if mask == 1: return i % 2 == 0
402402
if mask == 2: return j % 3 == 0
@@ -407,9 +407,9 @@ def getMask(mask, i, j):
407407
if mask == 7: return ((i * j) % 3 + (i + j) % 2) % 2 == 0
408408
raise ValueError("Bad mask pattern:" + mask)
409409
@staticmethod
410-
def getErrorCorrectPolynomial(errorCorrectLength):
410+
def get_error_correct_polynomial(ecc_length):
411411
a = QRPolynomial([1], 0)
412-
for i in range(errorCorrectLength):
412+
for i in range(ecc_length):
413413
a = a.multiply(QRPolynomial([1, _gexp(i)], 0))
414414
return a
415415

0 commit comments

Comments
 (0)