本文整理汇总了Python中State.State.save方法的典型用法代码示例。如果您正苦于以下问题:Python State.save方法的具体用法?Python State.save怎么用?Python State.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类State.State
的用法示例。
在下文中一共展示了State.save方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from State import State [as 别名]
# 或者: from State.State import save [as 别名]
def main():
class options:
reset = False
extras = []
showall = False
daemon = False
once = False
sleepsecs = 10
plain = False
clearlog = False
log = False
showloglocation = False
taillog = False
backupcaldav = False
ctag = False
priorityonly = False
inboxonly = False
args = sys.argv[1:]
while (len(args) > 0):
argument = args.pop(0).rstrip()
if (argument == '-h'): usage()
elif (argument == '-v'): universe.verbose = True
elif (argument == '-p'): options.plain = True
elif (argument == '-d'): universe.dry = True
elif (argument == '-1'): options.once = True
elif (argument == 'daemon'): options.daemon = True
elif (argument == 'priority'): options.priorityonly = True
elif (argument == 'p'): options.priorityonly = True
elif (argument == 'inbox'): options.inboxonly = True
elif (argument == 'i'): options.inboxonly = True
elif (argument == 'debug'): universe.debug = True #; options.sleepsecs = 1
elif (argument == '-r'): options.reset = True
elif (argument == 'reset'): options.reset = True
elif (argument == '-s'): options.showall = True
elif (argument == 'showall'): options.showall = True
elif (argument == 'showloglocation'): options.showloglocation = True; options.plain = True
elif (argument == 'clear'): options.clearlog = True
elif (argument == 'backup'): options.backupcaldav = True
elif (argument == 'ctag'): options.ctag = True
elif (argument == 'tail'): options.taillog = True
elif (argument == '-t'): options.taillog = True
elif (argument == '-l'): options.log = True; options.plain = True
elif (argument.startswith('-')): usage(unknown = argument)
else:
options.extras = [ argument ] + options.extras
set_default_times(due='1800', alarm='1000', duealt='0900', warning='0020')
colourset(not options.plain)
if options.log:
universe.log = universe.logfile
universe.bufferreturned = False
else:
universe.bufferreturned = True
universe.log = None
if options.backupcaldav:
from CaldavClient import calendar_backup
ok = True
for calendar in universe.backupcalendars:
universe.calendarcache.clear()
lok = calendar_backup(principalurl=calendar)
if not lok: ok = False
if ok:
sys.exit(0)
else:
sys.exit(1)
if options.ctag:
from CaldavClient import calendar_ctag
calendar_ctag(debug=True)
sys.exit(0)
if options.clearlog:
clear_log()
sys.exit(0)
if options.showloglocation:
report(universe.logfile, forced=True)
sys.exit(0)
if options.taillog:
tail(universe.logfile)
sys.exit(0)
if options.reset:
from CaldavClient import calendars_clear
state = State(generate=True)
if not state.is_valid():
report(colour.red + 'Problem generating state (initial)' + colour.end)
sys.exit(1)
report(colour.red + 'Reset caldav and saved state' + colour.end)
state.caldav.remove_all()
calendars_clear(state.aiyo.child_names() + universe.auxlists)
for task in state.active.events:
state.caldav.add(task)
state = State(generate=True)
if not state.is_valid():
report(colour.red + 'Problem generating state (final)' + colour.end)
#.........这里部分代码省略.........