ISO 6346 Freight containers: Coding, identification and marking.
Reason this release was yanked:
Checkdigit calculation incorrect.
Project description
ISO 6346 Freight Containers: Coding, Identification and Marking
Synopsis
CSC owner codes.
The calculation is based upon:
- How is the check digit of a container calculated? — Grand View Container Trading
- ISO 6346:2022 Freight containers — Coding, identification and marking
Installation
See the PyPI package iso6346-containers
:
pip install iso6346-containers
Example
>>> import iso6346
>>> iso6346.format('CHEG1231232')
'CHEG 123123 2'
>>> iso6346.format('CHEG1231232', box=True)
'CHEG 123123 [2]'
>>> iso6346.normalize('CHEG 123123 [2]')
'CHEG1231232'
>>> iso6346.checkdigit('CHEG1231232')
2
>>> iso6346.validate('CHEG1231232')
True
>>> iso6346.validate('CHEG1231238')
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/dbezborodov/src/iso6346py/src/iso6346/__init__.py", line 46, in validate
raise ValueError(f'Invalid ISO 6346 container owner number (checkdigit mismatch: expected {d}; got {e}.)')
ValueError: Invalid ISO 6346 container owner number (checkdigit mismatch: expected 2; got 8.)
See Also
langerheiko/Calc-ILU-check-digit
(JavaScript)
Example
>>> import iso6346
>>> iso6346.format('CHEG1231232')
'CHEG 123123 2'
>>> iso6346.format('CHEG1231232', box=True)
'CHEG 123123 [2]'
>>> iso6346.normalize('CHEG 123123 [2]')
'CHEG1231232'
>>> iso6346.checkdigit('CHEG1231232')
2
>>> iso6346.validate('CHEG1231232')
True
>>> iso6346.validate('CHEG1231238')
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/dbezborodov/src/iso6346py/src/iso6346/__init__.py", line 46, in validate
raise ValueError(f'Invalid ISO 6346 container owner number (checkdigit mismatch: expected {d}; got {e}.)')
ValueError: Invalid ISO 6346 container owner number (checkdigit mismatch: expected 2; got 8.)
Author
2024 Damien Bezborodov
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for iso6346_containers-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d7dbfc7aa3f813c8063677272057704edb21b03bdbbaaff07e14fd43bfca92e |
|
MD5 | d16bd74f3cdac08858aa15d83f7835f8 |
|
BLAKE2b-256 | 7f70929f1e7a138ad46d8b7a3fa5da114dc9af46ba4f86f30556cec8981df75d |