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


Python State.deduplicate方法代码示例

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


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

示例1: main

# 需要导入模块: from State import State [as 别名]
# 或者: from State.State import deduplicate [as 别名]

#.........这里部分代码省略.........
    #  report('  ' + t.name + ' | ' + t.parents[0])

    #sys.exit()
    def task_props(state, state_previous, name, pre):
      ap = ''
      a  = ''
      cp = ''
      c  = ''
      try:
        a  = state.active.find_tasks_by_name(name=name)[0]
      except: pass
      try:
        ap = state_previous.active.find_tasks_by_name(name=name)[0]
      except: pass
      try:
        c  = state.caldav.find_tasks_by_name(name=name)[0]
      except: pass
      try:
        cp = state_previous.caldav.find_tasks_by_name(name=name)[0]
      except: pass
      print ''
      print pre, 'a ', a  #,  a.due.strftime('%y%m%d%H%M%S%z')
      print pre, 'ap', ap #, ap.due.strftime('%y%m%d%H%M%S%z')
      print pre, 'c ', c  #,  c.due.strftime('%y%m%d%H%M%S%z')
      print pre, 'cp', cp #, cp.due.strftime('%y%m%d%H%M%S%z')

    if options.daemon:
      signal_init()
      report(colour.blue + 'Awaking daemon' + colour.end + colour.grey + ', interlude %(interlude)ds' % {'interlude':universe.interlude}  + colour.end)

    from CaldavClient import calendar_ctag
    polllast = None
    consecutive = 0
    deduplicate_attempt = 0
    while True:
      universe.errors = u''
      universe.reportline = 0
      universe.reportcache = u''
      update_now()
      aiyo_changed = repo_update()
      caldav_changed = calendar_ctag()
      check = False

      #print aiyo_changed, caldav_changed, (polllast is None)
      if aiyo_changed: check = True
      if caldav_changed: check = True
      if deduplicate_attempt > 0: check = True
      if polllast is None:
        check = True
      elif universe.now >= polllast + timedelta(seconds=universe.routine):
        check = True
      
      if check:
        if (aiyo_changed and caldav_changed):
          report(colour.blue + 'Changed detected in aiyo and caldav' + colour.end)
        elif aiyo_changed:
          report(colour.blue + 'Changed detected in aiyo' + colour.end)
        elif caldav_changed:
          report(colour.blue + 'Changed detected in caldav' + colour.end)
        elif (deduplicate_attempt > 0):
          report(colour.blue + 'Duplicate to resolve' + colour.end)
        elif polllast is None:
          report(colour.blue + 'First instance, running as if there has been a change' + colour.end)
        elif (universe.now >= polllast + timedelta(seconds=universe.routine)):
          report(colour.blue + 'Routine check' + colour.end)
开发者ID:adamcandy,项目名称:Gaia,代码行数:69,代码来源:Server.py


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