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

Method __init__

barcode/itf.py:34–43  ·  view source on GitHub ↗
(self, code, writer=None, narrow=2, wide=5)

Source from the content-addressed store, hash-verified

32 name = "ITF"
33
34 def __init__(self, code, writer=None, narrow=2, wide=5) -> None:
35 if not code.isdigit():
36 raise IllegalCharacterError("ITF code can only contain numbers.")
37 # Length must be even, prepend 0 if necessary
38 if len(code) % 2 != 0:
39 code = "0" + code
40 self.code = code
41 self.writer = writer or self.default_writer()
42 self.narrow = narrow
43 self.wide = wide
44
45 def __str__(self) -> str:
46 return self.code

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected