MCPcopy Create free account
hub / github.com/WhyNotHugo/python-barcode / check_code

Function check_code

barcode/codex.py:29–39  ·  view source on GitHub ↗
(code: str, name: str, allowed: Collection[str])

Source from the content-addressed store, hash-verified

27
28
29def check_code(code: str, name: str, allowed: Collection[str]) -> None:
30 wrong = []
31 for char in code:
32 if char not in allowed:
33 wrong.append(char)
34 if wrong:
35 raise IllegalCharacterError(
36 "The following characters are not valid for {name}: {wrong}".format(
37 name=name, wrong=", ".join(wrong)
38 )
39 )
40
41
42class Code39(Barcode):

Callers 2

__init__Method · 0.85
__init__Method · 0.85

Calls 1

Tested by

no test coverage detected