MCPcopy Index your code
hub / github.com/lincolnloop/python-qrcode / get_matrix

Method get_matrix

qrcode/main.py:515–534  ·  view source on GitHub ↗

Return the QR Code as a multidimensional array, including the border. To return the array without a border, set ``self.border`` to 0 first.

(self)

Source from the content-addressed store, hash-verified

513 break
514
515 def get_matrix(self):
516 """
517 Return the QR Code as a multidimensional array, including the border.
518
519 To return the array without a border, set ``self.border`` to 0 first.
520 """
521 if self.data_cache is None:
522 self.make()
523
524 if not self.border:
525 return self.modules
526
527 width = len(self.modules) + self.border * 2
528 code = [[False] * width] * self.border
529 x_border = [False] * self.border
530 for module in self.modules:
531 code.append(x_border + cast(list[bool], module) + x_border)
532 code += [[False] * width] * self.border
533
534 return code
535
536 def active_with_neighbors(self, row: int, col: int) -> ActiveWithNeighbors:
537 context: list[bool] = []

Callers 2

test_get_matrixFunction · 0.95
test_get_matrix_borderFunction · 0.95

Calls 1

makeMethod · 0.95

Tested by 2

test_get_matrixFunction · 0.76
test_get_matrix_borderFunction · 0.76