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


Python Task.summary方法代码示例

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


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

示例1: load

# 需要导入模块: from Task import Task [as 别名]
# 或者: from Task.Task import summary [as 别名]
    def load(self, filename):
        f = open(filename, 'r')
        f = FileWrapper(f)
        state = "Start"
        newtask = None
        newpomo = None

        skip_read = False
        while True:
            if not skip_read:
                line = f.readline()
            skip_read = False
            if line == "":
                break
            if state == "Start":
                if re.match("#### Task", line):
                    newtask = Task("", "")
                    state = "Task_State"
                    skip_read = True
                if re.match("#### Pomodoro", line):
                    newpomo = Pomo()
                    state = "Pomo_Remaining"

            elif state == "Task_State":

                found, val = self._loadField(f, 'State', hasfield=True)
                if not found:
                    return False
                newtask.state = val

                found, val = self._loadField(f, 'Blocked Reason', hasfield=True, multiline=True)
                if not found:
                    return False
                if val is not None:
                    newtask.blocked_reason = "".join(val).strip()

                found, val = self._loadField(f, 'Closed Reason', hasfield=True, multiline=True)
                if not found:
                    return False
                if val is not None:
                    newtask.closed_reason = "".join(val).strip()

                found, val = self._loadField(f, 'Id', hasfield=True)
                if not found:
                    return False
                if val is not None:
                    newtask.id = int(val)

                found, val = self._loadField(f, 'Date Created', hasfield=True)
                if not found:
                    return False
                if val is not None:
                    newtask.date_created = int(val)

                found, val = self._loadField(f, 'Date Closed', hasfield=True)
                if not found:
                    return False
                if val is not None:
                    newtask.date_closed = int(val)

                found, val = self._loadField(f, 'Date Due', hasfield=True)
                if not found:
                    return False
                if val is not None:
                    newtask.date_due = int(val)

                found, val = self._loadField(f, 'Time Estimate', hasfield=True)
                if not found:
                    return False
                if val is not None:
                    newtask.time_estimate = int(val)

                found, val = self._loadField(f, 'Time Spent', hasfield=True)
                if not found:
                    return False
                if val is not None:
                    newtask.time_spent = int(val)

                found, val = self._loadField(f, 'Summary', hasfield=True, multiline=True)
                if not found:
                    return False
                if val is not None:
                    newtask.summary = "".join(val).strip()

                found, val = self._loadField(f, 'Description', hasfield=True, multiline=True)
                if not found:
                    return False
                if val is not None:
                    newtask.description = "".join(val).strip()

                self.tasks.append(newtask)
                state = "End"

            elif state == "End":
                if re.match("#### Task", line) or re.match("#### Pomodoro", line):
                    if re.match("#### Task", line):
                        state = "Task_State"
                        skip_read = True
                        newtask = Task("", "")
                    else:
#.........这里部分代码省略.........
开发者ID:absolom,项目名称:tsk,代码行数:103,代码来源:Storage.py


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