registry.py 文件源码

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

项目:lunch-break-rl 作者: joshuaskelly 项目源码 文件源码
def register(item, category, weight):
        entry = Registry._registered_categories.get(category)
        category_list = entry[0] if entry else None
        weight_table = entry[1] if entry else None

        if not category_list:
            category_list = []

        if not weight_table:
            weight_table = []

        if (item, weight) not in category_list:
            category_list.append((weight, item))

        weight_table = list(accumulate([i[0] for i in category_list]))

        Registry._registered_categories[category] = category_list, weight_table
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号