MCPcopy Index your code
hub / github.com/WhyNotHugo/python-barcode / _build

Method _build

barcode/codex.py:255–267  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

253 return sum(cs) % 103
254
255 def _build(self) -> list[int]:
256 encoded: list[int] = [code128.START_CODES[self._charset]]
257 for i, char in enumerate(self.code):
258 encoded.extend(self._maybe_switch_charset(i))
259 code_num = self._convert(char)
260 if code_num is not None:
261 encoded.append(code_num)
262 # Finally look in the buffer
263 if len(self._buffer) == 1:
264 encoded.extend(self._new_charset("B"))
265 encoded.append(self._convert(self._buffer[0]))
266 self._buffer = ""
267 return self._try_to_optimize(encoded)
268
269 def build(self) -> list[str]:
270 encoded = self._build()

Callers 3

encodedMethod · 0.95
buildMethod · 0.95
test_code_buildFunction · 0.80

Calls 4

_maybe_switch_charsetMethod · 0.95
_convertMethod · 0.95
_new_charsetMethod · 0.95
_try_to_optimizeMethod · 0.95

Tested by 1

test_code_buildFunction · 0.64