functions.py 文件源码

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

项目:pyshtrih 作者: oleg-golovanov 项目源码 文件源码
def handle_fr_flags(arg):
    def get_keys(revision):
        return (
            (u'??????????? ???????? ??????????', u'????? ???????? ??????')[revision],
            u'???? ????? ?????????',
            (u'????? ?????? ??????? ????????', u'?????? ?? ?????? ?? ??????????')[revision],
            (u'????? ??????? ??????? ????????', u'?????? ?? ????? ? ?????????', u'?????? ????????')[revision],
            u'???????? ????',
            u'?????? ??????? ??',
            u'????? ???????????? ??????? ?????',
            u'????? ???????????? ??????????? ?????',
            u'?????????? ?????? ??????? ?????',
            u'?????????? ?????? ????????????? ???????',
            u'????',
            u'????????? ?????????? ?????',
            u'?????? ?????? ??????????? ?????????',
            u'??????? ?????? ??????????? ?????????',
            u'????? ??????? ?????',
            u'????? ????????????? ???????'
        )

    bits = misc.int_to_bits(arg, 16)

    a, b, c = 0, 1, 2
    flags_actual = {
        # ?????-??-?
        4: ((0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1), a),
        # ?????-?????-??-?
        9: ((0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0), a),
        # ?????-?????-??-? (?????? 02)
        12: ((0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0), a)
    }

    flags, rev = flags_actual.get(
        handle_fr_flags.model,
        ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), a)
    )

    return dict(
        zip(
            itertools.compress(get_keys(rev), flags),
            itertools.compress(bits, flags)
        )
    )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号