__init__.py 文件源码

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

项目:todo.txt-pylib 作者: funkyfuture 项目源码 文件源码
def __figure_out_task_attribute_and_operator(criteria):
        swap_operands = False

        if '__' in criteria:
            attribute, op = criteria.split('__')
            op = get_operator_function(op)
        else:
            attribute, op = criteria, operator.eq

        if not hasattr(Task, attribute):
            if hasattr(Task, attribute + 's'):
                op = operator.contains
                attribute += 's'
            else:
                raise RuntimeError("Task doesn't have such attribute.")
        elif op is operator.contains:
            swap_operands = True

        return attribute, op, swap_operands
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号