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


Python msgpack.unpack方法代码示例

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


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

示例1: load

# 需要导入模块: import msgpack [as 别名]
# 或者: from msgpack import unpack [as 别名]
def load(f, **kwargs):
    """ An overload of msgpack.load that works with pyGSTi types """
    decoded_msgpack = _msgpack.unpack(f, **kwargs)  # load normal MSGPACK
    return decode_obj(decoded_msgpack, msgpack_uses_binary_strs)  # makes pygsti objects 
开发者ID:pyGSTio,项目名称:pyGSTi,代码行数:6,代码来源:msgpack.py

示例2: load_stored_trajs

# 需要导入模块: import msgpack [as 别名]
# 或者: from msgpack import unpack [as 别名]
def load_stored_trajs(load_from):
    """Return trajectories storead at load_from/trajs.data."""
    file_path = os.path.join(load_from, 'trajs.data')
    with open(file_path, 'rb') as file:
        trajs = msgpack.unpack(file)
    # convert byte keys back to string keys:
    trajs = [{
        key.decode('utf-8') if isinstance(key, bytes) else key: traj[key]
        for key in traj.keys()
    } for traj in trajs]
    return trajs 
开发者ID:JohannesHeidecke,项目名称:irl-benchmark,代码行数:13,代码来源:__init__.py

示例3: load

# 需要导入模块: import msgpack [as 别名]
# 或者: from msgpack import unpack [as 别名]
def load(fp, object_hook=None):
    return msgpack.unpack(fp, object_hook=object_hook, encoding='utf8') 
开发者ID:namuyan,项目名称:p2p-python,代码行数:4,代码来源:serializer.py

示例4: __init__

# 需要导入模块: import msgpack [as 别名]
# 或者: from msgpack import unpack [as 别名]
def __init__(self, count=0, term=None, data={}):
        self.count = count
        self.term = term
        self.data = data
        self.path = os.path.join(config.storage, 'compact')
        #  load
        logger.debug('Initializing compactor')
        if count or term or data:
            self.persist()
            logger.debug('Using parameters')
        elif os.path.isfile(self.path):
            with open(self.path, 'rb') as f:
                self.__dict__.update(msgpack.unpack(f, encoding='utf-8'))
            logger.debug('Using persisted data') 
开发者ID:simonacca,项目名称:zatt,代码行数:16,代码来源:log.py

示例5: _load_msgpack

# 需要导入模块: import msgpack [as 别名]
# 或者: from msgpack import unpack [as 别名]
def _load_msgpack(self, path, encoding):
        with open(path, "rb") as in_file:
            return msgpack.unpack(in_file, encoding=encoding) 
开发者ID:naver,项目名称:claf,代码行数:5,代码来源:data_handler.py

示例6: parse

# 需要导入模块: import msgpack [as 别名]
# 或者: from msgpack import unpack [as 别名]
def parse(self, stream, media_type=None, parser_context=None):
        if not msgpack:
            raise _import_error
        return msgpack.unpack(stream, use_list=False, encoding='utf-8') 
开发者ID:thelabnyc,项目名称:django-logpipe,代码行数:6,代码来源:msgpack.py


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