@@ -168,7 +168,7 @@ def setup_timing_pattern(self):
168
168
169
169
def setup_position_adjust_pattern (self ):
170
170
"""Add the position adjust data pixels to the matrix"""
171
- pos = QRUtil .getPatternPosition (self .type )
171
+ pos = QRUtil .get_pattern_position (self .type )
172
172
173
173
for row in pos :
174
174
for col in pos :
@@ -183,7 +183,7 @@ def setup_position_adjust_pattern(self):
183
183
184
184
def setup_type_number (self , test ):
185
185
"""Add the type number pixels to the matrix"""
186
- bits = QRUtil .getBCHTypeNumber (self .type )
186
+ bits = QRUtil .get_BCH_type_number (self .type )
187
187
188
188
for i in range (18 ):
189
189
mod = not test and ((bits >> i ) & 1 ) == 1
@@ -196,7 +196,7 @@ def setup_type_number(self, test):
196
196
def setup_type_info (self , test , mask_pattern ):
197
197
"""Add the type info pixels to the matrix"""
198
198
data = (self .ECC << 3 ) | mask_pattern
199
- bits = QRUtil .getBCHTypeInfo (data )
199
+ bits = QRUtil .get_BCH_type_info (data )
200
200
201
201
#// vertical
202
202
for i in range (15 ):
@@ -238,7 +238,7 @@ def map_data(self, data, mask_pattern):
238
238
dark = False
239
239
if byte_idx < len (data ):
240
240
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 )
242
242
if mask :
243
243
dark = not dark
244
244
self .matrix [row , col - c ] = dark
@@ -318,7 +318,7 @@ def create_bytes(buffer, rs_blocks):
318
318
dcdata [r ][i ] = 0xff & buffer .buffer [i + offset ]
319
319
offset += dc_count
320
320
321
- rs_poly = QRUtil .getErrorCorrectPolynomial (ec_count )
321
+ rs_poly = QRUtil .get_error_correct_polynomial (ec_count )
322
322
mod_poly = QRPolynomial (dcdata [r ], rs_poly .getLength () - 1 )
323
323
324
324
while True :
@@ -373,30 +373,30 @@ class QRUtil(object):
373
373
G15_MASK = 0b101010000010010
374
374
375
375
@staticmethod
376
- def getBCHTypeInfo (data ):
376
+ def get_BCH_type_info (data ):
377
377
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 ))
380
380
381
381
return ((data << 10 ) | d ) ^ QRUtil .G15_MASK
382
382
@staticmethod
383
- def getBCHTypeNumber (data ):
383
+ def get_BCH_type_number (data ):
384
384
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 ))
387
387
return (data << 12 ) | d
388
388
@staticmethod
389
- def getBCHDigit (data ):
389
+ def get_BCH_digit (data ):
390
390
digit = 0
391
391
while data != 0 :
392
392
digit += 1
393
393
data >>= 1
394
394
return digit
395
395
@staticmethod
396
- def getPatternPosition (type ):
396
+ def get_pattern_position (type ):
397
397
return QRUtil .PATTERN_POSITION_TABLE [type - 1 ]
398
398
@staticmethod
399
- def getMask (mask , i , j ):
399
+ def get_mask (mask , i , j ):
400
400
if mask == 0 : return (i + j ) % 2 == 0
401
401
if mask == 1 : return i % 2 == 0
402
402
if mask == 2 : return j % 3 == 0
@@ -407,9 +407,9 @@ def getMask(mask, i, j):
407
407
if mask == 7 : return ((i * j ) % 3 + (i + j ) % 2 ) % 2 == 0
408
408
raise ValueError ("Bad mask pattern:" + mask )
409
409
@staticmethod
410
- def getErrorCorrectPolynomial ( errorCorrectLength ):
410
+ def get_error_correct_polynomial ( ecc_length ):
411
411
a = QRPolynomial ([1 ], 0 )
412
- for i in range (errorCorrectLength ):
412
+ for i in range (ecc_length ):
413
413
a = a .multiply (QRPolynomial ([1 , _gexp (i )], 0 ))
414
414
return a
415
415
0 commit comments