本文整理汇总了Python中psr.sys.Sys.sysCall方法的典型用法代码示例。如果您正苦于以下问题:Python Sys.sysCall方法的具体用法?Python Sys.sysCall怎么用?Python Sys.sysCall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类psr.sys.Sys
的用法示例。
在下文中一共展示了Sys.sysCall方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getBackupAddMap
# 需要导入模块: from psr.sys import Sys [as 别名]
# 或者: from psr.sys.Sys import sysCall [as 别名]
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
示例2: save
# 需要导入模块: from psr.sys import Sys [as 别名]
# 或者: from psr.sys.Sys import sysCall [as 别名]
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
示例3: encrypt
# 需要导入模块: from psr.sys import Sys [as 别名]
# 或者: from psr.sys.Sys import sysCall [as 别名]
def encrypt(self, fromPath=None):
""""""
if fromPath is None :
fromPath = self.pathPlain
Sys.pwlog([(' Encrypt Index... ' , Const.CLZ_0, True)])
Io.set_data(fromPath, jdumps(self.dic))
call = ' '.join([Sys.executable, 'kirmah-cli.py', 'enc', '-qfj2' if Sys.isUnix() else '-qf', fromPath, '-z', '-r', '-m', '-o', fromPath+Kirmah.EXT, '-k', self.keyPath ])
#~ print(call)
Sys.sysCall(call)
Io.removeFile(fromPath)
Sys.pwlog([(' done', Const.CLZ_2, True)])
return Io.get_data(fromPath+Kirmah.EXT, True)
示例4: read
# 需要导入模块: from psr.sys import Sys [as 别名]
# 或者: from psr.sys.Sys import sysCall [as 别名]
def read(self):
""""""
try:
call = ' '.join([Sys.executable, 'kirmah-cli.py', 'dec', '-qf', self.path+'.kmh', '-z', '-r', '-m', '-o', self.path, '-k', self.keyPath ])
Sys.sysCall(call)
with Io.rfile(self.path, False) as fi:
csection = 'main'
self.dic[csection] = {}
for l in fi:
l = l.rstrip().lstrip()
if len(l) > 0 and not l[0]=='#' :
d = regsplit(' *= *', l , 1)
if len(d)> 1:
self.dic[csection][d[0]] = d[1] if d[1] is not None else ''
elif len(l)>0 and l[0]=='[':
csection = l.strip('[]')
self.dic[csection] = {}
Io.removeFile(self.path)
except IOError :
pass
示例5: decrypt
# 需要导入模块: from psr.sys import Sys [as 别名]
# 或者: from psr.sys.Sys import sysCall [as 别名]
def decrypt(self, fromPath=None):
""""""
done = False
try :
if fromPath is None :
fromPath = self.path
toPath = fromPath[:-len(Kirmah.EXT)] if fromPath.endswith(Kirmah.EXT) else fromPath+'.dump'
if Io.file_exists(fromPath) :
Sys.pwlog([(' Decrypt Index... ' , Const.CLZ_0, True)])
call = ' '.join([Sys.executable, 'kirmah-cli.py', 'dec', '-qfj2' if Sys.isUnix() else '-qf', fromPath, '-z', '-r', '-m', '-o', toPath, '-k', self.keyPath ])
print(call)
Sys.sysCall(call)
data = jloads(Io.get_data(toPath))
Io.removeFile(toPath)
else :
data = {}
done = True
except ValueError as e:
raise BadKeyException(e)
Sys.pwlog([(' done'if done else ' ko' , Const.CLZ_2 if done else Const.CLZ_1, True)])
return data
示例6: backupAddMap
# 需要导入模块: from psr.sys import Sys [as 别名]
# 或者: from psr.sys.Sys import sysCall [as 别名]
def backupAddMap(self, data):
""""""
Io.set_data(self.addmapPath, jdumps(data))
call = " ".join(
[
Sys.executable,
"kirmah-cli.py",
"enc",
"-qf",
self.addmapPath,
"-z",
"-r",
"-m",
"-o",
self.addmapPath + Kirmah.EXT,
"-k",
self.idxu.index.keyPath,
]
)
print(call)
Sys.sysCall(call)
Io.removeFile(self.addmapPath)