當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。