U C^@sTddlmZddlZddlmZddlmZddZdd d Zd d Z dd dZ dS))unicode_literalsN)msgpack) force_pathcCstj|ddS)zSerialize an object to a msgpack byte string. data: The data to serialize. RETURNS (bytes): The serialized bytes. T use_bin_type)rdumps)datar 5/tmp/pip-install-6_kvzl1k/srsly/srsly/_msgpack_api.py msgpack_dumps sr TcCs$ttj|d|d}t|S)zDeserialize msgpack bytes to a Python object. data (bytes): The data to deserialize. use_list (bool): Don't use tuples instead of lists. Can make deserialization slower. RETURNS: The deserialized Python object. Frawuse_list)gcdisablerloadsenable)r rmsgr r r msgpack_loadss rc Cs6t|dd}|d}tj||ddW5QRXdS)z}Create a msgpack file and dump contents. location (unicode / Path): The file path. data: The data to serialize. F)Zrequire_existswbTrN)ropenrdump)locationr file_pathfr r r write_msgpack"s  rc CsNt|}|d2}ttj|d|d}t|W5QRSQRXdS)zLoad a msgpack file. location (unicode / Path): The file path. use_list (bool): Don't use tuples instead of lists. Can make deserialization slower. RETURNS: The loaded and deserialized content. rbFr N)rrrrrloadr)rrrrrr r r read_msgpack-s  r)T)T) __future__rrrutilrr rrrr r r r s