当前位置: 首页>>代码示例>>Python>>正文


Python Task.done方法代码示例

本文整理汇总了Python中task.Task.done方法的典型用法代码示例。如果您正苦于以下问题:Python Task.done方法的具体用法?Python Task.done怎么用?Python Task.done使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在task.Task的用法示例。


在下文中一共展示了Task.done方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: read_tasks

# 需要导入模块: from task import Task [as 别名]
# 或者: from task.Task import done [as 别名]
 def read_tasks(cls, infile):
     tasks = []
     default_tz = pytz.utc
     for event, elem in etree.iterparse(infile, events=("start", "end")):
         if event == "start":
             if elem.tag == "defaults":
                 in_defaults = True
         else:
             # Stop reading as soon as the </tasks> tag is encountered.
             if elem.tag == "tasks":
                 break
             elif elem.tag == "defaults":
                 in_defaults = False
             # Otherwise, parse each <task> element in accordance to the way
             # it was output.
             elif elem.tag == "task":
                 attrs = elem.attrib
                 # XXX When project of a task becomes something more than
                 # just a string, the code will probably break on the
                 # following line.
                 if "project" in attrs:
                     project = attrs["project"]
                 else:
                     project = ""
                 task = Task(name=elem.text, project=project, id=int(attrs["id"]))
                 if "done" in attrs:
                     task.done = bool(int(attrs["done"]))
                 if "time" in attrs:
                     task.time = cls._timedelta_fromrepr(attrs["time"])
                 if "deadline" in attrs:
                     task.deadline = cls._read_time(attrs, "deadline", default_tz=default_tz)
                 tasks.append(task)
             elif elem.tag == "timezone" and in_defaults:
                 default_tz = pytz.timezone(elem.text)
     return tasks
开发者ID:RichardLitt,项目名称:wyrd-django-dev,代码行数:37,代码来源:xml.py

示例2: read_tasks

# 需要导入模块: from task import Task [as 别名]
# 或者: from task.Task import done [as 别名]
    def read_tasks(cls, infile):
        tasks = []
        default_tz = pytz.utc
        in_tasks = False
        in_groups = False
        in_defaults = False
        for event, elem in etree.iterparse(infile, events=('start', 'end')):
            if event == 'start':
                if elem.tag == 'defaults':
                    in_defaults = True
                elif elem.tag == 'tasks':
                    in_tasks = True
                    continue
                elif elem.tag == 'groups':
                    in_groups = True

            # if event == 'end':
            else:
                if elem.tag == 'defaults':
                    in_defaults = False
                elif elem.tag == "groups":
                    in_groups = False
                # Stop reading as soon as the </tasks> tag is encountered.
                elif elem.tag == "tasks":
                    break
                # Skip the subtree describing groupings.
                if in_groups:
                    continue
                elif in_tasks and elem.tag == "task":
                    # Otherwise, parse each <task> element in accordance to the
                    # way it was output.
                    attrs = elem.attrib
                    # XXX When project of a task becomes something more than
                    # just a string, the code will probably break on the
                    # following line.
                    if 'project' in attrs:
                        project = attrs['project']
                    else:
                        project = ''
                    task = Task(name=elem.text,
                                project=project,
                                id=int(attrs['id']))
                    if 'done' in attrs:
                        task.done = bool(int(attrs['done']))
                    if 'time' in attrs:
                        task.time = cls._timedelta_fromrepr(attrs['time'])
                    if 'deadline' in attrs:
                        task.deadline = cls._read_time(attrs, 'deadline',
                                                       default_tz=default_tz)
                    tasks.append(task)
                elif in_defaults and elem.tag == 'timezone':
                    default_tz = pytz.timezone(elem.text)
        return tasks
开发者ID:RichardLitt,项目名称:wyrd-core,代码行数:55,代码来源:xml.py


注:本文中的task.Task.done方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。