本文整理汇总了Python中psr.sys.Io.is_binary方法的典型用法代码示例。如果您正苦于以下问题:Python Io.is_binary方法的具体用法?Python Io.is_binary怎么用?Python Io.is_binary使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类psr.sys.Io
的用法示例。
在下文中一共展示了Io.is_binary方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onCommandEnc
# 需要导入模块: from psr.sys import Io [as 别名]
# 或者: from psr.sys.Io import is_binary [as 别名]
def onCommandEnc(self):
""""""
done = True
if self.o.outputfile is None :
self.o.outputfile = Sys.basename(self.a[1])
if self.o.outputfile[-len(Kirmah.EXT):] != Kirmah.EXT :
print(self.o.outputfile[-len(Kirmah.EXT):])
self.o.outputfile += Kirmah.EXT
print(self.o.outputfile)
d = self.getDefaultOption((self.o.compress,self.o.fullcompress,self.o.nocompress))
compress = (KirmahHeader.COMP_END if d == 0 or (d is None and Io.is_binary(self.a[1])) else (KirmahHeader.COMP_ALL if d==1 or d is None else KirmahHeader.COMP_NONE))
random = True if (self.o.random is None and self.o.norandom is None) or self.o.random else False
mix = True if (self.o.mix is None and self.o.nomix is None) or self.o.mix else False
if (self.o.multiprocess is not None and not represents_int(self.o.multiprocess)) or (not self.o.multiprocess is None and not(int(self.o.multiprocess)>=2 and int(self.o.multiprocess) <=8)) :
self.parser.error_cmd((('invalid option ',('-j, --multiprocess', Sys.Clz.fgb3), ' value (', ('2',Sys.Clz.fgb3),' to ', ('8',Sys.Clz.fgb3),')'),))
nproc = int(self.o.multiprocess) if not self.o.multiprocess is None and int(self.o.multiprocess)>=2 and int(self.o.multiprocess) <=8 else 1
if not Sys.g.QUIET : self.parser.print_header()
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()
key = Io.get_data(self.o.keyfile)
km = Kirmah(key, None, compress, random, mix)
km.encrypt(self.a[1], self.o.outputfile, nproc)
except Exception as e :
done = False
print(e)
raise e
pass
if not Sys.g.QUIET :
self.onend_cmd('Kirmah Encrypt', self.stime, done, self.o.outputfile)