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

Method add_data

qrcode/main.py:132–146  ·  view source on GitHub ↗

Add data to this QR Code. :param optimize: Data will be split into multiple chunks to optimize the QR size by finding to more compressed modes of at least this length. Set to ``0`` to avoid optimizing at all.

(self, data, optimize=20)

Source from the content-addressed store, hash-verified

130 self.data_list = []
131
132 def add_data(self, data, optimize=20):
133 """
134 Add data to this QR Code.
135
136 :param optimize: Data will be split into multiple chunks to optimize
137 the QR size by finding to more compressed modes of at least this
138 length. Set to ``0`` to avoid optimizing at all.
139 """
140 if isinstance(data, util.QRData):
141 self.data_list.append(data)
142 elif optimize:
143 self.data_list.extend(util.optimal_data_chunks(data, minimum=optimize))
144 else:
145 self.data_list.append(util.QRData(data))
146 self.data_cache = None
147
148 def make(self, fit=True):
149 """

Callers 15

mainFunction · 0.95
run_exampleFunction · 0.95
makeFunction · 0.95
test_basicFunction · 0.95
test_largeFunction · 0.95
test_overflowFunction · 0.95
test_add_qrdataFunction · 0.95
test_fitFunction · 0.95
test_mode_numberFunction · 0.95
test_mode_alphaFunction · 0.95
test_mode_8bitFunction · 0.95

Calls

no outgoing calls

Tested by 15

test_basicFunction · 0.76
test_largeFunction · 0.76
test_overflowFunction · 0.76
test_add_qrdataFunction · 0.76
test_fitFunction · 0.76
test_mode_numberFunction · 0.76
test_mode_alphaFunction · 0.76
test_mode_8bitFunction · 0.76
test_mode_8bit_newlineFunction · 0.76
test_qrcode_factoryFunction · 0.76
test_optimizeFunction · 0.76