本文整理汇总了Python中psr.sys.Sys.time方法的典型用法代码示例。如果您正苦于以下问题:Python Sys.time方法的具体用法?Python Sys.time怎么用?Python Sys.time使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类psr.sys.Sys
的用法示例。
在下文中一共展示了Sys.time方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: send
# 需要导入模块: from psr.sys import Sys [as 别名]
# 或者: from psr.sys.Sys import time [as 别名]
def send(self, msg, box='INBOX'):
""""""
mid = None
date = Time2Internaldate(Sys.time())
status, resp = self.cnx.append(box, '\Draft', date, bytes(msg,'utf-8'))
if status==self.OK:
mid = str(resp[0],'utf-8')[11:-11].split(' ')
return mid
示例2: onCommandSplit
# 需要导入模块: from psr.sys import Sys [as 别名]
# 或者: from psr.sys.Sys import time [as 别名]
def onCommandSplit(self):
""""""
done = True
Sys.cli_emit_progress(1)
if not self.o.parts is None and not(int(self.o.parts)>=12 and int(self.o.parts) <=62) :
self.parser.error_cmd((('invalid option ',('-p, --parts', Sys.Clz.fgb3), ' value (', ('12',Sys.Clz.fgb3),' to ', ('62',Sys.Clz.fgb3),')'),))
else : self.o.parts = int(self.o.parts)
if not Sys.g.QUIET : self.parser.print_header()
if self.o.outputfile is not None :
if self.o.outputfile[-5:]!='.tark' : self.o.outputfile += '.tark'
if Io.file_exists(self.o.outputfile) and not self.o.force:
Sys.pwarn((('the file ',(self.o.outputfile, Sys.Clz.fgb3), ' already exists !'),))
done = Sys.pask('Are you sure to rewrite this file')
self.stime = Sys.datetime.now()
if done :
try :
Sys.ptask()
Sys.cli_emit_progress(2)
key = Io.get_data(self.o.keyfile)
km = Kirmah(key)
hlst = km.ck.getHashList(Sys.basename(self.a[1]), self.o.parts, True)
Sys.cli_emit_progress(3)
kcf = km.splitFile(self.a[1], hlst)
t = int(Sys.time())
times = (t,t)
p = 85
Sys.cli_emit_progress(p)
Io.touch(kcf, times)
frav = 0.24
for row in hlst['data']:
p += frav
Io.touch(row[1]+km.EXT,times)
Sys.cli_emit_progress(p)
if self.o.outputfile is not None :
d = Sys.datetime.now()
if Sys.g.DEBUG : Sys.wlog(Sys.dprint())
Sys.ptask('Preparing tark file')
hlst['data'] = sorted(hlst['data'], key=lambda lst: lst[4])
with tarfile.open(self.o.outputfile, mode='w') as tar:
tar.add(kcf, arcname=Sys.basename(kcf))
p = 90
for row in hlst['data']:
tar.add(row[1]+km.EXT, arcname=Sys.basename(row[1]+km.EXT))
p += frav
Sys.cli_emit_progress(p)
Sys.pstep('Packing destination file', d, True)
d = Sys.datetime.now()
Sys.ptask('Finalize')
for row in hlst['data']:
Io.removeFile(row[1]+km.EXT)
p += frav
Sys.cli_emit_progress(p)
Io.removeFile(kcf)
Sys.pstep('Cleaning', d, True)
except Exception as e :
done = False
if Sys.g.DEBUG :
print('split exception')
print(e)
#~ raise e
elif not Sys.g.QUIET :
Sys.pwarn((str(e),))
if not Sys.g.QUIET:
Sys.cli_emit_progress(100)
self.onend_cmd('Kirmah Split', self.stime, done, self.o.outputfile)