diff --git a/.github/actions/ensure-no-diff/action.yaml b/.github/actions/ensure-no-diff/action.yaml new file mode 100644 index 00000000..2ae5799d --- /dev/null +++ b/.github/actions/ensure-no-diff/action.yaml @@ -0,0 +1,42 @@ +name: Ensure no changes to tracked files +description: Detect any changes to tracked files and fail the forkflow. +inputs: + pr-comment-tag: + description: | + If specified, post a comment with changes (only on pull requests). + Comments matching this tag will be edited or deleted on subsequent runs. + required: false + default: "" + comment-header: + description: Header for the PR comment + required: false + default: "Tracked files have changed:" + comment-footer: + description: Footer for the PR comment + required: false + default: "" +runs: + using: composite + steps: + - name: git diff + id: git-diff + uses: mathiasvr/command-output@v2.0.0 + with: + shell: bash + run: git diff --diff-algorithm=histogram --exit-code + + - name: Update PR comment + if: >- + failure() && + steps.git-diff.conclusion == 'failure' && + github.event_name == 'pull_request' && + inputs.pr-comment-tag != '' + uses: thollander/actions-comment-pull-request@v3 + with: + comment-tag: ${{ inputs.comment-tag }} + mode: recreate + message: | + ${{ inputs.comment-header }} + ```diff + ${{ steps.git-diff.outputs.stdout }}``` + ${{ inputs.comment-footer }} diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index ac62a9a2..23ec1d35 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -7,12 +7,20 @@ on: push: branches: [main] +permissions: + pull-requests: write + jobs: sdist: name: Source distribution runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 + with: + # Required for dynamic version + fetch-depth: 0 + fetch-tags: true + - uses: actions/setup-python@v6 with: python-version-file: pyproject.toml @@ -33,6 +41,11 @@ jobs: name: package-sdist path: dist/*.tar.gz + - name: Ensure no changes to tracked files + uses: ./.github/actions/ensure-no-diff + with: + pr-comment-tag: ${{ github.job }} + wheels: name: Binary wheels runs-on: ${{ matrix.os }} @@ -47,6 +60,11 @@ jobs: steps: - uses: actions/checkout@v5 + with: + # Required for dynamic version + fetch-depth: 0 + fetch-tags: true + - uses: actions/setup-python@v6 with: python-version-file: pyproject.toml @@ -73,3 +91,8 @@ jobs: with: name: package-wheels-${{matrix.os}} path: ./wheelhouse/*.whl + + - name: Ensure no changes to tracked files + uses: ./.github/actions/ensure-no-diff + with: + pr-comment-tag: ${{ github.job }}/${{matrix.os}} diff --git a/CMakeLists.txt b/CMakeLists.txt index 88efbec6..3e330a40 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,11 +62,11 @@ install(TARGETS ${extension} LIBRARY DESTINATION . COMPONENT ${extension}) # generate-enums.py ---------------------------------------------------------------------------------------------------- find_package(Python3 COMPONENTS Interpreter REQUIRED) add_custom_target(_generate_enums - COMMAND "${Python3_EXECUTABLE}" scripts/generate-enums.py + COMMAND "${Python3_EXECUTABLE}" scripts/generate-enums.py --output "src/enums.g.inc" DEPENDS "scripts/generate-enums.py" - BYPRODUCTS "${CMAKE_CURRENT_SOURCE_DIR}/src/generated/enums.inc" + BYPRODUCTS "${CMAKE_CURRENT_SOURCE_DIR}/src/enums.g.inc" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" - COMMENT "Generating generated/enums.inc" + COMMENT "Generating src/enums.g.inc" VERBATIM ) add_dependencies(${extension} _generate_enums) @@ -91,18 +91,16 @@ add_custom_command(TARGET ${extension} POST_BUILD VERBATIM ) -if(Python3_VERSION_MINOR STREQUAL 13) # Update this when Python 3.14 is released - # Copy stubs into the source directory so they are visible in source control and PRs - add_custom_command(TARGET ${extension} POST_BUILD - COMMAND "${CMAKE_COMMAND}" -E copy - "${CMAKE_CURRENT_BINARY_DIR}/zint-stubs/__init__.pyi" - "src/generated/stubs.pyi" - BYPRODUCTS "src/generated/stubs.pyi" - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" - COMMENT "Updating reference stub file" - VERBATIM - ) -endif() +# Copy stubs into the source directory so they are visible in source control and PRs +add_custom_command(TARGET ${extension} POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy + "${CMAKE_CURRENT_BINARY_DIR}/zint-stubs/__init__.pyi" + "src/stubs/stub-py3${Python3_VERSION_MINOR}.g.pyi" + BYPRODUCTS "${CMAKE_CURRENT_SOURCE_DIR}/src/stubs/stub-py3${Python3_VERSION_MINOR}.g.pyi" + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + COMMENT "Updating reference stub file" + VERBATIM +) install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/zint-stubs" DESTINATION . COMPONENT ${extension}) # ---------------------------------------------------------------------------------------------------------------------- diff --git a/pyproject.toml b/pyproject.toml index 07d2ae79..04e666a8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,7 +32,9 @@ classifiers = [ ] requires-python = ">=3.9" -dependencies = [] +dependencies = [ + "typing-extensions >= 4.6; python_version < '3.12'", # For the stub file +] [project.urls] Documentation = "https://zint-bindings.readthedocs.io/" @@ -68,7 +70,7 @@ requires = [ "pip >= 24", # For installing script dependencies # Requirements from src/zint/scripts/generate-stub.requirements.txt "pybind11-stubgen == 2.5.5", - "typing-extensions >= 4.6", + "typing-extensions >= 4.6; python_version < '3.12'", "yapf", ] build-backend = "scikit_build_core.build" diff --git a/scripts/generate-enums.py b/scripts/generate-enums.py index b4450612..3ad3b4fd 100644 --- a/scripts/generate-enums.py +++ b/scripts/generate-enums.py @@ -1,11 +1,11 @@ """Generate src/generated/enums.hpp file. Run this from the root directory.""" +import argparse import io import json import re import sys from dataclasses import dataclass -from textwrap import dedent re_base_define = r"^#define (\w+) +((?:0x)?\d+)" """`#define BARCODE_CODE128 0x01`""" @@ -63,11 +63,11 @@ def parse_enum_values( name = m[1] if prefix is not None: assert name.startswith(prefix) - name = name[len(prefix) :] + name = name[len(prefix):] if suffix is not None: assert name.endswith(suffix) - name = name[: -len(suffix)] + name = name[:-len(suffix)] # Macro value value = m[2] @@ -106,6 +106,13 @@ def write_enum_macro(fd, enum: EnumInfo): fd.write(f"ENUM_END({enum.name})\n\n") +def cli(): + parser = argparse.ArgumentParser() + parser.add_argument("-o", "--output", default="-", help="output file") + + return parser + + def main(): with open("external/zint/backend/zint.h", "r", encoding="utf-8") as f: source = f.read() @@ -193,11 +200,21 @@ def main(): ), ] + result = io.StringIO() + result.write("// Generated by generate-enums.py\n") + for enum in enums: + write_enum_macro(result, enum) + + result = result.getvalue() + # Write files ------------------------------------------------------------------------------------------------------ - # Write enums.inc - with open("src/generated/enums.inc", "w", encoding="utf-8", newline="\n") as fd: - for enum in enums: - write_enum_macro(fd, enum) + args = cli().parse_args() + + if args.output == "-": + sys.stdout.write(result) + else: + with open(args.output, "w", encoding="utf-8", newline="\n") as fp: + fp.write(result) if __name__ == "__main__": diff --git a/scripts/generate-stub.requirements.txt b/scripts/generate-stub.requirements.txt index 134c6d49..8b172071 100644 --- a/scripts/generate-stub.requirements.txt +++ b/scripts/generate-stub.requirements.txt @@ -1,3 +1,3 @@ pybind11-stubgen == 2.5.5 -typing-extensions >= 4.6 +typing-extensions >= 4.6; python_version < '3.12' yapf diff --git a/src/generated/enums.inc b/src/enums.g.inc similarity index 99% rename from src/generated/enums.inc rename to src/enums.g.inc index 71505487..708f409c 100644 --- a/src/generated/enums.inc +++ b/src/enums.g.inc @@ -1,3 +1,4 @@ +// Generated by generate-enums.py ENUM_BEGIN(Symbology, int, "enum.Enum", "Values for `Symbol.symbology`") ENUM_VALUE(Symbology, CODE11, 1, "Code 11") ENUM_VALUE(Symbology, C25STANDARD, 2, "2 of 5 Standard (Matrix)") diff --git a/src/enums.hpp b/src/enums.hpp index c41895c9..d4fef273 100644 --- a/src/enums.hpp +++ b/src/enums.hpp @@ -8,7 +8,7 @@ } \ ; -#include "generated/enums.inc" +#include "enums.g.inc" #undef ENUM_BEGIN #undef ENUM_VALUE @@ -20,7 +20,7 @@ #define ENUM_VALUE(enum_name, name, value, docstring) .add(#name, enum_name::name, docstring) #define ENUM_END(enum_name) ; -#include "generated/enums.inc" +#include "enums.g.inc" #undef ENUM_BEGIN #undef ENUM_VALUE diff --git a/src/stubs/stub-py310.g.pyi b/src/stubs/stub-py310.g.pyi new file mode 100644 index 00000000..60254db4 --- /dev/null +++ b/src/stubs/stub-py310.g.pyi @@ -0,0 +1,964 @@ +""" +A barcode encoding library supporting over 50 symbologies. +""" +from __future__ import annotations +import collections.abc +import enum +import typing +import typing_extensions + +__all__: list = [ + 'Symbol', 'Symbology', 'Seg', 'StructApp', 'Vector', 'VectorCircle', 'VectorHexagon', 'VectorRect', 'VectorString', + 'CapabilityFlags', 'DataMatrixOptions', 'InputMode', 'OutputOptions', 'QrFamilyOptions', 'UltracodeOptions', + 'WarningLevel' +] + + +class CapabilityFlags(enum.Flag): + """ + Capability flags (ZBarcode_Cap() `cap_flag`) + """ + COMPLIANT_HEIGHT: typing.ClassVar[CapabilityFlags] # value = + COMPOSITE: typing.ClassVar[CapabilityFlags] # value = + DOTTY: typing.ClassVar[CapabilityFlags] # value = + EANUPC: typing.ClassVar[CapabilityFlags] # value = + ECI: typing.ClassVar[CapabilityFlags] # value = + FIXED_RATIO: typing.ClassVar[CapabilityFlags] # value = + FULL_MULTIBYTE: typing.ClassVar[CapabilityFlags] # value = + GS1: typing.ClassVar[CapabilityFlags] # value = + HRT: typing.ClassVar[CapabilityFlags] # value = + MASK: typing.ClassVar[CapabilityFlags] # value = + QUIET_ZONES: typing.ClassVar[CapabilityFlags] # value = + READER_INIT: typing.ClassVar[CapabilityFlags] # value = + STACKABLE: typing.ClassVar[CapabilityFlags] # value = + STRUCTAPP: typing.ClassVar[CapabilityFlags] # value = + + +class DataMatrixOptions(enum.IntEnum): + """ + Data Matrix specific options (`symbol->option_3`) + """ + DMRE: typing.ClassVar[DataMatrixOptions] # value = + ISO_144: typing.ClassVar[DataMatrixOptions] # value = + SQUARE: typing.ClassVar[DataMatrixOptions] # value = + + +class InputMode(enum.Flag): + """ + Values for `Symbol.input_mode` + """ + DATA: typing.ClassVar[InputMode] # value = + ESCAPE: typing.ClassVar[InputMode] # value = + EXTRA_ESCAPE: typing.ClassVar[InputMode] # value = + FAST: typing.ClassVar[InputMode] # value = + GS1: typing.ClassVar[InputMode] # value = + GS1NOCHECK: typing.ClassVar[InputMode] # value = + GS1PARENS: typing.ClassVar[InputMode] # value = + HEIGHTPERROW: typing.ClassVar[InputMode] # value = + UNICODE: typing.ClassVar[InputMode] # value = + + +class OutputOptions(enum.Flag): + """ + Values for `Symbol.output_options` + """ + BARCODE_BIND: typing.ClassVar[OutputOptions] # value = + BARCODE_BIND_TOP: typing.ClassVar[OutputOptions] # value = + BARCODE_BOX: typing.ClassVar[OutputOptions] # value = + BARCODE_DOTTY_MODE: typing.ClassVar[OutputOptions] # value = + BARCODE_MEMORY_FILE: typing.ClassVar[OutputOptions] # value = + BARCODE_NO_QUIET_ZONES: typing.ClassVar[OutputOptions] # value = + BARCODE_QUIET_ZONES: typing.ClassVar[OutputOptions] # value = + BARCODE_STDOUT: typing.ClassVar[OutputOptions] # value = + BOLD_TEXT: typing.ClassVar[OutputOptions] # value = + CMYK_COLOUR: typing.ClassVar[OutputOptions] # value = + COMPLIANT_HEIGHT: typing.ClassVar[OutputOptions] # value = + EANUPC_GUARD_WHITESPACE: typing.ClassVar[OutputOptions] # value = + EMBED_VECTOR_FONT: typing.ClassVar[OutputOptions] # value = + GS1_GS_SEPARATOR: typing.ClassVar[OutputOptions] # value = + OUT_BUFFER_INTERMEDIATE: typing.ClassVar[OutputOptions] # value = + READER_INIT: typing.ClassVar[OutputOptions] # value = + SMALL_TEXT: typing.ClassVar[OutputOptions] # value = + + +class QrFamilyOptions(enum.IntEnum): + """ + QR, Han Xin, Grid Matrix specific options (`symbol->option_3`) + """ + FULL_MULTIBYTE: typing.ClassVar[QrFamilyOptions] # value = + + +class Seg: + """ + Segment for use with `Symbol.encode_segs`. + """ + + @typing.overload + def __init__(self) -> None: + ... + + @typing.overload + def __init__(self, arg0: typing_extensions.Buffer, arg1: typing.SupportsInt) -> None: + ... + + @property + def eci(self) -> int: + """ + Extended Channel Interpretation + """ + + @eci.setter + def eci(self, arg0: typing.SupportsInt) -> None: + ... + + @property + def source(self) -> memoryview: + """ + Data to encode + """ + + @source.setter + def source(self, arg1: typing_extensions.Buffer) -> None: + ... + + +class StructApp: + """ + Structural append information (see `Symbol.structapp`). + + Ignored unless `StructApp.count` is non-zero + """ + + @typing.overload + def __init__(self) -> None: + ... + + @typing.overload + def __init__(self, index: typing.SupportsInt, count: typing.SupportsInt, id: bytes = b'') -> None: + ... + + @property + def count(self) -> int: + """ + Number of symbols in Structured Append sequence. Set >= 2 to add SA Info + """ + + @count.setter + def count(self, arg0: typing.SupportsInt) -> None: + ... + + @property + def id(self) -> bytes: + """ + Optional ID to distinguish sequence, ASCII, max 32 long + """ + + @id.setter + def id(self, arg1: bytes) -> None: + ... + + @property + def index(self) -> int: + """ + Position in Structured Append sequence, 1-based. Must be <= `count` + """ + + @index.setter + def index(self, arg0: typing.SupportsInt) -> None: + ... + + +class Symbol: + """ + Main symbol structure. + """ + + @staticmethod + def capabilities(symbology: Symbology) -> CapabilityFlags: + """ + Return the capability flags for symbology `symbology` + """ + + @staticmethod + def default_xdim(symbology: Symbology) -> float: + """ + Return default X-dimension in mm for symbology `symbology`. Returns 0 on error (invalid `symbology`) + """ + + @staticmethod + def scale_from_xdim_dp( + symbology: Symbology, + /, + x_dim_mm: typing.SupportsFloat, + *, + dpmm: typing.SupportsFloat, + filetype: str | None = None + ) -> float: + """ + Return the scale to use for `symbology` for non-zero X-dimension `x_dim_mm` at `dpmm` dots per mm for `filetype`. If `dpmm` zero defaults to 12. If `filetype` is None, defaults to "GIF". Returns 0 on error + """ + + @staticmethod + def xdim_dp_from_scale( + symbology: Symbology, + /, + scale: typing.SupportsFloat, + *, + x_dim_mm_or_dpmm: typing.SupportsFloat, + filetype: str | None = None + ) -> float: + """ + Reverse of `Symbol.scale_from_xdim_dp`. Estimate the X-dimension or dpmm given non-zero `scale` and non-zero `x_dim_mm_or_dpmm`. Return value bound to dpmm max not X-dimension max. Returns 0 on error + """ + + def __init__(self) -> None: + ... + + def buffer(self, rotate_deg: typing.SupportsInt = 0) -> None: + """ + Output a previously encoded symbol to memory as raster (`Symbol.bitmap`) + """ + + def buffer_vector(self, rotate_deg: typing.SupportsInt = 0) -> None: + """ + Output a previously encoded symbol to memory as vector (`Symbol.vector`) + """ + + def clear(self) -> None: + """ + Free any output buffers that may have been created and initialize output fields + """ + + @typing.overload + def encode(self, data: bytes) -> None: + """ + Encode a barcode + """ + + @typing.overload + def encode(self, text: str) -> None: + """ + Encode a barcode + """ + + def encode_file(self, filename: str) -> None: + """ + Encode a barcode using input data from file `filename` + """ + + @typing.overload + def encode_segs(self, segs: collections.abc.Sequence[Seg]) -> None: + """ + Encode a barcode with multiple ECI segments + """ + + @typing.overload + def encode_segs(self, segs: collections.abc.Iterable) -> None: + """ + Encode a barcode with multiple ECI segments + """ + + def print(self, rotate_deg: typing.SupportsInt = 0) -> None: + """ + Output a previously encoded symbol to file `Symbol.outfile` + """ + + def reset(self) -> None: + """ + Free any output buffers that may have been created and reset all fields to defaults + """ + + @property + def alphamap(self) -> memoryview | None: + """ + Array of alpha values used (raster output only) + """ + + @property + def bgcolor(self) -> str: + """ + Background as hexadecimal RGB/RGBA or decimal "C,M,Y,K" string. Alias of bgcolour. + """ + + @bgcolor.setter + def bgcolor(self, arg1: str) -> None: + ... + + @property + def bgcolour(self) -> str: + """ + Background as hexadecimal RGB/RGBA or decimal "C,M,Y,K" string + """ + + @bgcolour.setter + def bgcolour(self, arg1: str) -> None: + ... + + @property + def bitmap(self) -> memoryview | None: + """ + Stored bitmap image (raster output only) + """ + + @property + def border_width(self) -> int: + """ + Size of border in X-dimensions + """ + + @border_width.setter + def border_width(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def debug(self) -> int: + """ + Debugging flags + """ + + @debug.setter + def debug(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def dot_size(self) -> float: + """ + Size of dots used in BARCODE_DOTTY_MODE. Default 0.8 + """ + + @dot_size.setter + def dot_size(self, arg1: typing.SupportsFloat) -> None: + ... + + @property + def dpmm(self) -> float: + """ + Resolution of output in dots per mm (BMP/EMF/PCX/PNG/TIF only). Default 0 (none) + """ + + @dpmm.setter + def dpmm(self, arg1: typing.SupportsFloat) -> None: + ... + + @property + def eci(self) -> int: + """ + Extended Channel Interpretation. Default 0 (none) + """ + + @eci.setter + def eci(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def encoded_data(self) -> memoryview: + """ + Encoded data (output only). Allows for rows of 1152 modules + """ + + @property + def errtxt(self) -> str: + """ + Error message if an error or warning occurs (output only) + """ + + @property + def fgcolor(self) -> str: + """ + Foreground as hexadecimal RGB/RGBA or decimal "C,M,Y,K" string. Alias of fgcolour. + """ + + @fgcolor.setter + def fgcolor(self, arg1: str) -> None: + ... + + @property + def fgcolour(self) -> str: + """ + Foreground as hexadecimal RGB/RGBA or decimal "C,M,Y,K" string + """ + + @fgcolour.setter + def fgcolour(self, arg1: str) -> None: + ... + + @property + def guard_descent(self) -> float: + """ + Height in X-dimensions that EAN/UPC guard bars descend. Default 5 + """ + + @guard_descent.setter + def guard_descent(self, arg1: typing.SupportsFloat) -> None: + ... + + @property + def height(self) -> float: + """ + Barcode height in X-dimensions (ignored for fixed-width barcodes) + """ + + @height.setter + def height(self, arg1: typing.SupportsFloat) -> None: + ... + + @property + def input_mode(self) -> InputMode: + """ + Encoding of input data (see `InputMode`). Default `InputMode.DATA` + """ + + @input_mode.setter + def input_mode(self, arg1: InputMode) -> None: + ... + + @property + def memfile(self) -> memoryview | None: + """ + In-memory file buffer if BARCODE_MEMORY_FILE (output only) + """ + + @property + def option_1(self) -> int: + """ + Symbol-specific options + """ + + @option_1.setter + def option_1(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def option_2(self) -> int: + """ + Symbol-specific options + """ + + @option_2.setter + def option_2(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def option_3(self) -> int: + """ + Symbol-specific options + """ + + @option_3.setter + def option_3(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def outfile(self) -> str: + """ + Name of file to output to. Default "out.png" + """ + + @outfile.setter + def outfile(self, arg1: str) -> None: + ... + + @property + def output_options(self) -> OutputOptions: + """ + Various output parameters (bind, box etc, see `OutputOptions`) + """ + + @output_options.setter + def output_options(self, arg1: OutputOptions) -> None: + ... + + @property + def primary(self) -> str: + """ + Primary message data (MaxiCode, Composite) + """ + + @primary.setter + def primary(self, arg1: str) -> None: + ... + + @property + def row_height(self) -> list: + """ + Heights of rows (output only). Allows for 200 row DotCode + """ + + @property + def rows(self) -> int: + """ + Number of rows used by the symbol (output only) + """ + + @property + def scale(self) -> float: + """ + Scale factor when printing barcode, i.e. adjusts X-dimension. Default 1 + """ + + @scale.setter + def scale(self, arg1: typing.SupportsFloat) -> None: + ... + + @property + def show_hrt(self) -> bool: + """ + If `True`, display Human Readable Text (HRT) on supported barcodes. Default `True`. Alias of `Symbol.show_text`. + """ + + @show_hrt.setter + def show_hrt(self, arg1: bool) -> None: + ... + + @property + def show_text(self) -> bool: + """ + If `True`, display Human Readable Text (HRT) on supported barcodes. Default `True` + """ + + @show_text.setter + def show_text(self, arg1: bool) -> None: + ... + + @property + def structapp(self) -> StructApp: + """ + Structured Append info. Default structapp.count 0 (none) + """ + + @structapp.setter + def structapp(self, arg1: StructApp) -> None: + ... + + @property + def symbology(self) -> Symbology: + """ + Symbol type to use (see `Symbology`) + """ + + @symbology.setter + def symbology(self, arg1: Symbology) -> None: + ... + + @property + def text(self) -> str: + """ + Human Readable Text (HRT) (if any), UTF-8 (output only) + """ + + @property + def text_gap(self) -> float: + """ + Gap between barcode and Human Readable Text (HRT) in X-dimensions. Default 1 + """ + + @text_gap.setter + def text_gap(self, arg1: typing.SupportsFloat) -> None: + ... + + @property + def vector(self) -> Vector: + """ + Vector header (vector output only) + """ + + @property + def warn_level(self) -> WarningLevel: + """ + Affects error/warning value returned by Zint API (see `WarningLevel`) + """ + + @warn_level.setter + def warn_level(self, arg1: WarningLevel) -> None: + ... + + @property + def whitespace_height(self) -> int: + """ + Height in X-dimensions of whitespace above & below the barcode + """ + + @whitespace_height.setter + def whitespace_height(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def whitespace_width(self) -> int: + """ + Width in X-dimensions of whitespace to left & right of barcode + """ + + @whitespace_width.setter + def whitespace_width(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def width(self) -> int: + """ + Width of the generated symbol (output only) + """ + + +class Symbology(enum.Enum): + """ + Values for `Symbol.symbology` + """ + AUSPOST: typing.ClassVar[Symbology] # value = + AUSREDIRECT: typing.ClassVar[Symbology] # value = + AUSREPLY: typing.ClassVar[Symbology] # value = + AUSROUTE: typing.ClassVar[Symbology] # value = + AZRUNE: typing.ClassVar[Symbology] # value = + AZTEC: typing.ClassVar[Symbology] # value = + BC412: typing.ClassVar[Symbology] # value = + C25IATA: typing.ClassVar[Symbology] # value = + C25IND: typing.ClassVar[Symbology] # value = + C25INTER: typing.ClassVar[Symbology] # value = + C25LOGIC: typing.ClassVar[Symbology] # value = + C25STANDARD: typing.ClassVar[Symbology] # value = + CEPNET: typing.ClassVar[Symbology] # value = + CHANNEL: typing.ClassVar[Symbology] # value = + CODABAR: typing.ClassVar[Symbology] # value = + CODABLOCKF: typing.ClassVar[Symbology] # value = + CODE11: typing.ClassVar[Symbology] # value = + CODE128: typing.ClassVar[Symbology] # value = + CODE128AB: typing.ClassVar[Symbology] # value = + CODE16K: typing.ClassVar[Symbology] # value = + CODE32: typing.ClassVar[Symbology] # value = + CODE39: typing.ClassVar[Symbology] # value = + CODE49: typing.ClassVar[Symbology] # value = + CODE93: typing.ClassVar[Symbology] # value = + CODEONE: typing.ClassVar[Symbology] # value = + DAFT: typing.ClassVar[Symbology] # value = + DATAMATRIX: typing.ClassVar[Symbology] # value = + DBAR_EXP: typing.ClassVar[Symbology] # value = + DBAR_EXPSTK: typing.ClassVar[Symbology] # value = + DBAR_EXPSTK_CC: typing.ClassVar[Symbology] # value = + DBAR_EXP_CC: typing.ClassVar[Symbology] # value = + DBAR_LTD: typing.ClassVar[Symbology] # value = + DBAR_LTD_CC: typing.ClassVar[Symbology] # value = + DBAR_OMN: typing.ClassVar[Symbology] # value = + DBAR_OMNSTK: typing.ClassVar[Symbology] # value = + DBAR_OMNSTK_CC: typing.ClassVar[Symbology] # value = + DBAR_OMN_CC: typing.ClassVar[Symbology] # value = + DBAR_STK: typing.ClassVar[Symbology] # value = + DBAR_STK_CC: typing.ClassVar[Symbology] # value = + DOTCODE: typing.ClassVar[Symbology] # value = + DPD: typing.ClassVar[Symbology] # value = + DPIDENT: typing.ClassVar[Symbology] # value = + DPLEIT: typing.ClassVar[Symbology] # value = + DXFILMEDGE: typing.ClassVar[Symbology] # value = + EAN14: typing.ClassVar[Symbology] # value = + EANX: typing.ClassVar[Symbology] # value = + EANX_CC: typing.ClassVar[Symbology] # value = + EANX_CHK: typing.ClassVar[Symbology] # value = + EXCODE39: typing.ClassVar[Symbology] # value = + FIM: typing.ClassVar[Symbology] # value = + FLAT: typing.ClassVar[Symbology] # value = + GRIDMATRIX: typing.ClassVar[Symbology] # value = + GS1_128: typing.ClassVar[Symbology] # value = + GS1_128_CC: typing.ClassVar[Symbology] # value = + HANXIN: typing.ClassVar[Symbology] # value = + HIBC_128: typing.ClassVar[Symbology] # value = + HIBC_39: typing.ClassVar[Symbology] # value = + HIBC_AZTEC: typing.ClassVar[Symbology] # value = + HIBC_BLOCKF: typing.ClassVar[Symbology] # value = + HIBC_DM: typing.ClassVar[Symbology] # value = + HIBC_MICPDF: typing.ClassVar[Symbology] # value = + HIBC_PDF: typing.ClassVar[Symbology] # value = + HIBC_QR: typing.ClassVar[Symbology] # value = + ISBNX: typing.ClassVar[Symbology] # value = + ITF14: typing.ClassVar[Symbology] # value = + JAPANPOST: typing.ClassVar[Symbology] # value = + KIX: typing.ClassVar[Symbology] # value = + KOREAPOST: typing.ClassVar[Symbology] # value = + LOGMARS: typing.ClassVar[Symbology] # value = + MAILMARK_2D: typing.ClassVar[Symbology] # value = + MAILMARK_4S: typing.ClassVar[Symbology] # value = + MAXICODE: typing.ClassVar[Symbology] # value = + MICROPDF417: typing.ClassVar[Symbology] # value = + MICROQR: typing.ClassVar[Symbology] # value = + MSI_PLESSEY: typing.ClassVar[Symbology] # value = + NVE18: typing.ClassVar[Symbology] # value = + PDF417: typing.ClassVar[Symbology] # value = + PDF417COMP: typing.ClassVar[Symbology] # value = + PHARMA: typing.ClassVar[Symbology] # value = + PHARMA_TWO: typing.ClassVar[Symbology] # value = + PLANET: typing.ClassVar[Symbology] # value = + PLESSEY: typing.ClassVar[Symbology] # value = + POSTNET: typing.ClassVar[Symbology] # value = + PZN: typing.ClassVar[Symbology] # value = + QRCODE: typing.ClassVar[Symbology] # value = + RM4SCC: typing.ClassVar[Symbology] # value = + RMQR: typing.ClassVar[Symbology] # value = + TELEPEN: typing.ClassVar[Symbology] # value = + TELEPEN_NUM: typing.ClassVar[Symbology] # value = + ULTRA: typing.ClassVar[Symbology] # value = + UPCA: typing.ClassVar[Symbology] # value = + UPCA_CC: typing.ClassVar[Symbology] # value = + UPCA_CHK: typing.ClassVar[Symbology] # value = + UPCE: typing.ClassVar[Symbology] # value = + UPCE_CC: typing.ClassVar[Symbology] # value = + UPCE_CHK: typing.ClassVar[Symbology] # value = + UPNQR: typing.ClassVar[Symbology] # value = + UPU_S10: typing.ClassVar[Symbology] # value = + USPS_IMAIL: typing.ClassVar[Symbology] # value = + VIN: typing.ClassVar[Symbology] # value = + + +class UltracodeOptions(enum.IntEnum): + """ + Ultracode specific option (`symbol->option_3`) + """ + ULTRA_COMPRESSION: typing.ClassVar[UltracodeOptions] # value = + + +class Vector: + """ + Vector image information, returned from `Symbol.vector` after calling `Symbol.buffer_vector` + """ + + @property + def circles(self) -> VectorCircles: + """ + An iterable over circles (`VectorCircle`) + """ + + @property + def height(self) -> float: + """ + Height of barcode image (including text, whitespace) + """ + + @property + def hexagons(self) -> VectorHexagons: + """ + An iterable over hexagons (`VectorHexagon`) + """ + + @property + def rectangles(self) -> VectorRects: + """ + An iterable over rectangles (`VectorRectangle`) + """ + + @property + def strings(self) -> VectorStrings: + """ + An iterable over strings (`VectorString`) + """ + + @property + def width(self) -> float: + """ + Width of barcode image (including text, whitespace) + """ + + +class VectorCircle: + """ + Circle vector elements returned from `Vector.circles` + """ + + @property + def color(self) -> int: + """ + Zero for draw with foreground colour (else draw with background colour (legacy)). Alias of `colour` + """ + + @property + def colour(self) -> int: + """ + Zero for draw with foreground colour (else draw with background colour (legacy)) + """ + + @property + def diameter(self) -> float: + """ + Circle diameter. Does not include width (if any) + """ + + @property + def width(self) -> float: + """ + Width of circle perimeter (circumference). 0 for fill (disc) + """ + + @property + def x(self) -> float: + """ + Centre + """ + + @property + def y(self) -> float: + """ + Centre + """ + + +class VectorCircles: + + def __iter__(self) -> collections.abc.Iterator[VectorCircle]: + ... + + def __len__(self) -> int: + ... + + +class VectorHexagon: + """ + Hexagon vector elements returned from `Vector.hexagons` + """ + + @property + def diameter(self) -> float: + """ + Short (minimal) diameter (i.e. diameter of inscribed circle) + """ + + @property + def rotation(self) -> int: + """ + 0, 90, 180, 270 degrees, where 0 has apex at top, i.e. short diameter is horizontal + """ + + @property + def x(self) -> float: + """ + Centre + """ + + @property + def y(self) -> float: + """ + Centre + """ + + +class VectorHexagons: + + def __iter__(self) -> collections.abc.Iterator[VectorHexagon]: + ... + + def __len__(self) -> int: + ... + + +class VectorRect: + """ + Rectangle vector elements returned from `Vector.rectangles` + """ + + @property + def color(self) -> int: + """ + -1 for foreground, 1-8 for Cyan, Blue, Magenta, Red, Yellow, Green, Black, White. Alias of `colour` + """ + + @property + def colour(self) -> int: + """ + -1 for foreground, 1-8 for Cyan, Blue, Magenta, Red, Yellow, Green, Black, White + """ + + @property + def height(self) -> float: + ... + + @property + def width(self) -> float: + ... + + @property + def x(self) -> float: + """ + Left + """ + + @property + def y(self) -> float: + """ + Top + """ + + +class VectorRects: + + def __iter__(self) -> collections.abc.Iterator[VectorRect]: + ... + + def __len__(self) -> int: + ... + + +class VectorString: + """ + String vector elements returned from `Vector.strings` + """ + + @property + def fsize(self) -> float: + """ + Font size + """ + + @property + def halign(self) -> int: + """ + Horizontal alignment: 0 for centre, 1 for left, 2 for right (end) + """ + + @property + def length(self) -> int: + """ + Number of characters (bytes) + """ + + @property + def rotation(self) -> int: + """ + 0, 90, 180, 270 degrees + """ + + @property + def text(self) -> str: + ... + + @property + def width(self) -> float: + """ + Rendered width estimate + """ + + @property + def x(self) -> float: + """ + Relative to halign (i.e. centre, left, right) + """ + + @property + def y(self) -> float: + """ + Relative to baseline + """ + + +class VectorStrings: + + def __iter__(self) -> collections.abc.Iterator[VectorString]: + ... + + def __len__(self) -> int: + ... + + +class WarningLevel(enum.Enum): + """ + Warning level (`symbol->warn_level`) + """ + DEFAULT: typing.ClassVar[WarningLevel] # value = + FAIL_ALL: typing.ClassVar[WarningLevel] # value = + + +__upstream_version__: str = '2.15.0' +__version__: str = '1.2.2' diff --git a/src/stubs/stub-py311.g.pyi b/src/stubs/stub-py311.g.pyi new file mode 100644 index 00000000..69ceaafb --- /dev/null +++ b/src/stubs/stub-py311.g.pyi @@ -0,0 +1,984 @@ +""" +A barcode encoding library supporting over 50 symbologies. +""" +from __future__ import annotations +import collections.abc +import enum +import typing +import typing_extensions + +__all__: list = [ + 'Symbol', 'Symbology', 'Seg', 'StructApp', 'Vector', 'VectorCircle', 'VectorHexagon', 'VectorRect', 'VectorString', + 'CapabilityFlags', 'DataMatrixOptions', 'InputMode', 'OutputOptions', 'QrFamilyOptions', 'UltracodeOptions', + 'WarningLevel' +] + + +class CapabilityFlags(enum.Flag): + """ + Capability flags (ZBarcode_Cap() `cap_flag`) + """ + COMPLIANT_HEIGHT: typing.ClassVar[CapabilityFlags] # value = + COMPOSITE: typing.ClassVar[CapabilityFlags] # value = + DOTTY: typing.ClassVar[CapabilityFlags] # value = + EANUPC: typing.ClassVar[CapabilityFlags] # value = + ECI: typing.ClassVar[CapabilityFlags] # value = + FIXED_RATIO: typing.ClassVar[CapabilityFlags] # value = + FULL_MULTIBYTE: typing.ClassVar[CapabilityFlags] # value = + GS1: typing.ClassVar[CapabilityFlags] # value = + HRT: typing.ClassVar[CapabilityFlags] # value = + MASK: typing.ClassVar[CapabilityFlags] # value = + QUIET_ZONES: typing.ClassVar[CapabilityFlags] # value = + READER_INIT: typing.ClassVar[CapabilityFlags] # value = + STACKABLE: typing.ClassVar[CapabilityFlags] # value = + STRUCTAPP: typing.ClassVar[CapabilityFlags] # value = + + +class DataMatrixOptions(enum.IntEnum): + """ + Data Matrix specific options (`symbol->option_3`) + """ + DMRE: typing.ClassVar[DataMatrixOptions] # value = + ISO_144: typing.ClassVar[DataMatrixOptions] # value = + SQUARE: typing.ClassVar[DataMatrixOptions] # value = + + @classmethod + def __new__(cls, value): + ... + + def __format__(self, format_spec): + ... + + +class InputMode(enum.Flag): + """ + Values for `Symbol.input_mode` + """ + ESCAPE: typing.ClassVar[InputMode] # value = + EXTRA_ESCAPE: typing.ClassVar[InputMode] # value = + FAST: typing.ClassVar[InputMode] # value = + GS1: typing.ClassVar[InputMode] # value = + GS1NOCHECK: typing.ClassVar[InputMode] # value = + GS1PARENS: typing.ClassVar[InputMode] # value = + HEIGHTPERROW: typing.ClassVar[InputMode] # value = + UNICODE: typing.ClassVar[InputMode] # value = + + +class OutputOptions(enum.Flag): + """ + Values for `Symbol.output_options` + """ + BARCODE_BIND: typing.ClassVar[OutputOptions] # value = + BARCODE_BIND_TOP: typing.ClassVar[OutputOptions] # value = + BARCODE_BOX: typing.ClassVar[OutputOptions] # value = + BARCODE_DOTTY_MODE: typing.ClassVar[OutputOptions] # value = + BARCODE_MEMORY_FILE: typing.ClassVar[OutputOptions] # value = + BARCODE_NO_QUIET_ZONES: typing.ClassVar[OutputOptions] # value = + BARCODE_QUIET_ZONES: typing.ClassVar[OutputOptions] # value = + BARCODE_STDOUT: typing.ClassVar[OutputOptions] # value = + BOLD_TEXT: typing.ClassVar[OutputOptions] # value = + CMYK_COLOUR: typing.ClassVar[OutputOptions] # value = + COMPLIANT_HEIGHT: typing.ClassVar[OutputOptions] # value = + EANUPC_GUARD_WHITESPACE: typing.ClassVar[OutputOptions] # value = + EMBED_VECTOR_FONT: typing.ClassVar[OutputOptions] # value = + GS1_GS_SEPARATOR: typing.ClassVar[OutputOptions] # value = + OUT_BUFFER_INTERMEDIATE: typing.ClassVar[OutputOptions] # value = + READER_INIT: typing.ClassVar[OutputOptions] # value = + SMALL_TEXT: typing.ClassVar[OutputOptions] # value = + + +class QrFamilyOptions(enum.IntEnum): + """ + QR, Han Xin, Grid Matrix specific options (`symbol->option_3`) + """ + FULL_MULTIBYTE: typing.ClassVar[QrFamilyOptions] # value = + + @classmethod + def __new__(cls, value): + ... + + def __format__(self, format_spec): + ... + + +class Seg: + """ + Segment for use with `Symbol.encode_segs`. + """ + + @typing.overload + def __init__(self) -> None: + ... + + @typing.overload + def __init__(self, arg0: typing_extensions.Buffer, arg1: typing.SupportsInt) -> None: + ... + + @property + def eci(self) -> int: + """ + Extended Channel Interpretation + """ + + @eci.setter + def eci(self, arg0: typing.SupportsInt) -> None: + ... + + @property + def source(self) -> memoryview: + """ + Data to encode + """ + + @source.setter + def source(self, arg1: typing_extensions.Buffer) -> None: + ... + + +class StructApp: + """ + Structural append information (see `Symbol.structapp`). + + Ignored unless `StructApp.count` is non-zero + """ + + @typing.overload + def __init__(self) -> None: + ... + + @typing.overload + def __init__(self, index: typing.SupportsInt, count: typing.SupportsInt, id: bytes = b'') -> None: + ... + + @property + def count(self) -> int: + """ + Number of symbols in Structured Append sequence. Set >= 2 to add SA Info + """ + + @count.setter + def count(self, arg0: typing.SupportsInt) -> None: + ... + + @property + def id(self) -> bytes: + """ + Optional ID to distinguish sequence, ASCII, max 32 long + """ + + @id.setter + def id(self, arg1: bytes) -> None: + ... + + @property + def index(self) -> int: + """ + Position in Structured Append sequence, 1-based. Must be <= `count` + """ + + @index.setter + def index(self, arg0: typing.SupportsInt) -> None: + ... + + +class Symbol: + """ + Main symbol structure. + """ + + @staticmethod + def capabilities(symbology: Symbology) -> CapabilityFlags: + """ + Return the capability flags for symbology `symbology` + """ + + @staticmethod + def default_xdim(symbology: Symbology) -> float: + """ + Return default X-dimension in mm for symbology `symbology`. Returns 0 on error (invalid `symbology`) + """ + + @staticmethod + def scale_from_xdim_dp( + symbology: Symbology, + /, + x_dim_mm: typing.SupportsFloat, + *, + dpmm: typing.SupportsFloat, + filetype: str | None = None + ) -> float: + """ + Return the scale to use for `symbology` for non-zero X-dimension `x_dim_mm` at `dpmm` dots per mm for `filetype`. If `dpmm` zero defaults to 12. If `filetype` is None, defaults to "GIF". Returns 0 on error + """ + + @staticmethod + def xdim_dp_from_scale( + symbology: Symbology, + /, + scale: typing.SupportsFloat, + *, + x_dim_mm_or_dpmm: typing.SupportsFloat, + filetype: str | None = None + ) -> float: + """ + Reverse of `Symbol.scale_from_xdim_dp`. Estimate the X-dimension or dpmm given non-zero `scale` and non-zero `x_dim_mm_or_dpmm`. Return value bound to dpmm max not X-dimension max. Returns 0 on error + """ + + def __init__(self) -> None: + ... + + def buffer(self, rotate_deg: typing.SupportsInt = 0) -> None: + """ + Output a previously encoded symbol to memory as raster (`Symbol.bitmap`) + """ + + def buffer_vector(self, rotate_deg: typing.SupportsInt = 0) -> None: + """ + Output a previously encoded symbol to memory as vector (`Symbol.vector`) + """ + + def clear(self) -> None: + """ + Free any output buffers that may have been created and initialize output fields + """ + + @typing.overload + def encode(self, data: bytes) -> None: + """ + Encode a barcode + """ + + @typing.overload + def encode(self, text: str) -> None: + """ + Encode a barcode + """ + + def encode_file(self, filename: str) -> None: + """ + Encode a barcode using input data from file `filename` + """ + + @typing.overload + def encode_segs(self, segs: collections.abc.Sequence[Seg]) -> None: + """ + Encode a barcode with multiple ECI segments + """ + + @typing.overload + def encode_segs(self, segs: collections.abc.Iterable) -> None: + """ + Encode a barcode with multiple ECI segments + """ + + def print(self, rotate_deg: typing.SupportsInt = 0) -> None: + """ + Output a previously encoded symbol to file `Symbol.outfile` + """ + + def reset(self) -> None: + """ + Free any output buffers that may have been created and reset all fields to defaults + """ + + @property + def alphamap(self) -> memoryview | None: + """ + Array of alpha values used (raster output only) + """ + + @property + def bgcolor(self) -> str: + """ + Background as hexadecimal RGB/RGBA or decimal "C,M,Y,K" string. Alias of bgcolour. + """ + + @bgcolor.setter + def bgcolor(self, arg1: str) -> None: + ... + + @property + def bgcolour(self) -> str: + """ + Background as hexadecimal RGB/RGBA or decimal "C,M,Y,K" string + """ + + @bgcolour.setter + def bgcolour(self, arg1: str) -> None: + ... + + @property + def bitmap(self) -> memoryview | None: + """ + Stored bitmap image (raster output only) + """ + + @property + def border_width(self) -> int: + """ + Size of border in X-dimensions + """ + + @border_width.setter + def border_width(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def debug(self) -> int: + """ + Debugging flags + """ + + @debug.setter + def debug(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def dot_size(self) -> float: + """ + Size of dots used in BARCODE_DOTTY_MODE. Default 0.8 + """ + + @dot_size.setter + def dot_size(self, arg1: typing.SupportsFloat) -> None: + ... + + @property + def dpmm(self) -> float: + """ + Resolution of output in dots per mm (BMP/EMF/PCX/PNG/TIF only). Default 0 (none) + """ + + @dpmm.setter + def dpmm(self, arg1: typing.SupportsFloat) -> None: + ... + + @property + def eci(self) -> int: + """ + Extended Channel Interpretation. Default 0 (none) + """ + + @eci.setter + def eci(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def encoded_data(self) -> memoryview: + """ + Encoded data (output only). Allows for rows of 1152 modules + """ + + @property + def errtxt(self) -> str: + """ + Error message if an error or warning occurs (output only) + """ + + @property + def fgcolor(self) -> str: + """ + Foreground as hexadecimal RGB/RGBA or decimal "C,M,Y,K" string. Alias of fgcolour. + """ + + @fgcolor.setter + def fgcolor(self, arg1: str) -> None: + ... + + @property + def fgcolour(self) -> str: + """ + Foreground as hexadecimal RGB/RGBA or decimal "C,M,Y,K" string + """ + + @fgcolour.setter + def fgcolour(self, arg1: str) -> None: + ... + + @property + def guard_descent(self) -> float: + """ + Height in X-dimensions that EAN/UPC guard bars descend. Default 5 + """ + + @guard_descent.setter + def guard_descent(self, arg1: typing.SupportsFloat) -> None: + ... + + @property + def height(self) -> float: + """ + Barcode height in X-dimensions (ignored for fixed-width barcodes) + """ + + @height.setter + def height(self, arg1: typing.SupportsFloat) -> None: + ... + + @property + def input_mode(self) -> InputMode: + """ + Encoding of input data (see `InputMode`). Default `InputMode.DATA` + """ + + @input_mode.setter + def input_mode(self, arg1: InputMode) -> None: + ... + + @property + def memfile(self) -> memoryview | None: + """ + In-memory file buffer if BARCODE_MEMORY_FILE (output only) + """ + + @property + def option_1(self) -> int: + """ + Symbol-specific options + """ + + @option_1.setter + def option_1(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def option_2(self) -> int: + """ + Symbol-specific options + """ + + @option_2.setter + def option_2(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def option_3(self) -> int: + """ + Symbol-specific options + """ + + @option_3.setter + def option_3(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def outfile(self) -> str: + """ + Name of file to output to. Default "out.png" + """ + + @outfile.setter + def outfile(self, arg1: str) -> None: + ... + + @property + def output_options(self) -> OutputOptions: + """ + Various output parameters (bind, box etc, see `OutputOptions`) + """ + + @output_options.setter + def output_options(self, arg1: OutputOptions) -> None: + ... + + @property + def primary(self) -> str: + """ + Primary message data (MaxiCode, Composite) + """ + + @primary.setter + def primary(self, arg1: str) -> None: + ... + + @property + def row_height(self) -> list: + """ + Heights of rows (output only). Allows for 200 row DotCode + """ + + @property + def rows(self) -> int: + """ + Number of rows used by the symbol (output only) + """ + + @property + def scale(self) -> float: + """ + Scale factor when printing barcode, i.e. adjusts X-dimension. Default 1 + """ + + @scale.setter + def scale(self, arg1: typing.SupportsFloat) -> None: + ... + + @property + def show_hrt(self) -> bool: + """ + If `True`, display Human Readable Text (HRT) on supported barcodes. Default `True`. Alias of `Symbol.show_text`. + """ + + @show_hrt.setter + def show_hrt(self, arg1: bool) -> None: + ... + + @property + def show_text(self) -> bool: + """ + If `True`, display Human Readable Text (HRT) on supported barcodes. Default `True` + """ + + @show_text.setter + def show_text(self, arg1: bool) -> None: + ... + + @property + def structapp(self) -> StructApp: + """ + Structured Append info. Default structapp.count 0 (none) + """ + + @structapp.setter + def structapp(self, arg1: StructApp) -> None: + ... + + @property + def symbology(self) -> Symbology: + """ + Symbol type to use (see `Symbology`) + """ + + @symbology.setter + def symbology(self, arg1: Symbology) -> None: + ... + + @property + def text(self) -> str: + """ + Human Readable Text (HRT) (if any), UTF-8 (output only) + """ + + @property + def text_gap(self) -> float: + """ + Gap between barcode and Human Readable Text (HRT) in X-dimensions. Default 1 + """ + + @text_gap.setter + def text_gap(self, arg1: typing.SupportsFloat) -> None: + ... + + @property + def vector(self) -> Vector: + """ + Vector header (vector output only) + """ + + @property + def warn_level(self) -> WarningLevel: + """ + Affects error/warning value returned by Zint API (see `WarningLevel`) + """ + + @warn_level.setter + def warn_level(self, arg1: WarningLevel) -> None: + ... + + @property + def whitespace_height(self) -> int: + """ + Height in X-dimensions of whitespace above & below the barcode + """ + + @whitespace_height.setter + def whitespace_height(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def whitespace_width(self) -> int: + """ + Width in X-dimensions of whitespace to left & right of barcode + """ + + @whitespace_width.setter + def whitespace_width(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def width(self) -> int: + """ + Width of the generated symbol (output only) + """ + + +class Symbology(enum.Enum): + """ + Values for `Symbol.symbology` + """ + AUSPOST: typing.ClassVar[Symbology] # value = + AUSREDIRECT: typing.ClassVar[Symbology] # value = + AUSREPLY: typing.ClassVar[Symbology] # value = + AUSROUTE: typing.ClassVar[Symbology] # value = + AZRUNE: typing.ClassVar[Symbology] # value = + AZTEC: typing.ClassVar[Symbology] # value = + BC412: typing.ClassVar[Symbology] # value = + C25IATA: typing.ClassVar[Symbology] # value = + C25IND: typing.ClassVar[Symbology] # value = + C25INTER: typing.ClassVar[Symbology] # value = + C25LOGIC: typing.ClassVar[Symbology] # value = + C25STANDARD: typing.ClassVar[Symbology] # value = + CEPNET: typing.ClassVar[Symbology] # value = + CHANNEL: typing.ClassVar[Symbology] # value = + CODABAR: typing.ClassVar[Symbology] # value = + CODABLOCKF: typing.ClassVar[Symbology] # value = + CODE11: typing.ClassVar[Symbology] # value = + CODE128: typing.ClassVar[Symbology] # value = + CODE128AB: typing.ClassVar[Symbology] # value = + CODE16K: typing.ClassVar[Symbology] # value = + CODE32: typing.ClassVar[Symbology] # value = + CODE39: typing.ClassVar[Symbology] # value = + CODE49: typing.ClassVar[Symbology] # value = + CODE93: typing.ClassVar[Symbology] # value = + CODEONE: typing.ClassVar[Symbology] # value = + DAFT: typing.ClassVar[Symbology] # value = + DATAMATRIX: typing.ClassVar[Symbology] # value = + DBAR_EXP: typing.ClassVar[Symbology] # value = + DBAR_EXPSTK: typing.ClassVar[Symbology] # value = + DBAR_EXPSTK_CC: typing.ClassVar[Symbology] # value = + DBAR_EXP_CC: typing.ClassVar[Symbology] # value = + DBAR_LTD: typing.ClassVar[Symbology] # value = + DBAR_LTD_CC: typing.ClassVar[Symbology] # value = + DBAR_OMN: typing.ClassVar[Symbology] # value = + DBAR_OMNSTK: typing.ClassVar[Symbology] # value = + DBAR_OMNSTK_CC: typing.ClassVar[Symbology] # value = + DBAR_OMN_CC: typing.ClassVar[Symbology] # value = + DBAR_STK: typing.ClassVar[Symbology] # value = + DBAR_STK_CC: typing.ClassVar[Symbology] # value = + DOTCODE: typing.ClassVar[Symbology] # value = + DPD: typing.ClassVar[Symbology] # value = + DPIDENT: typing.ClassVar[Symbology] # value = + DPLEIT: typing.ClassVar[Symbology] # value = + DXFILMEDGE: typing.ClassVar[Symbology] # value = + EAN14: typing.ClassVar[Symbology] # value = + EANX: typing.ClassVar[Symbology] # value = + EANX_CC: typing.ClassVar[Symbology] # value = + EANX_CHK: typing.ClassVar[Symbology] # value = + EXCODE39: typing.ClassVar[Symbology] # value = + FIM: typing.ClassVar[Symbology] # value = + FLAT: typing.ClassVar[Symbology] # value = + GRIDMATRIX: typing.ClassVar[Symbology] # value = + GS1_128: typing.ClassVar[Symbology] # value = + GS1_128_CC: typing.ClassVar[Symbology] # value = + HANXIN: typing.ClassVar[Symbology] # value = + HIBC_128: typing.ClassVar[Symbology] # value = + HIBC_39: typing.ClassVar[Symbology] # value = + HIBC_AZTEC: typing.ClassVar[Symbology] # value = + HIBC_BLOCKF: typing.ClassVar[Symbology] # value = + HIBC_DM: typing.ClassVar[Symbology] # value = + HIBC_MICPDF: typing.ClassVar[Symbology] # value = + HIBC_PDF: typing.ClassVar[Symbology] # value = + HIBC_QR: typing.ClassVar[Symbology] # value = + ISBNX: typing.ClassVar[Symbology] # value = + ITF14: typing.ClassVar[Symbology] # value = + JAPANPOST: typing.ClassVar[Symbology] # value = + KIX: typing.ClassVar[Symbology] # value = + KOREAPOST: typing.ClassVar[Symbology] # value = + LOGMARS: typing.ClassVar[Symbology] # value = + MAILMARK_2D: typing.ClassVar[Symbology] # value = + MAILMARK_4S: typing.ClassVar[Symbology] # value = + MAXICODE: typing.ClassVar[Symbology] # value = + MICROPDF417: typing.ClassVar[Symbology] # value = + MICROQR: typing.ClassVar[Symbology] # value = + MSI_PLESSEY: typing.ClassVar[Symbology] # value = + NVE18: typing.ClassVar[Symbology] # value = + PDF417: typing.ClassVar[Symbology] # value = + PDF417COMP: typing.ClassVar[Symbology] # value = + PHARMA: typing.ClassVar[Symbology] # value = + PHARMA_TWO: typing.ClassVar[Symbology] # value = + PLANET: typing.ClassVar[Symbology] # value = + PLESSEY: typing.ClassVar[Symbology] # value = + POSTNET: typing.ClassVar[Symbology] # value = + PZN: typing.ClassVar[Symbology] # value = + QRCODE: typing.ClassVar[Symbology] # value = + RM4SCC: typing.ClassVar[Symbology] # value = + RMQR: typing.ClassVar[Symbology] # value = + TELEPEN: typing.ClassVar[Symbology] # value = + TELEPEN_NUM: typing.ClassVar[Symbology] # value = + ULTRA: typing.ClassVar[Symbology] # value = + UPCA: typing.ClassVar[Symbology] # value = + UPCA_CC: typing.ClassVar[Symbology] # value = + UPCA_CHK: typing.ClassVar[Symbology] # value = + UPCE: typing.ClassVar[Symbology] # value = + UPCE_CC: typing.ClassVar[Symbology] # value = + UPCE_CHK: typing.ClassVar[Symbology] # value = + UPNQR: typing.ClassVar[Symbology] # value = + UPU_S10: typing.ClassVar[Symbology] # value = + USPS_IMAIL: typing.ClassVar[Symbology] # value = + VIN: typing.ClassVar[Symbology] # value = + + +class UltracodeOptions(enum.IntEnum): + """ + Ultracode specific option (`symbol->option_3`) + """ + ULTRA_COMPRESSION: typing.ClassVar[UltracodeOptions] # value = + + @classmethod + def __new__(cls, value): + ... + + def __format__(self, format_spec): + ... + + +class Vector: + """ + Vector image information, returned from `Symbol.vector` after calling `Symbol.buffer_vector` + """ + + @property + def circles(self) -> VectorCircles: + """ + An iterable over circles (`VectorCircle`) + """ + + @property + def height(self) -> float: + """ + Height of barcode image (including text, whitespace) + """ + + @property + def hexagons(self) -> VectorHexagons: + """ + An iterable over hexagons (`VectorHexagon`) + """ + + @property + def rectangles(self) -> VectorRects: + """ + An iterable over rectangles (`VectorRectangle`) + """ + + @property + def strings(self) -> VectorStrings: + """ + An iterable over strings (`VectorString`) + """ + + @property + def width(self) -> float: + """ + Width of barcode image (including text, whitespace) + """ + + +class VectorCircle: + """ + Circle vector elements returned from `Vector.circles` + """ + + @property + def color(self) -> int: + """ + Zero for draw with foreground colour (else draw with background colour (legacy)). Alias of `colour` + """ + + @property + def colour(self) -> int: + """ + Zero for draw with foreground colour (else draw with background colour (legacy)) + """ + + @property + def diameter(self) -> float: + """ + Circle diameter. Does not include width (if any) + """ + + @property + def width(self) -> float: + """ + Width of circle perimeter (circumference). 0 for fill (disc) + """ + + @property + def x(self) -> float: + """ + Centre + """ + + @property + def y(self) -> float: + """ + Centre + """ + + +class VectorCircles: + + def __iter__(self) -> collections.abc.Iterator[VectorCircle]: + ... + + def __len__(self) -> int: + ... + + +class VectorHexagon: + """ + Hexagon vector elements returned from `Vector.hexagons` + """ + + @property + def diameter(self) -> float: + """ + Short (minimal) diameter (i.e. diameter of inscribed circle) + """ + + @property + def rotation(self) -> int: + """ + 0, 90, 180, 270 degrees, where 0 has apex at top, i.e. short diameter is horizontal + """ + + @property + def x(self) -> float: + """ + Centre + """ + + @property + def y(self) -> float: + """ + Centre + """ + + +class VectorHexagons: + + def __iter__(self) -> collections.abc.Iterator[VectorHexagon]: + ... + + def __len__(self) -> int: + ... + + +class VectorRect: + """ + Rectangle vector elements returned from `Vector.rectangles` + """ + + @property + def color(self) -> int: + """ + -1 for foreground, 1-8 for Cyan, Blue, Magenta, Red, Yellow, Green, Black, White. Alias of `colour` + """ + + @property + def colour(self) -> int: + """ + -1 for foreground, 1-8 for Cyan, Blue, Magenta, Red, Yellow, Green, Black, White + """ + + @property + def height(self) -> float: + ... + + @property + def width(self) -> float: + ... + + @property + def x(self) -> float: + """ + Left + """ + + @property + def y(self) -> float: + """ + Top + """ + + +class VectorRects: + + def __iter__(self) -> collections.abc.Iterator[VectorRect]: + ... + + def __len__(self) -> int: + ... + + +class VectorString: + """ + String vector elements returned from `Vector.strings` + """ + + @property + def fsize(self) -> float: + """ + Font size + """ + + @property + def halign(self) -> int: + """ + Horizontal alignment: 0 for centre, 1 for left, 2 for right (end) + """ + + @property + def length(self) -> int: + """ + Number of characters (bytes) + """ + + @property + def rotation(self) -> int: + """ + 0, 90, 180, 270 degrees + """ + + @property + def text(self) -> str: + ... + + @property + def width(self) -> float: + """ + Rendered width estimate + """ + + @property + def x(self) -> float: + """ + Relative to halign (i.e. centre, left, right) + """ + + @property + def y(self) -> float: + """ + Relative to baseline + """ + + +class VectorStrings: + + def __iter__(self) -> collections.abc.Iterator[VectorString]: + ... + + def __len__(self) -> int: + ... + + +class WarningLevel(enum.Enum): + """ + Warning level (`symbol->warn_level`) + """ + DEFAULT: typing.ClassVar[WarningLevel] # value = + FAIL_ALL: typing.ClassVar[WarningLevel] # value = + + +__upstream_version__: str = '2.15.0' +__version__: str = '1.2.2' diff --git a/src/generated/stubs.pyi b/src/stubs/stub-py312.g.pyi similarity index 99% rename from src/generated/stubs.pyi rename to src/stubs/stub-py312.g.pyi index dff59b33..6a2827bb 100644 --- a/src/generated/stubs.pyi +++ b/src/stubs/stub-py312.g.pyi @@ -986,4 +986,4 @@ class WarningLevel(enum.Enum): __upstream_version__: str = '2.15.0' -__version__: str = '1.2.0' +__version__: str = '1.2.2' diff --git a/src/stubs/stub-py313.g.pyi b/src/stubs/stub-py313.g.pyi new file mode 100644 index 00000000..bb2d5e5e --- /dev/null +++ b/src/stubs/stub-py313.g.pyi @@ -0,0 +1,989 @@ +""" +A barcode encoding library supporting over 50 symbologies. +""" +from __future__ import annotations +import collections.abc +import enum +import typing + +__all__: list = [ + 'Symbol', 'Symbology', 'Seg', 'StructApp', 'Vector', 'VectorCircle', 'VectorHexagon', 'VectorRect', 'VectorString', + 'CapabilityFlags', 'DataMatrixOptions', 'InputMode', 'OutputOptions', 'QrFamilyOptions', 'UltracodeOptions', + 'WarningLevel' +] + + +class CapabilityFlags(enum.Flag): + """ + Capability flags (ZBarcode_Cap() `cap_flag`) + """ + COMPLIANT_HEIGHT: typing.ClassVar[CapabilityFlags] # value = + COMPOSITE: typing.ClassVar[CapabilityFlags] # value = + DOTTY: typing.ClassVar[CapabilityFlags] # value = + EANUPC: typing.ClassVar[CapabilityFlags] # value = + ECI: typing.ClassVar[CapabilityFlags] # value = + FIXED_RATIO: typing.ClassVar[CapabilityFlags] # value = + FULL_MULTIBYTE: typing.ClassVar[CapabilityFlags] # value = + GS1: typing.ClassVar[CapabilityFlags] # value = + HRT: typing.ClassVar[CapabilityFlags] # value = + MASK: typing.ClassVar[CapabilityFlags] # value = + QUIET_ZONES: typing.ClassVar[CapabilityFlags] # value = + READER_INIT: typing.ClassVar[CapabilityFlags] # value = + STACKABLE: typing.ClassVar[CapabilityFlags] # value = + STRUCTAPP: typing.ClassVar[CapabilityFlags] # value = + + +class DataMatrixOptions(enum.IntEnum): + """ + Data Matrix specific options (`symbol->option_3`) + """ + DMRE: typing.ClassVar[DataMatrixOptions] # value = + ISO_144: typing.ClassVar[DataMatrixOptions] # value = + SQUARE: typing.ClassVar[DataMatrixOptions] # value = + + @classmethod + def __new__(cls, value): + ... + + def __format__(self, format_spec): + """ + Convert to a string according to format_spec. + """ + + +class InputMode(enum.Flag): + """ + Values for `Symbol.input_mode` + """ + ESCAPE: typing.ClassVar[InputMode] # value = + EXTRA_ESCAPE: typing.ClassVar[InputMode] # value = + FAST: typing.ClassVar[InputMode] # value = + GS1: typing.ClassVar[InputMode] # value = + GS1NOCHECK: typing.ClassVar[InputMode] # value = + GS1PARENS: typing.ClassVar[InputMode] # value = + HEIGHTPERROW: typing.ClassVar[InputMode] # value = + UNICODE: typing.ClassVar[InputMode] # value = + + +class OutputOptions(enum.Flag): + """ + Values for `Symbol.output_options` + """ + BARCODE_BIND: typing.ClassVar[OutputOptions] # value = + BARCODE_BIND_TOP: typing.ClassVar[OutputOptions] # value = + BARCODE_BOX: typing.ClassVar[OutputOptions] # value = + BARCODE_DOTTY_MODE: typing.ClassVar[OutputOptions] # value = + BARCODE_MEMORY_FILE: typing.ClassVar[OutputOptions] # value = + BARCODE_NO_QUIET_ZONES: typing.ClassVar[OutputOptions] # value = + BARCODE_QUIET_ZONES: typing.ClassVar[OutputOptions] # value = + BARCODE_STDOUT: typing.ClassVar[OutputOptions] # value = + BOLD_TEXT: typing.ClassVar[OutputOptions] # value = + CMYK_COLOUR: typing.ClassVar[OutputOptions] # value = + COMPLIANT_HEIGHT: typing.ClassVar[OutputOptions] # value = + EANUPC_GUARD_WHITESPACE: typing.ClassVar[OutputOptions] # value = + EMBED_VECTOR_FONT: typing.ClassVar[OutputOptions] # value = + GS1_GS_SEPARATOR: typing.ClassVar[OutputOptions] # value = + OUT_BUFFER_INTERMEDIATE: typing.ClassVar[OutputOptions] # value = + READER_INIT: typing.ClassVar[OutputOptions] # value = + SMALL_TEXT: typing.ClassVar[OutputOptions] # value = + + +class QrFamilyOptions(enum.IntEnum): + """ + QR, Han Xin, Grid Matrix specific options (`symbol->option_3`) + """ + FULL_MULTIBYTE: typing.ClassVar[QrFamilyOptions] # value = + + @classmethod + def __new__(cls, value): + ... + + def __format__(self, format_spec): + """ + Convert to a string according to format_spec. + """ + + +class Seg: + """ + Segment for use with `Symbol.encode_segs`. + """ + + @typing.overload + def __init__(self) -> None: + ... + + @typing.overload + def __init__(self, arg0: collections.abc.Buffer, arg1: typing.SupportsInt) -> None: + ... + + @property + def eci(self) -> int: + """ + Extended Channel Interpretation + """ + + @eci.setter + def eci(self, arg0: typing.SupportsInt) -> None: + ... + + @property + def source(self) -> memoryview: + """ + Data to encode + """ + + @source.setter + def source(self, arg1: collections.abc.Buffer) -> None: + ... + + +class StructApp: + """ + Structural append information (see `Symbol.structapp`). + + Ignored unless `StructApp.count` is non-zero + """ + + @typing.overload + def __init__(self) -> None: + ... + + @typing.overload + def __init__(self, index: typing.SupportsInt, count: typing.SupportsInt, id: bytes = b'') -> None: + ... + + @property + def count(self) -> int: + """ + Number of symbols in Structured Append sequence. Set >= 2 to add SA Info + """ + + @count.setter + def count(self, arg0: typing.SupportsInt) -> None: + ... + + @property + def id(self) -> bytes: + """ + Optional ID to distinguish sequence, ASCII, max 32 long + """ + + @id.setter + def id(self, arg1: bytes) -> None: + ... + + @property + def index(self) -> int: + """ + Position in Structured Append sequence, 1-based. Must be <= `count` + """ + + @index.setter + def index(self, arg0: typing.SupportsInt) -> None: + ... + + +class Symbol: + """ + Main symbol structure. + """ + + @staticmethod + def capabilities(symbology: Symbology) -> CapabilityFlags: + """ + Return the capability flags for symbology `symbology` + """ + + @staticmethod + def default_xdim(symbology: Symbology) -> float: + """ + Return default X-dimension in mm for symbology `symbology`. Returns 0 on error (invalid `symbology`) + """ + + @staticmethod + def scale_from_xdim_dp( + symbology: Symbology, + /, + x_dim_mm: typing.SupportsFloat, + *, + dpmm: typing.SupportsFloat, + filetype: str | None = None + ) -> float: + """ + Return the scale to use for `symbology` for non-zero X-dimension `x_dim_mm` at `dpmm` dots per mm for `filetype`. If `dpmm` zero defaults to 12. If `filetype` is None, defaults to "GIF". Returns 0 on error + """ + + @staticmethod + def xdim_dp_from_scale( + symbology: Symbology, + /, + scale: typing.SupportsFloat, + *, + x_dim_mm_or_dpmm: typing.SupportsFloat, + filetype: str | None = None + ) -> float: + """ + Reverse of `Symbol.scale_from_xdim_dp`. Estimate the X-dimension or dpmm given non-zero `scale` and non-zero `x_dim_mm_or_dpmm`. Return value bound to dpmm max not X-dimension max. Returns 0 on error + """ + + def __init__(self) -> None: + ... + + def buffer(self, rotate_deg: typing.SupportsInt = 0) -> None: + """ + Output a previously encoded symbol to memory as raster (`Symbol.bitmap`) + """ + + def buffer_vector(self, rotate_deg: typing.SupportsInt = 0) -> None: + """ + Output a previously encoded symbol to memory as vector (`Symbol.vector`) + """ + + def clear(self) -> None: + """ + Free any output buffers that may have been created and initialize output fields + """ + + @typing.overload + def encode(self, data: bytes) -> None: + """ + Encode a barcode + """ + + @typing.overload + def encode(self, text: str) -> None: + """ + Encode a barcode + """ + + def encode_file(self, filename: str) -> None: + """ + Encode a barcode using input data from file `filename` + """ + + @typing.overload + def encode_segs(self, segs: collections.abc.Sequence[Seg]) -> None: + """ + Encode a barcode with multiple ECI segments + """ + + @typing.overload + def encode_segs(self, segs: collections.abc.Iterable) -> None: + """ + Encode a barcode with multiple ECI segments + """ + + def print(self, rotate_deg: typing.SupportsInt = 0) -> None: + """ + Output a previously encoded symbol to file `Symbol.outfile` + """ + + def reset(self) -> None: + """ + Free any output buffers that may have been created and reset all fields to defaults + """ + + @property + def alphamap(self) -> memoryview | None: + """ + Array of alpha values used (raster output only) + """ + + @property + def bgcolor(self) -> str: + """ + Background as hexadecimal RGB/RGBA or decimal "C,M,Y,K" string. Alias of bgcolour. + """ + + @bgcolor.setter + def bgcolor(self, arg1: str) -> None: + ... + + @property + def bgcolour(self) -> str: + """ + Background as hexadecimal RGB/RGBA or decimal "C,M,Y,K" string + """ + + @bgcolour.setter + def bgcolour(self, arg1: str) -> None: + ... + + @property + def bitmap(self) -> memoryview | None: + """ + Stored bitmap image (raster output only) + """ + + @property + def border_width(self) -> int: + """ + Size of border in X-dimensions + """ + + @border_width.setter + def border_width(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def debug(self) -> int: + """ + Debugging flags + """ + + @debug.setter + def debug(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def dot_size(self) -> float: + """ + Size of dots used in BARCODE_DOTTY_MODE. Default 0.8 + """ + + @dot_size.setter + def dot_size(self, arg1: typing.SupportsFloat) -> None: + ... + + @property + def dpmm(self) -> float: + """ + Resolution of output in dots per mm (BMP/EMF/PCX/PNG/TIF only). Default 0 (none) + """ + + @dpmm.setter + def dpmm(self, arg1: typing.SupportsFloat) -> None: + ... + + @property + def eci(self) -> int: + """ + Extended Channel Interpretation. Default 0 (none) + """ + + @eci.setter + def eci(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def encoded_data(self) -> memoryview: + """ + Encoded data (output only). Allows for rows of 1152 modules + """ + + @property + def errtxt(self) -> str: + """ + Error message if an error or warning occurs (output only) + """ + + @property + def fgcolor(self) -> str: + """ + Foreground as hexadecimal RGB/RGBA or decimal "C,M,Y,K" string. Alias of fgcolour. + """ + + @fgcolor.setter + def fgcolor(self, arg1: str) -> None: + ... + + @property + def fgcolour(self) -> str: + """ + Foreground as hexadecimal RGB/RGBA or decimal "C,M,Y,K" string + """ + + @fgcolour.setter + def fgcolour(self, arg1: str) -> None: + ... + + @property + def guard_descent(self) -> float: + """ + Height in X-dimensions that EAN/UPC guard bars descend. Default 5 + """ + + @guard_descent.setter + def guard_descent(self, arg1: typing.SupportsFloat) -> None: + ... + + @property + def height(self) -> float: + """ + Barcode height in X-dimensions (ignored for fixed-width barcodes) + """ + + @height.setter + def height(self, arg1: typing.SupportsFloat) -> None: + ... + + @property + def input_mode(self) -> InputMode: + """ + Encoding of input data (see `InputMode`). Default `InputMode.DATA` + """ + + @input_mode.setter + def input_mode(self, arg1: InputMode) -> None: + ... + + @property + def memfile(self) -> memoryview | None: + """ + In-memory file buffer if BARCODE_MEMORY_FILE (output only) + """ + + @property + def option_1(self) -> int: + """ + Symbol-specific options + """ + + @option_1.setter + def option_1(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def option_2(self) -> int: + """ + Symbol-specific options + """ + + @option_2.setter + def option_2(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def option_3(self) -> int: + """ + Symbol-specific options + """ + + @option_3.setter + def option_3(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def outfile(self) -> str: + """ + Name of file to output to. Default "out.png" + """ + + @outfile.setter + def outfile(self, arg1: str) -> None: + ... + + @property + def output_options(self) -> OutputOptions: + """ + Various output parameters (bind, box etc, see `OutputOptions`) + """ + + @output_options.setter + def output_options(self, arg1: OutputOptions) -> None: + ... + + @property + def primary(self) -> str: + """ + Primary message data (MaxiCode, Composite) + """ + + @primary.setter + def primary(self, arg1: str) -> None: + ... + + @property + def row_height(self) -> list: + """ + Heights of rows (output only). Allows for 200 row DotCode + """ + + @property + def rows(self) -> int: + """ + Number of rows used by the symbol (output only) + """ + + @property + def scale(self) -> float: + """ + Scale factor when printing barcode, i.e. adjusts X-dimension. Default 1 + """ + + @scale.setter + def scale(self, arg1: typing.SupportsFloat) -> None: + ... + + @property + def show_hrt(self) -> bool: + """ + If `True`, display Human Readable Text (HRT) on supported barcodes. Default `True`. Alias of `Symbol.show_text`. + """ + + @show_hrt.setter + def show_hrt(self, arg1: bool) -> None: + ... + + @property + def show_text(self) -> bool: + """ + If `True`, display Human Readable Text (HRT) on supported barcodes. Default `True` + """ + + @show_text.setter + def show_text(self, arg1: bool) -> None: + ... + + @property + def structapp(self) -> StructApp: + """ + Structured Append info. Default structapp.count 0 (none) + """ + + @structapp.setter + def structapp(self, arg1: StructApp) -> None: + ... + + @property + def symbology(self) -> Symbology: + """ + Symbol type to use (see `Symbology`) + """ + + @symbology.setter + def symbology(self, arg1: Symbology) -> None: + ... + + @property + def text(self) -> str: + """ + Human Readable Text (HRT) (if any), UTF-8 (output only) + """ + + @property + def text_gap(self) -> float: + """ + Gap between barcode and Human Readable Text (HRT) in X-dimensions. Default 1 + """ + + @text_gap.setter + def text_gap(self, arg1: typing.SupportsFloat) -> None: + ... + + @property + def vector(self) -> Vector: + """ + Vector header (vector output only) + """ + + @property + def warn_level(self) -> WarningLevel: + """ + Affects error/warning value returned by Zint API (see `WarningLevel`) + """ + + @warn_level.setter + def warn_level(self, arg1: WarningLevel) -> None: + ... + + @property + def whitespace_height(self) -> int: + """ + Height in X-dimensions of whitespace above & below the barcode + """ + + @whitespace_height.setter + def whitespace_height(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def whitespace_width(self) -> int: + """ + Width in X-dimensions of whitespace to left & right of barcode + """ + + @whitespace_width.setter + def whitespace_width(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def width(self) -> int: + """ + Width of the generated symbol (output only) + """ + + +class Symbology(enum.Enum): + """ + Values for `Symbol.symbology` + """ + AUSPOST: typing.ClassVar[Symbology] # value = + AUSREDIRECT: typing.ClassVar[Symbology] # value = + AUSREPLY: typing.ClassVar[Symbology] # value = + AUSROUTE: typing.ClassVar[Symbology] # value = + AZRUNE: typing.ClassVar[Symbology] # value = + AZTEC: typing.ClassVar[Symbology] # value = + BC412: typing.ClassVar[Symbology] # value = + C25IATA: typing.ClassVar[Symbology] # value = + C25IND: typing.ClassVar[Symbology] # value = + C25INTER: typing.ClassVar[Symbology] # value = + C25LOGIC: typing.ClassVar[Symbology] # value = + C25STANDARD: typing.ClassVar[Symbology] # value = + CEPNET: typing.ClassVar[Symbology] # value = + CHANNEL: typing.ClassVar[Symbology] # value = + CODABAR: typing.ClassVar[Symbology] # value = + CODABLOCKF: typing.ClassVar[Symbology] # value = + CODE11: typing.ClassVar[Symbology] # value = + CODE128: typing.ClassVar[Symbology] # value = + CODE128AB: typing.ClassVar[Symbology] # value = + CODE16K: typing.ClassVar[Symbology] # value = + CODE32: typing.ClassVar[Symbology] # value = + CODE39: typing.ClassVar[Symbology] # value = + CODE49: typing.ClassVar[Symbology] # value = + CODE93: typing.ClassVar[Symbology] # value = + CODEONE: typing.ClassVar[Symbology] # value = + DAFT: typing.ClassVar[Symbology] # value = + DATAMATRIX: typing.ClassVar[Symbology] # value = + DBAR_EXP: typing.ClassVar[Symbology] # value = + DBAR_EXPSTK: typing.ClassVar[Symbology] # value = + DBAR_EXPSTK_CC: typing.ClassVar[Symbology] # value = + DBAR_EXP_CC: typing.ClassVar[Symbology] # value = + DBAR_LTD: typing.ClassVar[Symbology] # value = + DBAR_LTD_CC: typing.ClassVar[Symbology] # value = + DBAR_OMN: typing.ClassVar[Symbology] # value = + DBAR_OMNSTK: typing.ClassVar[Symbology] # value = + DBAR_OMNSTK_CC: typing.ClassVar[Symbology] # value = + DBAR_OMN_CC: typing.ClassVar[Symbology] # value = + DBAR_STK: typing.ClassVar[Symbology] # value = + DBAR_STK_CC: typing.ClassVar[Symbology] # value = + DOTCODE: typing.ClassVar[Symbology] # value = + DPD: typing.ClassVar[Symbology] # value = + DPIDENT: typing.ClassVar[Symbology] # value = + DPLEIT: typing.ClassVar[Symbology] # value = + DXFILMEDGE: typing.ClassVar[Symbology] # value = + EAN14: typing.ClassVar[Symbology] # value = + EANX: typing.ClassVar[Symbology] # value = + EANX_CC: typing.ClassVar[Symbology] # value = + EANX_CHK: typing.ClassVar[Symbology] # value = + EXCODE39: typing.ClassVar[Symbology] # value = + FIM: typing.ClassVar[Symbology] # value = + FLAT: typing.ClassVar[Symbology] # value = + GRIDMATRIX: typing.ClassVar[Symbology] # value = + GS1_128: typing.ClassVar[Symbology] # value = + GS1_128_CC: typing.ClassVar[Symbology] # value = + HANXIN: typing.ClassVar[Symbology] # value = + HIBC_128: typing.ClassVar[Symbology] # value = + HIBC_39: typing.ClassVar[Symbology] # value = + HIBC_AZTEC: typing.ClassVar[Symbology] # value = + HIBC_BLOCKF: typing.ClassVar[Symbology] # value = + HIBC_DM: typing.ClassVar[Symbology] # value = + HIBC_MICPDF: typing.ClassVar[Symbology] # value = + HIBC_PDF: typing.ClassVar[Symbology] # value = + HIBC_QR: typing.ClassVar[Symbology] # value = + ISBNX: typing.ClassVar[Symbology] # value = + ITF14: typing.ClassVar[Symbology] # value = + JAPANPOST: typing.ClassVar[Symbology] # value = + KIX: typing.ClassVar[Symbology] # value = + KOREAPOST: typing.ClassVar[Symbology] # value = + LOGMARS: typing.ClassVar[Symbology] # value = + MAILMARK_2D: typing.ClassVar[Symbology] # value = + MAILMARK_4S: typing.ClassVar[Symbology] # value = + MAXICODE: typing.ClassVar[Symbology] # value = + MICROPDF417: typing.ClassVar[Symbology] # value = + MICROQR: typing.ClassVar[Symbology] # value = + MSI_PLESSEY: typing.ClassVar[Symbology] # value = + NVE18: typing.ClassVar[Symbology] # value = + PDF417: typing.ClassVar[Symbology] # value = + PDF417COMP: typing.ClassVar[Symbology] # value = + PHARMA: typing.ClassVar[Symbology] # value = + PHARMA_TWO: typing.ClassVar[Symbology] # value = + PLANET: typing.ClassVar[Symbology] # value = + PLESSEY: typing.ClassVar[Symbology] # value = + POSTNET: typing.ClassVar[Symbology] # value = + PZN: typing.ClassVar[Symbology] # value = + QRCODE: typing.ClassVar[Symbology] # value = + RM4SCC: typing.ClassVar[Symbology] # value = + RMQR: typing.ClassVar[Symbology] # value = + TELEPEN: typing.ClassVar[Symbology] # value = + TELEPEN_NUM: typing.ClassVar[Symbology] # value = + ULTRA: typing.ClassVar[Symbology] # value = + UPCA: typing.ClassVar[Symbology] # value = + UPCA_CC: typing.ClassVar[Symbology] # value = + UPCA_CHK: typing.ClassVar[Symbology] # value = + UPCE: typing.ClassVar[Symbology] # value = + UPCE_CC: typing.ClassVar[Symbology] # value = + UPCE_CHK: typing.ClassVar[Symbology] # value = + UPNQR: typing.ClassVar[Symbology] # value = + UPU_S10: typing.ClassVar[Symbology] # value = + USPS_IMAIL: typing.ClassVar[Symbology] # value = + VIN: typing.ClassVar[Symbology] # value = + + +class UltracodeOptions(enum.IntEnum): + """ + Ultracode specific option (`symbol->option_3`) + """ + ULTRA_COMPRESSION: typing.ClassVar[UltracodeOptions] # value = + + @classmethod + def __new__(cls, value): + ... + + def __format__(self, format_spec): + """ + Convert to a string according to format_spec. + """ + + +class Vector: + """ + Vector image information, returned from `Symbol.vector` after calling `Symbol.buffer_vector` + """ + + @property + def circles(self) -> VectorCircles: + """ + An iterable over circles (`VectorCircle`) + """ + + @property + def height(self) -> float: + """ + Height of barcode image (including text, whitespace) + """ + + @property + def hexagons(self) -> VectorHexagons: + """ + An iterable over hexagons (`VectorHexagon`) + """ + + @property + def rectangles(self) -> VectorRects: + """ + An iterable over rectangles (`VectorRectangle`) + """ + + @property + def strings(self) -> VectorStrings: + """ + An iterable over strings (`VectorString`) + """ + + @property + def width(self) -> float: + """ + Width of barcode image (including text, whitespace) + """ + + +class VectorCircle: + """ + Circle vector elements returned from `Vector.circles` + """ + + @property + def color(self) -> int: + """ + Zero for draw with foreground colour (else draw with background colour (legacy)). Alias of `colour` + """ + + @property + def colour(self) -> int: + """ + Zero for draw with foreground colour (else draw with background colour (legacy)) + """ + + @property + def diameter(self) -> float: + """ + Circle diameter. Does not include width (if any) + """ + + @property + def width(self) -> float: + """ + Width of circle perimeter (circumference). 0 for fill (disc) + """ + + @property + def x(self) -> float: + """ + Centre + """ + + @property + def y(self) -> float: + """ + Centre + """ + + +class VectorCircles: + + def __iter__(self) -> collections.abc.Iterator[VectorCircle]: + ... + + def __len__(self) -> int: + ... + + +class VectorHexagon: + """ + Hexagon vector elements returned from `Vector.hexagons` + """ + + @property + def diameter(self) -> float: + """ + Short (minimal) diameter (i.e. diameter of inscribed circle) + """ + + @property + def rotation(self) -> int: + """ + 0, 90, 180, 270 degrees, where 0 has apex at top, i.e. short diameter is horizontal + """ + + @property + def x(self) -> float: + """ + Centre + """ + + @property + def y(self) -> float: + """ + Centre + """ + + +class VectorHexagons: + + def __iter__(self) -> collections.abc.Iterator[VectorHexagon]: + ... + + def __len__(self) -> int: + ... + + +class VectorRect: + """ + Rectangle vector elements returned from `Vector.rectangles` + """ + + @property + def color(self) -> int: + """ + -1 for foreground, 1-8 for Cyan, Blue, Magenta, Red, Yellow, Green, Black, White. Alias of `colour` + """ + + @property + def colour(self) -> int: + """ + -1 for foreground, 1-8 for Cyan, Blue, Magenta, Red, Yellow, Green, Black, White + """ + + @property + def height(self) -> float: + ... + + @property + def width(self) -> float: + ... + + @property + def x(self) -> float: + """ + Left + """ + + @property + def y(self) -> float: + """ + Top + """ + + +class VectorRects: + + def __iter__(self) -> collections.abc.Iterator[VectorRect]: + ... + + def __len__(self) -> int: + ... + + +class VectorString: + """ + String vector elements returned from `Vector.strings` + """ + + @property + def fsize(self) -> float: + """ + Font size + """ + + @property + def halign(self) -> int: + """ + Horizontal alignment: 0 for centre, 1 for left, 2 for right (end) + """ + + @property + def length(self) -> int: + """ + Number of characters (bytes) + """ + + @property + def rotation(self) -> int: + """ + 0, 90, 180, 270 degrees + """ + + @property + def text(self) -> str: + ... + + @property + def width(self) -> float: + """ + Rendered width estimate + """ + + @property + def x(self) -> float: + """ + Relative to halign (i.e. centre, left, right) + """ + + @property + def y(self) -> float: + """ + Relative to baseline + """ + + +class VectorStrings: + + def __iter__(self) -> collections.abc.Iterator[VectorString]: + ... + + def __len__(self) -> int: + ... + + +class WarningLevel(enum.Enum): + """ + Warning level (`symbol->warn_level`) + """ + DEFAULT: typing.ClassVar[WarningLevel] # value = + FAIL_ALL: typing.ClassVar[WarningLevel] # value = + + +__upstream_version__: str = '2.15.0' +__version__: str = '0.0.0' diff --git a/src/stubs/stub-py314.g.pyi b/src/stubs/stub-py314.g.pyi new file mode 100644 index 00000000..6a2827bb --- /dev/null +++ b/src/stubs/stub-py314.g.pyi @@ -0,0 +1,989 @@ +""" +A barcode encoding library supporting over 50 symbologies. +""" +from __future__ import annotations +import collections.abc +import enum +import typing + +__all__: list = [ + 'Symbol', 'Symbology', 'Seg', 'StructApp', 'Vector', 'VectorCircle', 'VectorHexagon', 'VectorRect', 'VectorString', + 'CapabilityFlags', 'DataMatrixOptions', 'InputMode', 'OutputOptions', 'QrFamilyOptions', 'UltracodeOptions', + 'WarningLevel' +] + + +class CapabilityFlags(enum.Flag): + """ + Capability flags (ZBarcode_Cap() `cap_flag`) + """ + COMPLIANT_HEIGHT: typing.ClassVar[CapabilityFlags] # value = + COMPOSITE: typing.ClassVar[CapabilityFlags] # value = + DOTTY: typing.ClassVar[CapabilityFlags] # value = + EANUPC: typing.ClassVar[CapabilityFlags] # value = + ECI: typing.ClassVar[CapabilityFlags] # value = + FIXED_RATIO: typing.ClassVar[CapabilityFlags] # value = + FULL_MULTIBYTE: typing.ClassVar[CapabilityFlags] # value = + GS1: typing.ClassVar[CapabilityFlags] # value = + HRT: typing.ClassVar[CapabilityFlags] # value = + MASK: typing.ClassVar[CapabilityFlags] # value = + QUIET_ZONES: typing.ClassVar[CapabilityFlags] # value = + READER_INIT: typing.ClassVar[CapabilityFlags] # value = + STACKABLE: typing.ClassVar[CapabilityFlags] # value = + STRUCTAPP: typing.ClassVar[CapabilityFlags] # value = + + +class DataMatrixOptions(enum.IntEnum): + """ + Data Matrix specific options (`symbol->option_3`) + """ + DMRE: typing.ClassVar[DataMatrixOptions] # value = + ISO_144: typing.ClassVar[DataMatrixOptions] # value = + SQUARE: typing.ClassVar[DataMatrixOptions] # value = + + @classmethod + def __new__(cls, value): + ... + + def __format__(self, format_spec): + """ + Convert to a string according to format_spec. + """ + + +class InputMode(enum.Flag): + """ + Values for `Symbol.input_mode` + """ + ESCAPE: typing.ClassVar[InputMode] # value = + EXTRA_ESCAPE: typing.ClassVar[InputMode] # value = + FAST: typing.ClassVar[InputMode] # value = + GS1: typing.ClassVar[InputMode] # value = + GS1NOCHECK: typing.ClassVar[InputMode] # value = + GS1PARENS: typing.ClassVar[InputMode] # value = + HEIGHTPERROW: typing.ClassVar[InputMode] # value = + UNICODE: typing.ClassVar[InputMode] # value = + + +class OutputOptions(enum.Flag): + """ + Values for `Symbol.output_options` + """ + BARCODE_BIND: typing.ClassVar[OutputOptions] # value = + BARCODE_BIND_TOP: typing.ClassVar[OutputOptions] # value = + BARCODE_BOX: typing.ClassVar[OutputOptions] # value = + BARCODE_DOTTY_MODE: typing.ClassVar[OutputOptions] # value = + BARCODE_MEMORY_FILE: typing.ClassVar[OutputOptions] # value = + BARCODE_NO_QUIET_ZONES: typing.ClassVar[OutputOptions] # value = + BARCODE_QUIET_ZONES: typing.ClassVar[OutputOptions] # value = + BARCODE_STDOUT: typing.ClassVar[OutputOptions] # value = + BOLD_TEXT: typing.ClassVar[OutputOptions] # value = + CMYK_COLOUR: typing.ClassVar[OutputOptions] # value = + COMPLIANT_HEIGHT: typing.ClassVar[OutputOptions] # value = + EANUPC_GUARD_WHITESPACE: typing.ClassVar[OutputOptions] # value = + EMBED_VECTOR_FONT: typing.ClassVar[OutputOptions] # value = + GS1_GS_SEPARATOR: typing.ClassVar[OutputOptions] # value = + OUT_BUFFER_INTERMEDIATE: typing.ClassVar[OutputOptions] # value = + READER_INIT: typing.ClassVar[OutputOptions] # value = + SMALL_TEXT: typing.ClassVar[OutputOptions] # value = + + +class QrFamilyOptions(enum.IntEnum): + """ + QR, Han Xin, Grid Matrix specific options (`symbol->option_3`) + """ + FULL_MULTIBYTE: typing.ClassVar[QrFamilyOptions] # value = + + @classmethod + def __new__(cls, value): + ... + + def __format__(self, format_spec): + """ + Convert to a string according to format_spec. + """ + + +class Seg: + """ + Segment for use with `Symbol.encode_segs`. + """ + + @typing.overload + def __init__(self) -> None: + ... + + @typing.overload + def __init__(self, arg0: collections.abc.Buffer, arg1: typing.SupportsInt) -> None: + ... + + @property + def eci(self) -> int: + """ + Extended Channel Interpretation + """ + + @eci.setter + def eci(self, arg0: typing.SupportsInt) -> None: + ... + + @property + def source(self) -> memoryview: + """ + Data to encode + """ + + @source.setter + def source(self, arg1: collections.abc.Buffer) -> None: + ... + + +class StructApp: + """ + Structural append information (see `Symbol.structapp`). + + Ignored unless `StructApp.count` is non-zero + """ + + @typing.overload + def __init__(self) -> None: + ... + + @typing.overload + def __init__(self, index: typing.SupportsInt, count: typing.SupportsInt, id: bytes = b'') -> None: + ... + + @property + def count(self) -> int: + """ + Number of symbols in Structured Append sequence. Set >= 2 to add SA Info + """ + + @count.setter + def count(self, arg0: typing.SupportsInt) -> None: + ... + + @property + def id(self) -> bytes: + """ + Optional ID to distinguish sequence, ASCII, max 32 long + """ + + @id.setter + def id(self, arg1: bytes) -> None: + ... + + @property + def index(self) -> int: + """ + Position in Structured Append sequence, 1-based. Must be <= `count` + """ + + @index.setter + def index(self, arg0: typing.SupportsInt) -> None: + ... + + +class Symbol: + """ + Main symbol structure. + """ + + @staticmethod + def capabilities(symbology: Symbology) -> CapabilityFlags: + """ + Return the capability flags for symbology `symbology` + """ + + @staticmethod + def default_xdim(symbology: Symbology) -> float: + """ + Return default X-dimension in mm for symbology `symbology`. Returns 0 on error (invalid `symbology`) + """ + + @staticmethod + def scale_from_xdim_dp( + symbology: Symbology, + /, + x_dim_mm: typing.SupportsFloat, + *, + dpmm: typing.SupportsFloat, + filetype: str | None = None + ) -> float: + """ + Return the scale to use for `symbology` for non-zero X-dimension `x_dim_mm` at `dpmm` dots per mm for `filetype`. If `dpmm` zero defaults to 12. If `filetype` is None, defaults to "GIF". Returns 0 on error + """ + + @staticmethod + def xdim_dp_from_scale( + symbology: Symbology, + /, + scale: typing.SupportsFloat, + *, + x_dim_mm_or_dpmm: typing.SupportsFloat, + filetype: str | None = None + ) -> float: + """ + Reverse of `Symbol.scale_from_xdim_dp`. Estimate the X-dimension or dpmm given non-zero `scale` and non-zero `x_dim_mm_or_dpmm`. Return value bound to dpmm max not X-dimension max. Returns 0 on error + """ + + def __init__(self) -> None: + ... + + def buffer(self, rotate_deg: typing.SupportsInt = 0) -> None: + """ + Output a previously encoded symbol to memory as raster (`Symbol.bitmap`) + """ + + def buffer_vector(self, rotate_deg: typing.SupportsInt = 0) -> None: + """ + Output a previously encoded symbol to memory as vector (`Symbol.vector`) + """ + + def clear(self) -> None: + """ + Free any output buffers that may have been created and initialize output fields + """ + + @typing.overload + def encode(self, data: bytes) -> None: + """ + Encode a barcode + """ + + @typing.overload + def encode(self, text: str) -> None: + """ + Encode a barcode + """ + + def encode_file(self, filename: str) -> None: + """ + Encode a barcode using input data from file `filename` + """ + + @typing.overload + def encode_segs(self, segs: collections.abc.Sequence[Seg]) -> None: + """ + Encode a barcode with multiple ECI segments + """ + + @typing.overload + def encode_segs(self, segs: collections.abc.Iterable) -> None: + """ + Encode a barcode with multiple ECI segments + """ + + def print(self, rotate_deg: typing.SupportsInt = 0) -> None: + """ + Output a previously encoded symbol to file `Symbol.outfile` + """ + + def reset(self) -> None: + """ + Free any output buffers that may have been created and reset all fields to defaults + """ + + @property + def alphamap(self) -> memoryview | None: + """ + Array of alpha values used (raster output only) + """ + + @property + def bgcolor(self) -> str: + """ + Background as hexadecimal RGB/RGBA or decimal "C,M,Y,K" string. Alias of bgcolour. + """ + + @bgcolor.setter + def bgcolor(self, arg1: str) -> None: + ... + + @property + def bgcolour(self) -> str: + """ + Background as hexadecimal RGB/RGBA or decimal "C,M,Y,K" string + """ + + @bgcolour.setter + def bgcolour(self, arg1: str) -> None: + ... + + @property + def bitmap(self) -> memoryview | None: + """ + Stored bitmap image (raster output only) + """ + + @property + def border_width(self) -> int: + """ + Size of border in X-dimensions + """ + + @border_width.setter + def border_width(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def debug(self) -> int: + """ + Debugging flags + """ + + @debug.setter + def debug(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def dot_size(self) -> float: + """ + Size of dots used in BARCODE_DOTTY_MODE. Default 0.8 + """ + + @dot_size.setter + def dot_size(self, arg1: typing.SupportsFloat) -> None: + ... + + @property + def dpmm(self) -> float: + """ + Resolution of output in dots per mm (BMP/EMF/PCX/PNG/TIF only). Default 0 (none) + """ + + @dpmm.setter + def dpmm(self, arg1: typing.SupportsFloat) -> None: + ... + + @property + def eci(self) -> int: + """ + Extended Channel Interpretation. Default 0 (none) + """ + + @eci.setter + def eci(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def encoded_data(self) -> memoryview: + """ + Encoded data (output only). Allows for rows of 1152 modules + """ + + @property + def errtxt(self) -> str: + """ + Error message if an error or warning occurs (output only) + """ + + @property + def fgcolor(self) -> str: + """ + Foreground as hexadecimal RGB/RGBA or decimal "C,M,Y,K" string. Alias of fgcolour. + """ + + @fgcolor.setter + def fgcolor(self, arg1: str) -> None: + ... + + @property + def fgcolour(self) -> str: + """ + Foreground as hexadecimal RGB/RGBA or decimal "C,M,Y,K" string + """ + + @fgcolour.setter + def fgcolour(self, arg1: str) -> None: + ... + + @property + def guard_descent(self) -> float: + """ + Height in X-dimensions that EAN/UPC guard bars descend. Default 5 + """ + + @guard_descent.setter + def guard_descent(self, arg1: typing.SupportsFloat) -> None: + ... + + @property + def height(self) -> float: + """ + Barcode height in X-dimensions (ignored for fixed-width barcodes) + """ + + @height.setter + def height(self, arg1: typing.SupportsFloat) -> None: + ... + + @property + def input_mode(self) -> InputMode: + """ + Encoding of input data (see `InputMode`). Default `InputMode.DATA` + """ + + @input_mode.setter + def input_mode(self, arg1: InputMode) -> None: + ... + + @property + def memfile(self) -> memoryview | None: + """ + In-memory file buffer if BARCODE_MEMORY_FILE (output only) + """ + + @property + def option_1(self) -> int: + """ + Symbol-specific options + """ + + @option_1.setter + def option_1(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def option_2(self) -> int: + """ + Symbol-specific options + """ + + @option_2.setter + def option_2(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def option_3(self) -> int: + """ + Symbol-specific options + """ + + @option_3.setter + def option_3(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def outfile(self) -> str: + """ + Name of file to output to. Default "out.png" + """ + + @outfile.setter + def outfile(self, arg1: str) -> None: + ... + + @property + def output_options(self) -> OutputOptions: + """ + Various output parameters (bind, box etc, see `OutputOptions`) + """ + + @output_options.setter + def output_options(self, arg1: OutputOptions) -> None: + ... + + @property + def primary(self) -> str: + """ + Primary message data (MaxiCode, Composite) + """ + + @primary.setter + def primary(self, arg1: str) -> None: + ... + + @property + def row_height(self) -> list: + """ + Heights of rows (output only). Allows for 200 row DotCode + """ + + @property + def rows(self) -> int: + """ + Number of rows used by the symbol (output only) + """ + + @property + def scale(self) -> float: + """ + Scale factor when printing barcode, i.e. adjusts X-dimension. Default 1 + """ + + @scale.setter + def scale(self, arg1: typing.SupportsFloat) -> None: + ... + + @property + def show_hrt(self) -> bool: + """ + If `True`, display Human Readable Text (HRT) on supported barcodes. Default `True`. Alias of `Symbol.show_text`. + """ + + @show_hrt.setter + def show_hrt(self, arg1: bool) -> None: + ... + + @property + def show_text(self) -> bool: + """ + If `True`, display Human Readable Text (HRT) on supported barcodes. Default `True` + """ + + @show_text.setter + def show_text(self, arg1: bool) -> None: + ... + + @property + def structapp(self) -> StructApp: + """ + Structured Append info. Default structapp.count 0 (none) + """ + + @structapp.setter + def structapp(self, arg1: StructApp) -> None: + ... + + @property + def symbology(self) -> Symbology: + """ + Symbol type to use (see `Symbology`) + """ + + @symbology.setter + def symbology(self, arg1: Symbology) -> None: + ... + + @property + def text(self) -> str: + """ + Human Readable Text (HRT) (if any), UTF-8 (output only) + """ + + @property + def text_gap(self) -> float: + """ + Gap between barcode and Human Readable Text (HRT) in X-dimensions. Default 1 + """ + + @text_gap.setter + def text_gap(self, arg1: typing.SupportsFloat) -> None: + ... + + @property + def vector(self) -> Vector: + """ + Vector header (vector output only) + """ + + @property + def warn_level(self) -> WarningLevel: + """ + Affects error/warning value returned by Zint API (see `WarningLevel`) + """ + + @warn_level.setter + def warn_level(self, arg1: WarningLevel) -> None: + ... + + @property + def whitespace_height(self) -> int: + """ + Height in X-dimensions of whitespace above & below the barcode + """ + + @whitespace_height.setter + def whitespace_height(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def whitespace_width(self) -> int: + """ + Width in X-dimensions of whitespace to left & right of barcode + """ + + @whitespace_width.setter + def whitespace_width(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def width(self) -> int: + """ + Width of the generated symbol (output only) + """ + + +class Symbology(enum.Enum): + """ + Values for `Symbol.symbology` + """ + AUSPOST: typing.ClassVar[Symbology] # value = + AUSREDIRECT: typing.ClassVar[Symbology] # value = + AUSREPLY: typing.ClassVar[Symbology] # value = + AUSROUTE: typing.ClassVar[Symbology] # value = + AZRUNE: typing.ClassVar[Symbology] # value = + AZTEC: typing.ClassVar[Symbology] # value = + BC412: typing.ClassVar[Symbology] # value = + C25IATA: typing.ClassVar[Symbology] # value = + C25IND: typing.ClassVar[Symbology] # value = + C25INTER: typing.ClassVar[Symbology] # value = + C25LOGIC: typing.ClassVar[Symbology] # value = + C25STANDARD: typing.ClassVar[Symbology] # value = + CEPNET: typing.ClassVar[Symbology] # value = + CHANNEL: typing.ClassVar[Symbology] # value = + CODABAR: typing.ClassVar[Symbology] # value = + CODABLOCKF: typing.ClassVar[Symbology] # value = + CODE11: typing.ClassVar[Symbology] # value = + CODE128: typing.ClassVar[Symbology] # value = + CODE128AB: typing.ClassVar[Symbology] # value = + CODE16K: typing.ClassVar[Symbology] # value = + CODE32: typing.ClassVar[Symbology] # value = + CODE39: typing.ClassVar[Symbology] # value = + CODE49: typing.ClassVar[Symbology] # value = + CODE93: typing.ClassVar[Symbology] # value = + CODEONE: typing.ClassVar[Symbology] # value = + DAFT: typing.ClassVar[Symbology] # value = + DATAMATRIX: typing.ClassVar[Symbology] # value = + DBAR_EXP: typing.ClassVar[Symbology] # value = + DBAR_EXPSTK: typing.ClassVar[Symbology] # value = + DBAR_EXPSTK_CC: typing.ClassVar[Symbology] # value = + DBAR_EXP_CC: typing.ClassVar[Symbology] # value = + DBAR_LTD: typing.ClassVar[Symbology] # value = + DBAR_LTD_CC: typing.ClassVar[Symbology] # value = + DBAR_OMN: typing.ClassVar[Symbology] # value = + DBAR_OMNSTK: typing.ClassVar[Symbology] # value = + DBAR_OMNSTK_CC: typing.ClassVar[Symbology] # value = + DBAR_OMN_CC: typing.ClassVar[Symbology] # value = + DBAR_STK: typing.ClassVar[Symbology] # value = + DBAR_STK_CC: typing.ClassVar[Symbology] # value = + DOTCODE: typing.ClassVar[Symbology] # value = + DPD: typing.ClassVar[Symbology] # value = + DPIDENT: typing.ClassVar[Symbology] # value = + DPLEIT: typing.ClassVar[Symbology] # value = + DXFILMEDGE: typing.ClassVar[Symbology] # value = + EAN14: typing.ClassVar[Symbology] # value = + EANX: typing.ClassVar[Symbology] # value = + EANX_CC: typing.ClassVar[Symbology] # value = + EANX_CHK: typing.ClassVar[Symbology] # value = + EXCODE39: typing.ClassVar[Symbology] # value = + FIM: typing.ClassVar[Symbology] # value = + FLAT: typing.ClassVar[Symbology] # value = + GRIDMATRIX: typing.ClassVar[Symbology] # value = + GS1_128: typing.ClassVar[Symbology] # value = + GS1_128_CC: typing.ClassVar[Symbology] # value = + HANXIN: typing.ClassVar[Symbology] # value = + HIBC_128: typing.ClassVar[Symbology] # value = + HIBC_39: typing.ClassVar[Symbology] # value = + HIBC_AZTEC: typing.ClassVar[Symbology] # value = + HIBC_BLOCKF: typing.ClassVar[Symbology] # value = + HIBC_DM: typing.ClassVar[Symbology] # value = + HIBC_MICPDF: typing.ClassVar[Symbology] # value = + HIBC_PDF: typing.ClassVar[Symbology] # value = + HIBC_QR: typing.ClassVar[Symbology] # value = + ISBNX: typing.ClassVar[Symbology] # value = + ITF14: typing.ClassVar[Symbology] # value = + JAPANPOST: typing.ClassVar[Symbology] # value = + KIX: typing.ClassVar[Symbology] # value = + KOREAPOST: typing.ClassVar[Symbology] # value = + LOGMARS: typing.ClassVar[Symbology] # value = + MAILMARK_2D: typing.ClassVar[Symbology] # value = + MAILMARK_4S: typing.ClassVar[Symbology] # value = + MAXICODE: typing.ClassVar[Symbology] # value = + MICROPDF417: typing.ClassVar[Symbology] # value = + MICROQR: typing.ClassVar[Symbology] # value = + MSI_PLESSEY: typing.ClassVar[Symbology] # value = + NVE18: typing.ClassVar[Symbology] # value = + PDF417: typing.ClassVar[Symbology] # value = + PDF417COMP: typing.ClassVar[Symbology] # value = + PHARMA: typing.ClassVar[Symbology] # value = + PHARMA_TWO: typing.ClassVar[Symbology] # value = + PLANET: typing.ClassVar[Symbology] # value = + PLESSEY: typing.ClassVar[Symbology] # value = + POSTNET: typing.ClassVar[Symbology] # value = + PZN: typing.ClassVar[Symbology] # value = + QRCODE: typing.ClassVar[Symbology] # value = + RM4SCC: typing.ClassVar[Symbology] # value = + RMQR: typing.ClassVar[Symbology] # value = + TELEPEN: typing.ClassVar[Symbology] # value = + TELEPEN_NUM: typing.ClassVar[Symbology] # value = + ULTRA: typing.ClassVar[Symbology] # value = + UPCA: typing.ClassVar[Symbology] # value = + UPCA_CC: typing.ClassVar[Symbology] # value = + UPCA_CHK: typing.ClassVar[Symbology] # value = + UPCE: typing.ClassVar[Symbology] # value = + UPCE_CC: typing.ClassVar[Symbology] # value = + UPCE_CHK: typing.ClassVar[Symbology] # value = + UPNQR: typing.ClassVar[Symbology] # value = + UPU_S10: typing.ClassVar[Symbology] # value = + USPS_IMAIL: typing.ClassVar[Symbology] # value = + VIN: typing.ClassVar[Symbology] # value = + + +class UltracodeOptions(enum.IntEnum): + """ + Ultracode specific option (`symbol->option_3`) + """ + ULTRA_COMPRESSION: typing.ClassVar[UltracodeOptions] # value = + + @classmethod + def __new__(cls, value): + ... + + def __format__(self, format_spec): + """ + Convert to a string according to format_spec. + """ + + +class Vector: + """ + Vector image information, returned from `Symbol.vector` after calling `Symbol.buffer_vector` + """ + + @property + def circles(self) -> VectorCircles: + """ + An iterable over circles (`VectorCircle`) + """ + + @property + def height(self) -> float: + """ + Height of barcode image (including text, whitespace) + """ + + @property + def hexagons(self) -> VectorHexagons: + """ + An iterable over hexagons (`VectorHexagon`) + """ + + @property + def rectangles(self) -> VectorRects: + """ + An iterable over rectangles (`VectorRectangle`) + """ + + @property + def strings(self) -> VectorStrings: + """ + An iterable over strings (`VectorString`) + """ + + @property + def width(self) -> float: + """ + Width of barcode image (including text, whitespace) + """ + + +class VectorCircle: + """ + Circle vector elements returned from `Vector.circles` + """ + + @property + def color(self) -> int: + """ + Zero for draw with foreground colour (else draw with background colour (legacy)). Alias of `colour` + """ + + @property + def colour(self) -> int: + """ + Zero for draw with foreground colour (else draw with background colour (legacy)) + """ + + @property + def diameter(self) -> float: + """ + Circle diameter. Does not include width (if any) + """ + + @property + def width(self) -> float: + """ + Width of circle perimeter (circumference). 0 for fill (disc) + """ + + @property + def x(self) -> float: + """ + Centre + """ + + @property + def y(self) -> float: + """ + Centre + """ + + +class VectorCircles: + + def __iter__(self) -> collections.abc.Iterator[VectorCircle]: + ... + + def __len__(self) -> int: + ... + + +class VectorHexagon: + """ + Hexagon vector elements returned from `Vector.hexagons` + """ + + @property + def diameter(self) -> float: + """ + Short (minimal) diameter (i.e. diameter of inscribed circle) + """ + + @property + def rotation(self) -> int: + """ + 0, 90, 180, 270 degrees, where 0 has apex at top, i.e. short diameter is horizontal + """ + + @property + def x(self) -> float: + """ + Centre + """ + + @property + def y(self) -> float: + """ + Centre + """ + + +class VectorHexagons: + + def __iter__(self) -> collections.abc.Iterator[VectorHexagon]: + ... + + def __len__(self) -> int: + ... + + +class VectorRect: + """ + Rectangle vector elements returned from `Vector.rectangles` + """ + + @property + def color(self) -> int: + """ + -1 for foreground, 1-8 for Cyan, Blue, Magenta, Red, Yellow, Green, Black, White. Alias of `colour` + """ + + @property + def colour(self) -> int: + """ + -1 for foreground, 1-8 for Cyan, Blue, Magenta, Red, Yellow, Green, Black, White + """ + + @property + def height(self) -> float: + ... + + @property + def width(self) -> float: + ... + + @property + def x(self) -> float: + """ + Left + """ + + @property + def y(self) -> float: + """ + Top + """ + + +class VectorRects: + + def __iter__(self) -> collections.abc.Iterator[VectorRect]: + ... + + def __len__(self) -> int: + ... + + +class VectorString: + """ + String vector elements returned from `Vector.strings` + """ + + @property + def fsize(self) -> float: + """ + Font size + """ + + @property + def halign(self) -> int: + """ + Horizontal alignment: 0 for centre, 1 for left, 2 for right (end) + """ + + @property + def length(self) -> int: + """ + Number of characters (bytes) + """ + + @property + def rotation(self) -> int: + """ + 0, 90, 180, 270 degrees + """ + + @property + def text(self) -> str: + ... + + @property + def width(self) -> float: + """ + Rendered width estimate + """ + + @property + def x(self) -> float: + """ + Relative to halign (i.e. centre, left, right) + """ + + @property + def y(self) -> float: + """ + Relative to baseline + """ + + +class VectorStrings: + + def __iter__(self) -> collections.abc.Iterator[VectorString]: + ... + + def __len__(self) -> int: + ... + + +class WarningLevel(enum.Enum): + """ + Warning level (`symbol->warn_level`) + """ + DEFAULT: typing.ClassVar[WarningLevel] # value = + FAIL_ALL: typing.ClassVar[WarningLevel] # value = + + +__upstream_version__: str = '2.15.0' +__version__: str = '1.2.2' diff --git a/src/stubs/stub-py39.g.pyi b/src/stubs/stub-py39.g.pyi new file mode 100644 index 00000000..60254db4 --- /dev/null +++ b/src/stubs/stub-py39.g.pyi @@ -0,0 +1,964 @@ +""" +A barcode encoding library supporting over 50 symbologies. +""" +from __future__ import annotations +import collections.abc +import enum +import typing +import typing_extensions + +__all__: list = [ + 'Symbol', 'Symbology', 'Seg', 'StructApp', 'Vector', 'VectorCircle', 'VectorHexagon', 'VectorRect', 'VectorString', + 'CapabilityFlags', 'DataMatrixOptions', 'InputMode', 'OutputOptions', 'QrFamilyOptions', 'UltracodeOptions', + 'WarningLevel' +] + + +class CapabilityFlags(enum.Flag): + """ + Capability flags (ZBarcode_Cap() `cap_flag`) + """ + COMPLIANT_HEIGHT: typing.ClassVar[CapabilityFlags] # value = + COMPOSITE: typing.ClassVar[CapabilityFlags] # value = + DOTTY: typing.ClassVar[CapabilityFlags] # value = + EANUPC: typing.ClassVar[CapabilityFlags] # value = + ECI: typing.ClassVar[CapabilityFlags] # value = + FIXED_RATIO: typing.ClassVar[CapabilityFlags] # value = + FULL_MULTIBYTE: typing.ClassVar[CapabilityFlags] # value = + GS1: typing.ClassVar[CapabilityFlags] # value = + HRT: typing.ClassVar[CapabilityFlags] # value = + MASK: typing.ClassVar[CapabilityFlags] # value = + QUIET_ZONES: typing.ClassVar[CapabilityFlags] # value = + READER_INIT: typing.ClassVar[CapabilityFlags] # value = + STACKABLE: typing.ClassVar[CapabilityFlags] # value = + STRUCTAPP: typing.ClassVar[CapabilityFlags] # value = + + +class DataMatrixOptions(enum.IntEnum): + """ + Data Matrix specific options (`symbol->option_3`) + """ + DMRE: typing.ClassVar[DataMatrixOptions] # value = + ISO_144: typing.ClassVar[DataMatrixOptions] # value = + SQUARE: typing.ClassVar[DataMatrixOptions] # value = + + +class InputMode(enum.Flag): + """ + Values for `Symbol.input_mode` + """ + DATA: typing.ClassVar[InputMode] # value = + ESCAPE: typing.ClassVar[InputMode] # value = + EXTRA_ESCAPE: typing.ClassVar[InputMode] # value = + FAST: typing.ClassVar[InputMode] # value = + GS1: typing.ClassVar[InputMode] # value = + GS1NOCHECK: typing.ClassVar[InputMode] # value = + GS1PARENS: typing.ClassVar[InputMode] # value = + HEIGHTPERROW: typing.ClassVar[InputMode] # value = + UNICODE: typing.ClassVar[InputMode] # value = + + +class OutputOptions(enum.Flag): + """ + Values for `Symbol.output_options` + """ + BARCODE_BIND: typing.ClassVar[OutputOptions] # value = + BARCODE_BIND_TOP: typing.ClassVar[OutputOptions] # value = + BARCODE_BOX: typing.ClassVar[OutputOptions] # value = + BARCODE_DOTTY_MODE: typing.ClassVar[OutputOptions] # value = + BARCODE_MEMORY_FILE: typing.ClassVar[OutputOptions] # value = + BARCODE_NO_QUIET_ZONES: typing.ClassVar[OutputOptions] # value = + BARCODE_QUIET_ZONES: typing.ClassVar[OutputOptions] # value = + BARCODE_STDOUT: typing.ClassVar[OutputOptions] # value = + BOLD_TEXT: typing.ClassVar[OutputOptions] # value = + CMYK_COLOUR: typing.ClassVar[OutputOptions] # value = + COMPLIANT_HEIGHT: typing.ClassVar[OutputOptions] # value = + EANUPC_GUARD_WHITESPACE: typing.ClassVar[OutputOptions] # value = + EMBED_VECTOR_FONT: typing.ClassVar[OutputOptions] # value = + GS1_GS_SEPARATOR: typing.ClassVar[OutputOptions] # value = + OUT_BUFFER_INTERMEDIATE: typing.ClassVar[OutputOptions] # value = + READER_INIT: typing.ClassVar[OutputOptions] # value = + SMALL_TEXT: typing.ClassVar[OutputOptions] # value = + + +class QrFamilyOptions(enum.IntEnum): + """ + QR, Han Xin, Grid Matrix specific options (`symbol->option_3`) + """ + FULL_MULTIBYTE: typing.ClassVar[QrFamilyOptions] # value = + + +class Seg: + """ + Segment for use with `Symbol.encode_segs`. + """ + + @typing.overload + def __init__(self) -> None: + ... + + @typing.overload + def __init__(self, arg0: typing_extensions.Buffer, arg1: typing.SupportsInt) -> None: + ... + + @property + def eci(self) -> int: + """ + Extended Channel Interpretation + """ + + @eci.setter + def eci(self, arg0: typing.SupportsInt) -> None: + ... + + @property + def source(self) -> memoryview: + """ + Data to encode + """ + + @source.setter + def source(self, arg1: typing_extensions.Buffer) -> None: + ... + + +class StructApp: + """ + Structural append information (see `Symbol.structapp`). + + Ignored unless `StructApp.count` is non-zero + """ + + @typing.overload + def __init__(self) -> None: + ... + + @typing.overload + def __init__(self, index: typing.SupportsInt, count: typing.SupportsInt, id: bytes = b'') -> None: + ... + + @property + def count(self) -> int: + """ + Number of symbols in Structured Append sequence. Set >= 2 to add SA Info + """ + + @count.setter + def count(self, arg0: typing.SupportsInt) -> None: + ... + + @property + def id(self) -> bytes: + """ + Optional ID to distinguish sequence, ASCII, max 32 long + """ + + @id.setter + def id(self, arg1: bytes) -> None: + ... + + @property + def index(self) -> int: + """ + Position in Structured Append sequence, 1-based. Must be <= `count` + """ + + @index.setter + def index(self, arg0: typing.SupportsInt) -> None: + ... + + +class Symbol: + """ + Main symbol structure. + """ + + @staticmethod + def capabilities(symbology: Symbology) -> CapabilityFlags: + """ + Return the capability flags for symbology `symbology` + """ + + @staticmethod + def default_xdim(symbology: Symbology) -> float: + """ + Return default X-dimension in mm for symbology `symbology`. Returns 0 on error (invalid `symbology`) + """ + + @staticmethod + def scale_from_xdim_dp( + symbology: Symbology, + /, + x_dim_mm: typing.SupportsFloat, + *, + dpmm: typing.SupportsFloat, + filetype: str | None = None + ) -> float: + """ + Return the scale to use for `symbology` for non-zero X-dimension `x_dim_mm` at `dpmm` dots per mm for `filetype`. If `dpmm` zero defaults to 12. If `filetype` is None, defaults to "GIF". Returns 0 on error + """ + + @staticmethod + def xdim_dp_from_scale( + symbology: Symbology, + /, + scale: typing.SupportsFloat, + *, + x_dim_mm_or_dpmm: typing.SupportsFloat, + filetype: str | None = None + ) -> float: + """ + Reverse of `Symbol.scale_from_xdim_dp`. Estimate the X-dimension or dpmm given non-zero `scale` and non-zero `x_dim_mm_or_dpmm`. Return value bound to dpmm max not X-dimension max. Returns 0 on error + """ + + def __init__(self) -> None: + ... + + def buffer(self, rotate_deg: typing.SupportsInt = 0) -> None: + """ + Output a previously encoded symbol to memory as raster (`Symbol.bitmap`) + """ + + def buffer_vector(self, rotate_deg: typing.SupportsInt = 0) -> None: + """ + Output a previously encoded symbol to memory as vector (`Symbol.vector`) + """ + + def clear(self) -> None: + """ + Free any output buffers that may have been created and initialize output fields + """ + + @typing.overload + def encode(self, data: bytes) -> None: + """ + Encode a barcode + """ + + @typing.overload + def encode(self, text: str) -> None: + """ + Encode a barcode + """ + + def encode_file(self, filename: str) -> None: + """ + Encode a barcode using input data from file `filename` + """ + + @typing.overload + def encode_segs(self, segs: collections.abc.Sequence[Seg]) -> None: + """ + Encode a barcode with multiple ECI segments + """ + + @typing.overload + def encode_segs(self, segs: collections.abc.Iterable) -> None: + """ + Encode a barcode with multiple ECI segments + """ + + def print(self, rotate_deg: typing.SupportsInt = 0) -> None: + """ + Output a previously encoded symbol to file `Symbol.outfile` + """ + + def reset(self) -> None: + """ + Free any output buffers that may have been created and reset all fields to defaults + """ + + @property + def alphamap(self) -> memoryview | None: + """ + Array of alpha values used (raster output only) + """ + + @property + def bgcolor(self) -> str: + """ + Background as hexadecimal RGB/RGBA or decimal "C,M,Y,K" string. Alias of bgcolour. + """ + + @bgcolor.setter + def bgcolor(self, arg1: str) -> None: + ... + + @property + def bgcolour(self) -> str: + """ + Background as hexadecimal RGB/RGBA or decimal "C,M,Y,K" string + """ + + @bgcolour.setter + def bgcolour(self, arg1: str) -> None: + ... + + @property + def bitmap(self) -> memoryview | None: + """ + Stored bitmap image (raster output only) + """ + + @property + def border_width(self) -> int: + """ + Size of border in X-dimensions + """ + + @border_width.setter + def border_width(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def debug(self) -> int: + """ + Debugging flags + """ + + @debug.setter + def debug(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def dot_size(self) -> float: + """ + Size of dots used in BARCODE_DOTTY_MODE. Default 0.8 + """ + + @dot_size.setter + def dot_size(self, arg1: typing.SupportsFloat) -> None: + ... + + @property + def dpmm(self) -> float: + """ + Resolution of output in dots per mm (BMP/EMF/PCX/PNG/TIF only). Default 0 (none) + """ + + @dpmm.setter + def dpmm(self, arg1: typing.SupportsFloat) -> None: + ... + + @property + def eci(self) -> int: + """ + Extended Channel Interpretation. Default 0 (none) + """ + + @eci.setter + def eci(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def encoded_data(self) -> memoryview: + """ + Encoded data (output only). Allows for rows of 1152 modules + """ + + @property + def errtxt(self) -> str: + """ + Error message if an error or warning occurs (output only) + """ + + @property + def fgcolor(self) -> str: + """ + Foreground as hexadecimal RGB/RGBA or decimal "C,M,Y,K" string. Alias of fgcolour. + """ + + @fgcolor.setter + def fgcolor(self, arg1: str) -> None: + ... + + @property + def fgcolour(self) -> str: + """ + Foreground as hexadecimal RGB/RGBA or decimal "C,M,Y,K" string + """ + + @fgcolour.setter + def fgcolour(self, arg1: str) -> None: + ... + + @property + def guard_descent(self) -> float: + """ + Height in X-dimensions that EAN/UPC guard bars descend. Default 5 + """ + + @guard_descent.setter + def guard_descent(self, arg1: typing.SupportsFloat) -> None: + ... + + @property + def height(self) -> float: + """ + Barcode height in X-dimensions (ignored for fixed-width barcodes) + """ + + @height.setter + def height(self, arg1: typing.SupportsFloat) -> None: + ... + + @property + def input_mode(self) -> InputMode: + """ + Encoding of input data (see `InputMode`). Default `InputMode.DATA` + """ + + @input_mode.setter + def input_mode(self, arg1: InputMode) -> None: + ... + + @property + def memfile(self) -> memoryview | None: + """ + In-memory file buffer if BARCODE_MEMORY_FILE (output only) + """ + + @property + def option_1(self) -> int: + """ + Symbol-specific options + """ + + @option_1.setter + def option_1(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def option_2(self) -> int: + """ + Symbol-specific options + """ + + @option_2.setter + def option_2(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def option_3(self) -> int: + """ + Symbol-specific options + """ + + @option_3.setter + def option_3(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def outfile(self) -> str: + """ + Name of file to output to. Default "out.png" + """ + + @outfile.setter + def outfile(self, arg1: str) -> None: + ... + + @property + def output_options(self) -> OutputOptions: + """ + Various output parameters (bind, box etc, see `OutputOptions`) + """ + + @output_options.setter + def output_options(self, arg1: OutputOptions) -> None: + ... + + @property + def primary(self) -> str: + """ + Primary message data (MaxiCode, Composite) + """ + + @primary.setter + def primary(self, arg1: str) -> None: + ... + + @property + def row_height(self) -> list: + """ + Heights of rows (output only). Allows for 200 row DotCode + """ + + @property + def rows(self) -> int: + """ + Number of rows used by the symbol (output only) + """ + + @property + def scale(self) -> float: + """ + Scale factor when printing barcode, i.e. adjusts X-dimension. Default 1 + """ + + @scale.setter + def scale(self, arg1: typing.SupportsFloat) -> None: + ... + + @property + def show_hrt(self) -> bool: + """ + If `True`, display Human Readable Text (HRT) on supported barcodes. Default `True`. Alias of `Symbol.show_text`. + """ + + @show_hrt.setter + def show_hrt(self, arg1: bool) -> None: + ... + + @property + def show_text(self) -> bool: + """ + If `True`, display Human Readable Text (HRT) on supported barcodes. Default `True` + """ + + @show_text.setter + def show_text(self, arg1: bool) -> None: + ... + + @property + def structapp(self) -> StructApp: + """ + Structured Append info. Default structapp.count 0 (none) + """ + + @structapp.setter + def structapp(self, arg1: StructApp) -> None: + ... + + @property + def symbology(self) -> Symbology: + """ + Symbol type to use (see `Symbology`) + """ + + @symbology.setter + def symbology(self, arg1: Symbology) -> None: + ... + + @property + def text(self) -> str: + """ + Human Readable Text (HRT) (if any), UTF-8 (output only) + """ + + @property + def text_gap(self) -> float: + """ + Gap between barcode and Human Readable Text (HRT) in X-dimensions. Default 1 + """ + + @text_gap.setter + def text_gap(self, arg1: typing.SupportsFloat) -> None: + ... + + @property + def vector(self) -> Vector: + """ + Vector header (vector output only) + """ + + @property + def warn_level(self) -> WarningLevel: + """ + Affects error/warning value returned by Zint API (see `WarningLevel`) + """ + + @warn_level.setter + def warn_level(self, arg1: WarningLevel) -> None: + ... + + @property + def whitespace_height(self) -> int: + """ + Height in X-dimensions of whitespace above & below the barcode + """ + + @whitespace_height.setter + def whitespace_height(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def whitespace_width(self) -> int: + """ + Width in X-dimensions of whitespace to left & right of barcode + """ + + @whitespace_width.setter + def whitespace_width(self, arg1: typing.SupportsInt) -> None: + ... + + @property + def width(self) -> int: + """ + Width of the generated symbol (output only) + """ + + +class Symbology(enum.Enum): + """ + Values for `Symbol.symbology` + """ + AUSPOST: typing.ClassVar[Symbology] # value = + AUSREDIRECT: typing.ClassVar[Symbology] # value = + AUSREPLY: typing.ClassVar[Symbology] # value = + AUSROUTE: typing.ClassVar[Symbology] # value = + AZRUNE: typing.ClassVar[Symbology] # value = + AZTEC: typing.ClassVar[Symbology] # value = + BC412: typing.ClassVar[Symbology] # value = + C25IATA: typing.ClassVar[Symbology] # value = + C25IND: typing.ClassVar[Symbology] # value = + C25INTER: typing.ClassVar[Symbology] # value = + C25LOGIC: typing.ClassVar[Symbology] # value = + C25STANDARD: typing.ClassVar[Symbology] # value = + CEPNET: typing.ClassVar[Symbology] # value = + CHANNEL: typing.ClassVar[Symbology] # value = + CODABAR: typing.ClassVar[Symbology] # value = + CODABLOCKF: typing.ClassVar[Symbology] # value = + CODE11: typing.ClassVar[Symbology] # value = + CODE128: typing.ClassVar[Symbology] # value = + CODE128AB: typing.ClassVar[Symbology] # value = + CODE16K: typing.ClassVar[Symbology] # value = + CODE32: typing.ClassVar[Symbology] # value = + CODE39: typing.ClassVar[Symbology] # value = + CODE49: typing.ClassVar[Symbology] # value = + CODE93: typing.ClassVar[Symbology] # value = + CODEONE: typing.ClassVar[Symbology] # value = + DAFT: typing.ClassVar[Symbology] # value = + DATAMATRIX: typing.ClassVar[Symbology] # value = + DBAR_EXP: typing.ClassVar[Symbology] # value = + DBAR_EXPSTK: typing.ClassVar[Symbology] # value = + DBAR_EXPSTK_CC: typing.ClassVar[Symbology] # value = + DBAR_EXP_CC: typing.ClassVar[Symbology] # value = + DBAR_LTD: typing.ClassVar[Symbology] # value = + DBAR_LTD_CC: typing.ClassVar[Symbology] # value = + DBAR_OMN: typing.ClassVar[Symbology] # value = + DBAR_OMNSTK: typing.ClassVar[Symbology] # value = + DBAR_OMNSTK_CC: typing.ClassVar[Symbology] # value = + DBAR_OMN_CC: typing.ClassVar[Symbology] # value = + DBAR_STK: typing.ClassVar[Symbology] # value = + DBAR_STK_CC: typing.ClassVar[Symbology] # value = + DOTCODE: typing.ClassVar[Symbology] # value = + DPD: typing.ClassVar[Symbology] # value = + DPIDENT: typing.ClassVar[Symbology] # value = + DPLEIT: typing.ClassVar[Symbology] # value = + DXFILMEDGE: typing.ClassVar[Symbology] # value = + EAN14: typing.ClassVar[Symbology] # value = + EANX: typing.ClassVar[Symbology] # value = + EANX_CC: typing.ClassVar[Symbology] # value = + EANX_CHK: typing.ClassVar[Symbology] # value = + EXCODE39: typing.ClassVar[Symbology] # value = + FIM: typing.ClassVar[Symbology] # value = + FLAT: typing.ClassVar[Symbology] # value = + GRIDMATRIX: typing.ClassVar[Symbology] # value = + GS1_128: typing.ClassVar[Symbology] # value = + GS1_128_CC: typing.ClassVar[Symbology] # value = + HANXIN: typing.ClassVar[Symbology] # value = + HIBC_128: typing.ClassVar[Symbology] # value = + HIBC_39: typing.ClassVar[Symbology] # value = + HIBC_AZTEC: typing.ClassVar[Symbology] # value = + HIBC_BLOCKF: typing.ClassVar[Symbology] # value = + HIBC_DM: typing.ClassVar[Symbology] # value = + HIBC_MICPDF: typing.ClassVar[Symbology] # value = + HIBC_PDF: typing.ClassVar[Symbology] # value = + HIBC_QR: typing.ClassVar[Symbology] # value = + ISBNX: typing.ClassVar[Symbology] # value = + ITF14: typing.ClassVar[Symbology] # value = + JAPANPOST: typing.ClassVar[Symbology] # value = + KIX: typing.ClassVar[Symbology] # value = + KOREAPOST: typing.ClassVar[Symbology] # value = + LOGMARS: typing.ClassVar[Symbology] # value = + MAILMARK_2D: typing.ClassVar[Symbology] # value = + MAILMARK_4S: typing.ClassVar[Symbology] # value = + MAXICODE: typing.ClassVar[Symbology] # value = + MICROPDF417: typing.ClassVar[Symbology] # value = + MICROQR: typing.ClassVar[Symbology] # value = + MSI_PLESSEY: typing.ClassVar[Symbology] # value = + NVE18: typing.ClassVar[Symbology] # value = + PDF417: typing.ClassVar[Symbology] # value = + PDF417COMP: typing.ClassVar[Symbology] # value = + PHARMA: typing.ClassVar[Symbology] # value = + PHARMA_TWO: typing.ClassVar[Symbology] # value = + PLANET: typing.ClassVar[Symbology] # value = + PLESSEY: typing.ClassVar[Symbology] # value = + POSTNET: typing.ClassVar[Symbology] # value = + PZN: typing.ClassVar[Symbology] # value = + QRCODE: typing.ClassVar[Symbology] # value = + RM4SCC: typing.ClassVar[Symbology] # value = + RMQR: typing.ClassVar[Symbology] # value = + TELEPEN: typing.ClassVar[Symbology] # value = + TELEPEN_NUM: typing.ClassVar[Symbology] # value = + ULTRA: typing.ClassVar[Symbology] # value = + UPCA: typing.ClassVar[Symbology] # value = + UPCA_CC: typing.ClassVar[Symbology] # value = + UPCA_CHK: typing.ClassVar[Symbology] # value = + UPCE: typing.ClassVar[Symbology] # value = + UPCE_CC: typing.ClassVar[Symbology] # value = + UPCE_CHK: typing.ClassVar[Symbology] # value = + UPNQR: typing.ClassVar[Symbology] # value = + UPU_S10: typing.ClassVar[Symbology] # value = + USPS_IMAIL: typing.ClassVar[Symbology] # value = + VIN: typing.ClassVar[Symbology] # value = + + +class UltracodeOptions(enum.IntEnum): + """ + Ultracode specific option (`symbol->option_3`) + """ + ULTRA_COMPRESSION: typing.ClassVar[UltracodeOptions] # value = + + +class Vector: + """ + Vector image information, returned from `Symbol.vector` after calling `Symbol.buffer_vector` + """ + + @property + def circles(self) -> VectorCircles: + """ + An iterable over circles (`VectorCircle`) + """ + + @property + def height(self) -> float: + """ + Height of barcode image (including text, whitespace) + """ + + @property + def hexagons(self) -> VectorHexagons: + """ + An iterable over hexagons (`VectorHexagon`) + """ + + @property + def rectangles(self) -> VectorRects: + """ + An iterable over rectangles (`VectorRectangle`) + """ + + @property + def strings(self) -> VectorStrings: + """ + An iterable over strings (`VectorString`) + """ + + @property + def width(self) -> float: + """ + Width of barcode image (including text, whitespace) + """ + + +class VectorCircle: + """ + Circle vector elements returned from `Vector.circles` + """ + + @property + def color(self) -> int: + """ + Zero for draw with foreground colour (else draw with background colour (legacy)). Alias of `colour` + """ + + @property + def colour(self) -> int: + """ + Zero for draw with foreground colour (else draw with background colour (legacy)) + """ + + @property + def diameter(self) -> float: + """ + Circle diameter. Does not include width (if any) + """ + + @property + def width(self) -> float: + """ + Width of circle perimeter (circumference). 0 for fill (disc) + """ + + @property + def x(self) -> float: + """ + Centre + """ + + @property + def y(self) -> float: + """ + Centre + """ + + +class VectorCircles: + + def __iter__(self) -> collections.abc.Iterator[VectorCircle]: + ... + + def __len__(self) -> int: + ... + + +class VectorHexagon: + """ + Hexagon vector elements returned from `Vector.hexagons` + """ + + @property + def diameter(self) -> float: + """ + Short (minimal) diameter (i.e. diameter of inscribed circle) + """ + + @property + def rotation(self) -> int: + """ + 0, 90, 180, 270 degrees, where 0 has apex at top, i.e. short diameter is horizontal + """ + + @property + def x(self) -> float: + """ + Centre + """ + + @property + def y(self) -> float: + """ + Centre + """ + + +class VectorHexagons: + + def __iter__(self) -> collections.abc.Iterator[VectorHexagon]: + ... + + def __len__(self) -> int: + ... + + +class VectorRect: + """ + Rectangle vector elements returned from `Vector.rectangles` + """ + + @property + def color(self) -> int: + """ + -1 for foreground, 1-8 for Cyan, Blue, Magenta, Red, Yellow, Green, Black, White. Alias of `colour` + """ + + @property + def colour(self) -> int: + """ + -1 for foreground, 1-8 for Cyan, Blue, Magenta, Red, Yellow, Green, Black, White + """ + + @property + def height(self) -> float: + ... + + @property + def width(self) -> float: + ... + + @property + def x(self) -> float: + """ + Left + """ + + @property + def y(self) -> float: + """ + Top + """ + + +class VectorRects: + + def __iter__(self) -> collections.abc.Iterator[VectorRect]: + ... + + def __len__(self) -> int: + ... + + +class VectorString: + """ + String vector elements returned from `Vector.strings` + """ + + @property + def fsize(self) -> float: + """ + Font size + """ + + @property + def halign(self) -> int: + """ + Horizontal alignment: 0 for centre, 1 for left, 2 for right (end) + """ + + @property + def length(self) -> int: + """ + Number of characters (bytes) + """ + + @property + def rotation(self) -> int: + """ + 0, 90, 180, 270 degrees + """ + + @property + def text(self) -> str: + ... + + @property + def width(self) -> float: + """ + Rendered width estimate + """ + + @property + def x(self) -> float: + """ + Relative to halign (i.e. centre, left, right) + """ + + @property + def y(self) -> float: + """ + Relative to baseline + """ + + +class VectorStrings: + + def __iter__(self) -> collections.abc.Iterator[VectorString]: + ... + + def __len__(self) -> int: + ... + + +class WarningLevel(enum.Enum): + """ + Warning level (`symbol->warn_level`) + """ + DEFAULT: typing.ClassVar[WarningLevel] # value = + FAIL_ALL: typing.ClassVar[WarningLevel] # value = + + +__upstream_version__: str = '2.15.0' +__version__: str = '1.2.2'