catalog.py 文件源码

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

项目:astrocats 作者: astrocatalogs 项目源码 文件源码
def _get_task_priority(tasks, task_priority):
    """Get the task `priority` corresponding to the given `task_priority`.

    If `task_priority` is an integer or 'None', return it.
    If `task_priority` is a str, return the priority of the task it matches.
    Otherwise, raise `ValueError`.
    """
    if task_priority is None:
        return None
    if is_integer(task_priority):
        return task_priority
    if isinstance(task_priority, basestring):
        if task_priority in tasks:
            return tasks[task_priority].priority

    raise ValueError("Unrecognized task priority '{}'".format(task_priority))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号