WhyNotHugo / python-barcode

㊙️ Create standard barcodes with Python. No external dependencies. 100% Organic Python.
http://python-barcode.rtfd.io/
MIT License
558 stars 123 forks source link

Implement PZN8 #188

Open fostermaier opened 1 year ago

fostermaier commented 1 year ago

Implement PZN8 code generation. Fixes #167.

usage

check code length

>>> PZN('12345678')
barcode.errors.NumberOfDigitsError: PZN7 must have 6 digits (excluding checksum) or 7 digits (including checksum), not 8.
>>> PZN8('123456789')
barcode.errors.NumberOfDigitsError: PZN8 must have 7 digits (excluding checksum) or 8 digits (including checksum), not 9.

auto-append checksum

>>> PZN('123456')
<PZN7('PZN-1234562')>
>>> PZN8('1234567')
<PZN8('PZN-12345678')>

verify checksum if supplied

>>> PZN('1234568')
barcode.errors.BarcodeError: Checksum (last digit) is not valid for the supplied PZN7 code.
>>> PZN('1234562')
<PZN7('PZN-1234562')>

resources (mostly german)

samples

PZN7: https://barcode.tec-it.com/de/Health_PZN7

pzn7

PZN8: https://www.softmatic.com/de/barcode-code-pzn.html

pzn8
codecov[bot] commented 1 year ago

Codecov Report

Base: 80.63% // Head: 80.06% // Decreases project coverage by -0.56% :warning:

Coverage data is based on head (25cf372) compared to base (3643a65). Patch coverage: 61.11% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #188 +/- ## ========================================== - Coverage 80.63% 80.06% -0.57% ========================================== Files 17 17 Lines 888 898 +10 ========================================== + Hits 716 719 +3 - Misses 172 179 +7 ``` | [Impacted Files](https://codecov.io/gh/WhyNotHugo/python-barcode/pull/188?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Hugo+Osvaldo+Barrera) | Coverage Δ | | |---|---|---| | [barcode/codex.py](https://codecov.io/gh/WhyNotHugo/python-barcode/pull/188/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Hugo+Osvaldo+Barrera#diff-YmFyY29kZS9jb2RleC5weQ==) | `80.31% <58.82%> (-2.93%)` | :arrow_down: | | [barcode/\_\_init\_\_.py](https://codecov.io/gh/WhyNotHugo/python-barcode/pull/188/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Hugo+Osvaldo+Barrera#diff-YmFyY29kZS9fX2luaXRfXy5weQ==) | `96.00% <100.00%> (+0.08%)` | :arrow_up: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Hugo+Osvaldo+Barrera). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Hugo+Osvaldo+Barrera)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.