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

Method __init__

barcode/isxn.py:70–75  ·  view source on GitHub ↗
(self, isbn, writer=None)

Source from the content-addressed store, hash-verified

68 digits = 9
69
70 def __init__(self, isbn, writer=None) -> None:
71 isbn = isbn.replace("-", "")
72 isbn = isbn[: self.digits]
73 super().__init__("978" + isbn, writer)
74 self.isbn10 = isbn
75 self.isbn10 = f"{isbn}{self._calculate_checksum()}"
76
77 def _calculate_checksum(self):
78 tmp = sum(x * int(y) for x, y in enumerate(self.isbn10[:9], start=1)) % 11

Callers

nothing calls this directly

Calls 2

_calculate_checksumMethod · 0.95
__init__Method · 0.45

Tested by

no test coverage detected