Added type annotations to instance fields in Python code.

pull/110/head
Project Nayuki 4 years ago
parent f9d1172e29
commit a807ee27db

@ -168,6 +168,16 @@ class QrCode:
return QrCode(version, ecl, datacodewords, mask) return QrCode(version, ecl, datacodewords, mask)
# ---- Private fields ----
_version: int
_size: int
_errcorlvl: QrCode.Ecc
_mask: int
_modules: List[List[bool]]
_isfunction: List[List[bool]]
# ---- Constructor (low level) ---- # ---- Constructor (low level) ----
def __init__(self, version: int, errcorlvl: QrCode.Ecc, datacodewords: List[int], mask: int) -> None: def __init__(self, version: int, errcorlvl: QrCode.Ecc, datacodewords: List[int], mask: int) -> None:
@ -681,6 +691,9 @@ class QrCode:
# ---- Public helper enumeration ---- # ---- Public helper enumeration ----
class Ecc: class Ecc:
ordinal: int
formatbits: int
"""The error correction level in a QR Code symbol. Immutable.""" """The error correction level in a QR Code symbol. Immutable."""
# Private constructor # Private constructor
def __init__(self, i: int, fb: int) -> None: def __init__(self, i: int, fb: int) -> None:
@ -798,6 +811,13 @@ class QrSegment:
return QrSegment(QrSegment.Mode.ECI, 0, bb) return QrSegment(QrSegment.Mode.ECI, 0, bb)
# ---- Private fields ----
_mode: QrSegment.Mode
_numchars: int
_bitdata: List[int]
# ---- Constructor (low level) ---- # ---- Constructor (low level) ----
def __init__(self, mode: QrSegment.Mode, numch: int, bitdata: List[int]) -> None: def __init__(self, mode: QrSegment.Mode, numch: int, bitdata: List[int]) -> None:
@ -875,6 +895,9 @@ class QrSegment:
class Mode: class Mode:
"""Describes how a segment's data bits are interpreted. Immutable.""" """Describes how a segment's data bits are interpreted. Immutable."""
_modebits: int
_charcounts: Tuple[int,int,int]
# Private constructor # Private constructor
def __init__(self, modebits: int, charcounts: Tuple[int,int,int]): def __init__(self, modebits: int, charcounts: Tuple[int,int,int]):
self._modebits = modebits # The mode indicator bits, which is a uint4 value (range 0 to 15) self._modebits = modebits # The mode indicator bits, which is a uint4 value (range 0 to 15)

Loading…
Cancel
Save