当前位置: 首页>>代码示例>>Python>>正文


Python Sys.pstep方法代码示例

本文整理汇总了Python中psr.sys.Sys.pstep方法的典型用法代码示例。如果您正苦于以下问题:Python Sys.pstep方法的具体用法?Python Sys.pstep怎么用?Python Sys.pstep使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在psr.sys.Sys的用法示例。


在下文中一共展示了Sys.pstep方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: onend_cmd

# 需要导入模块: from psr.sys import Sys [as 别名]
# 或者: from psr.sys.Sys import pstep [as 别名]
 def onend_cmd(self, title, stime, done, outputfile):
     """"""
     s = Const.LINE_SEP_CHAR*Const.LINE_SEP_LEN
     Sys.echo(s, Sys.CLZ_HEAD_LINE)
     Sys.wlog([(s, Const.CLZ_HEAD_SEP)])
     Sys.pstep(title, stime, done, True)
     Sys.echo(s, Sys.CLZ_HEAD_LINE)
     Sys.wlog([(s, Const.CLZ_HEAD_SEP)])
     if done and outputfile is not None:
         Sys.cli_emit_progress(100)
         Sys.echo(' '*5+Sys.realpath(outputfile), Sys.Clz.fgB1, False)
         Sys.echo(' ('+Sys.getFileSize(outputfile)+')', Sys.Clz.fgB3)
         bdata = [(' '*5+Sys.realpath(outputfile), 'io'),(' ('+Sys.getFileSize(outputfile)+')','func')]
         Sys.wlog(bdata)
         Sys.wlog(Sys.dprint())
开发者ID:pluie-org,项目名称:imprastorage,代码行数:17,代码来源:cliapp.py

示例2: onCommandKey

# 需要导入模块: from psr.sys import Sys [as 别名]
# 或者: from psr.sys.Sys import pstep [as 别名]
    def onCommandKey(self):
        """"""
        if int(self.o.length) >= 128 and int(self.o.length) <= 4096 :
            self.parser.print_header()
            if not self.o.outputfile : self.o.outputfile = self.home+'.kirmah'+Sys.sep+'.default.key'
            kg   = KeyGen(int(self.o.length))
            done = True
            if Io.file_exists(self.o.outputfile) and not self.o.force :

                Sys.pwarn((('the key file ',(self.o.outputfile, Sys.Clz.fgb3), ' already exists !'),
                           'if you rewrite this file, all previous files encrypted with the corresponding key will be unrecoverable !'))

                done   = Sys.pask('Are you sure to rewrite this file')
                self.stime  = Sys.datetime.now()
            if done :
                Io.set_data(self.o.outputfile, kg.key)
            Sys.pstep('Generate key file', self.stime, done)

            if done :
                Sys.print(' '*5+Sys.realpath(self.o.outputfile), Sys.Clz.fgB1, True)

        else :
            self.parser.error_cmd((('invalid option ',('-l, --length', Sys.Clz.fgb3), ' value (', ('128',Sys.Clz.fgb3),' to ', ('4096',Sys.Clz.fgb3),')'),))
开发者ID:necrose99,项目名称:Kirmah,代码行数:25,代码来源:cliapp.py

示例3: onCommandSplit

# 需要导入模块: from psr.sys import Sys [as 别名]
# 或者: from psr.sys.Sys import pstep [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)
开发者ID:pluie-org,项目名称:imprastorage,代码行数:73,代码来源:cliapp.py


注:本文中的psr.sys.Sys.pstep方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。