本文整理汇总了Python中psr.sys.Sys类的典型用法代码示例。如果您正苦于以下问题:Python Sys类的具体用法?Python Sys怎么用?Python Sys使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Sys类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onCommandInfo
def onCommandInfo(self):
""""""
key = self.getMatchKey()
if key is not None:
Sys.clear()
self.pheader()
self.impst.getInfo(int(self.a[1]))
示例2: getCountParts
def getCountParts(self, fromPath):
""""""
fsize = Sys.getsize(fromPath)
count = Sys.ceil(fsize / 19710000)
minp, maxp = 52, 62
if fsize < 4800000:
minp, maxp = 8, 16
elif fsize < 22200000:
minp, maxp = 16, 22
elif fsize < 48000000:
minp, maxp = 22, 32
elif fsize < 222000000:
minp, maxp = 32, 42
if count < minp:
count = choice(list(range(minp, maxp)))
if not count > 62:
return count
else:
raise Exception(
fromPath
+ " size exceeds limits (max : "
+ formatBytes(self.ck.psize * 62)
+ " ["
+ str(self.ck.psize * 64)
+ " bytes])"
)
示例3: getBackupAddMap
def getBackupAddMap(self):
""""""
data = None
if Io.file_exists(self.addmapPath + Kirmah.EXT):
call = " ".join(
[
Sys.executable,
"kirmah-cli.py",
"dec",
"-qf",
self.addmapPath + Kirmah.EXT,
"-z",
"-r",
"-m",
"-o",
self.addmapPath,
"-k",
self.idxu.index.keyPath,
]
)
print(call)
Sys.sysCall(call)
data = jloads(Io.get_data(self.addmapPath))
Io.removeFile(self.addmapPath)
return data
示例4: update
def update(self):
""""""
self.switchFileAccount(self.conf.profile)
try:
if self.idx != None :
if not isinstance(self.idx,bytes):
self.idx = Io.bytes(self.idx)
self.delids.append(self.idx)
except Exception as e :
Sys.dprint('error : ')
Sys.dprint(e)
self.index.fixDuplicateIds()
#~ self.index.fixAccount('gmail5')
self.index.encrypt()
msgIndex = self.mb.buildIndex(self.pathIdx)
_, self.idx = self.ih.send(msgIndex.as_string(), self.rootBox)
date = self.ih.headerField(self.idx, 'date', True)
self.conf.sets((['uid' , self.idx , 'index'],
['date' , date , 'index'],
['time' , str(Sys.datetime.now()), 'index']))
Sys.pwlog([(' Index updated (' , Const.CLZ_0),
(str(int(self.idx)) , Const.CLZ_2),
(') ' , Const.CLZ_0),
(str(date) , Const.CLZ_7, True)])
try :
self.ih.delete(self.delids, True)
except :
Sys.dprint('error : ')
Sys.dprint(e)
self.ih.clearTrash()
return True
示例5: save
def save(self,path=None,notAssign=False):
""""""
path = path if path is not None else self.path
Io.set_data(path, '# last updated : '+str(Sys.datetime.now())+Const.LF+self.toString())
call = ' '.join(['python3', 'kirmah-cli.py', 'enc', '-qf', path, '-z', '-r', '-m', '-o', path+'.kmh', '-k', self.keyPath ])
Sys.sysCall(call)
Io.removeFile(path)
if not notAssign : self.path = path
示例6: pheader
def pheader(self):
self.Cli.printLineSep(Const.LINE_SEP_CHAR, Const.LINE_SEP_LEN)
self.Cli.printHeaderTitle(self.Cli.conf.PRG_CLI_NAME)
self.Cli.printHeaderPart("account", self.account)
self.Cli.printHeaderPart("index", self.uid)
self.Cli.printHeaderPart("box", self.rootBox)
Sys.echo(self.date, Sys.Clz.fgB7, True, True)
self.Cli.printLineSep(Const.LINE_SEP_CHAR, Const.LINE_SEP_LEN)
示例7: on_new_file_source
def on_new_file_source(self, fc, data=None):
""""""
try:
self.app.setSourceFile(fc.get_filename())
self.IS_SOURCE_DEF = True
except FileNotFoundException as e:
Sys.eprint('FileNotFoundException :' + str(fc.get_filename()), Const.ERROR)
self.IS_SOURCE_DEF = False
self.refreshProceed()
示例8: createDefaultKeyIfNone
def createDefaultKeyIfNone(self):
""""""
kpath = self.getDefaultKeyPath()
if not Io.file_exists(kpath):
if Sys.isUnix():
if not Sys.isdir(conf.DEFVAL_UKEY_PATH):
Sys.mkdir_p(conf.DEFVAL_UKEY_PATH)
Io.set_data(kpath, KeyGen(conf.DEFVAL_UKEY_LENGHT).key)
self.selectKey(kpath)
示例9: main
def main():
try:
c = 0
Cli('.'+Sys.sep)
except Exception as e :
Sys.pwarn((('main : ',(str(e),Sys.CLZ_ERROR_PARAM), ' !'),), True)
#~ raise e
c = 1
return c
示例10: main
def main():
try:
c = 0
AppGui()
except Exception as e:
Sys.pwarn((('main : ',(str(e),Sys.CLZ_ERROR_PARAM), ' !'),), True)
raise e
c = 1
return c
示例11: add
def add(self, key, label, count, ext='', usr='', cat='', fhash='', size=0, account=''):
"""Add an entry to the index
"""
if self.get(fhash) == None :
self.dic[fhash] = (self.id, fhash, label, size, count, ext, usr, cat, account, key)
self.id +=1
return self.id-1
else :
Sys.dprint(label+' already exist')
示例12: build
def build(self):
Sys.pwlog([(' Reading index, please wait...', Const.CLZ_7, True)])
self.index = ImpraIndex(self.conf.get('key','keys'), self.pathIdx, self.getIndexDefaultCatg(), self.getAccountList())
defUsers = self.conf.get('users','catg')
if not ImpraIndex.SEP_KEY_INTERN+'users' in self.index.dic:
self.index.dic[ImpraIndex.SEP_KEY_INTERN+'users'] = {}
for k in self.index.dic[ImpraIndex.SEP_KEY_INTERN+'users']:
if self.index.dic[ImpraIndex.SEP_KEY_INTERN+'users'][k] not in [ i.strip() for i in defUsers.split(',')]:
self.conf.set('users',defUsers+', '+self.index.dic[ImpraIndex.SEP_KEY_INTERN+'users'][k],'catg')
示例13: printHeaderPart
def printHeaderPart(label,value):
""""""
a, b, c = ' [',':' ,'] '
Sys.echo(a , Sys.CLZ_HEAD_SEP, False)
Sys.echo(label, Sys.CLZ_HEAD_KEY, False)
Sys.echo(b , Sys.CLZ_HEAD_SEP, False)
Sys.echo(value, Sys.CLZ_HEAD_VAL, False)
Sys.echo(c , Sys.CLZ_HEAD_SEP, False)
return [(a,Const.CLZ_HEAD_SEP),(label,Const.CLZ_HEAD_KEY),(b,Const.CLZ_HEAD_SEP),(value,Const.CLZ_HEAD_VAL),(c,Const.CLZ_HEAD_SEP)]
示例14: stop
def stop(self):
""""""
if self.isAlive():
self.cancel()
if current_thread().getName()==self.getName():
try:
self.emit('interrupted')
Sys.thread_exit()
except RuntimeError as e :
print(str(self.getName()) + ' COULD NOT BE TERMINATED')
raise e
示例15: halt_thread
def halt_thread(self, *args):
Sys.wlog(Sys.dprint())
Sys.pwarn(('thread interrupt',), False)
self.get('button1').set_sensitive(False)
if self.thkmh is not None and self.thkmh.isAlive():
self.thkmh.cancel()
else :
self.textbuffer.insert_at_cursor('Kmh Thread is not Alive\n')
self.on_proceed_end(True)
self.pb.hide()
self.show_log()