encoder.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:segno 作者: heuer 项目源码 文件源码
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))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号