def version_range(version):
"""\
Returns the version range for the provided version. This applies to QR Code
versions, only.
:param int version: The QR Code version (1 .. 40)
:rtype: int
"""
# ISO/IEC 18004:2015(E)
# Table 3 — Number of bits in character count indicator for QR Code (page 23)
if 0 < version < 10:
return consts.VERSION_RANGE_01_09
elif 9 < version < 27:
return consts.VERSION_RANGE_10_26
elif 26 < version < 41:
return consts.VERSION_RANGE_27_40
raise VersionError('Unknown version "{0}"'.format(version))
评论列表
文章目录