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


Python Unpickler.pop方法代码示例

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


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

示例1: __init__

# 需要导入模块: from pickle import Unpickler [as 别名]
# 或者: from pickle.Unpickler import pop [as 别名]

#.........这里部分代码省略.........
                        (isinstance(elm[keys[i]], SugarSyncDirectory) and typ == SugarSyncShell.TYPE_FOLDER)
                        or   (isinstance(elm[keys[i]], SugarSyncFile) and typ == SugarSyncShell.TYPE_FILE)
                        or   typ == SugarSyncShell.TYPE_ALL
                        ):
                    data = elm[keys[i]]

                i = i+1

        return data

    def clear(self, param):
        (width, height) = Console.getTerminalSize()
        for f in range(0,height):
            print('');

    def help(self, param):
        # this is a method to display the help
        print('Following commands are possible:')
        for cmd in self.cmds:
            print(cmd)

    def cd(self, param):
        # TODO: at this point its very pre-release...
        # we have to trim the param
        param = param.strip()
        if param[len(param)-1:] == '/':
            param = param[:-1]

        # and split on / ?

        if param == '.':
            return True
        elif param == '..':
            self.path.pop()
        else:
            # search
            path = self.searchRecursivePath(None, param, SugarSyncShell.TYPE_FOLDER)
            if path is not None:
                self.path = path
                return True
            else:
                print('Could not change the directory.')
                return False
    

    def ls(self, param):
        # get actual element:
        elm = self.path[len(self.path)-1]

        print(Colors.c('./', Colors.BLUE))
        if len(self.path) > 1:
            print(Colors.c('../', Colors.BLUE))

        for k,v in elm.getChildren().items():
            if isinstance(v, SugarSyncDirectory):
                print(Colors.c(str(k) + '/', Colors.BLUE))
            else:
                print(k)

    def pwd(self, param):
        print(self.getPath(False, False)) # withour header and without color

    def history(self, param):
        param = param.strip()
        
        if param in ['.', './', '..', '../'] or param[len(param)-1:] == '/':
开发者ID:HonestQiao,项目名称:SugarSync-Python-Client,代码行数:70,代码来源:SugarSyncShell.py


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