biip.symbology

Support for Symbology Identifiers.

Symbology Identifiers is a standardized way to identify what type of barcode symbology was used to encode the following data.

The Symbology Identifiers are a few extra characters that may be prefixed to the scanned data by the barcode scanning hardware. The software interpreting the barcode may use the Symbology Identifier to differentiate how to handle the barcode, but must at the very least be able to strip and ignore the extra characters.

Example

>>> from biip.symbology import SymbologyIdentifier
>>> SymbologyIdentifier.extract("]E05901234123457")
SymbologyIdentifier(value=']E0', symbology=Symbology.EAN_UPC,
modifiers='0', gs1_symbology=GS1Symbology.EAN_13)
>>> SymbologyIdentifier.extract("]I198765432109213")
SymbologyIdentifier(value=']I1', symbology=Symbology.ITF,
modifiers='1', gs1_symbology=GS1Symbology.ITF_14)

References

ISO/IEC 15424:2008.

class biip.symbology.SymbologyIdentifier(value, symbology, modifiers, gs1_symbology=None)

Data class containing a Symbology Identifier.

value: str

Raw unprocessed value.

symbology: Symbology

The recognized symbology.

modifiers: str

Symbology modifiers. Refer to gs1_symbology or ISO/IEC 15424 for interpretation.

gs1_symbology: Optional[GS1Symbology] = None

If the Symbology Identifier is used in the GS1 system, this field is set to indicate how to interpret the following data.

classmethod extract(value)

Extract the Symbology Identifier from the given value.

Parameters:

value (str) – The string to extract a Symbology Identifier from.

Return type:

SymbologyIdentifier

Returns:

Metadata about the extracted Symbology Identifier.

Raises:

ParseError – If the parsing fails.

class biip.symbology.Symbology(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Enum of barcode symbologies that are supported by Symbology Identifers.

References

ISO/IEC 15424:2008, table 1.

CODE_39 = 'A'

Code 39

TELEPEN = 'B'

Telepen

CODE_128 = 'C'

Code 128

CODE_ONE = 'D'

Code One

EAN_UPC = 'E'

EAN/UPC

CODABAR = 'F'

Codabar

CODE_93 = 'G'

Code 93

CODE_11 = 'H'

Code 11

ITF(Interleaved 2 of 5) = 'I'

ITF (Interleaved 2 of 5)

CODE_16K = 'K'

Code 16K

PDF417 = 'L'

PDF417 and MicroPDF417

MSI = 'M'

MSI

ANKER = 'N'

Anker

CODABLOCK = 'O'

Codablock

PLESSEY_CODE = 'P'

Plessey Code

QR_CODE = 'Q'

QR Code and QR Code 2005

STRAIGHT_2_OF_5_WITH_2_BAR_START_STOP_CODE = 'R'

Straigt 2 of 5 (with two bar start/stop codes)

STRAIGHT_2_OF_5_WITH_3_BAR_START_STOP_CODE = 'S'

Straigt 2 of 5 (with three bar start/stop codes)

CODE_49 = 'T'

Code 49

MAXICODE = 'U'

MaxiCode

OTHER_BARCODE = 'X'

Other barcode

SYSTEM_EXPANSION = 'Y'

System expansion

NON_BARCODE = 'Z'

Non-barcode

CHANNEL_CODE = 'c'

Channel Code

DATA_MATRIX = 'd'

Data Matrix

RSS_EAN_UCC_COMPOSITE = 'e'

RSS and EAN.UCC Composite

OCR(Optical Character Recognition) = 'o'

OCR (Optical Character Recognition)

POSICODE = 'p'

PosiCode

SUPERCODE = 's'

SuperCode

AZTEC_CODE = 'z'

Aztec Code