Skip to main content

好!

Project description

莉沫酱存储!

做实验的时候经常要存一些数据,用手写with open很麻烦,就想着,啊那不如直接搞一个存硬盘的dict吧!

样例

from rimo_storage import 超dict
d = 超dict('./savedata')
d['x'] = 114514
d['y'] = '好!'

然后下次运行程序的时候就还可以读d里面的内容了。

嗯,就是这么简单!

接口

rimo_storage.超dict(path, compress=None, serialize='json')

基本上就相当于普通的Dict[str, Any]

其中compressserialize的类型是Union[str, Tuple[Callable, Callable], None],它的行为是这样——

  • compress可以选择zlib或者lzmaserialize可以选择jsonpickle
  • 如果传Tuple[Callable, Callable],则第一个函数会在写入的时候用,第二个函数会在读取的时候用。
  • 如果是None,则什么都不做。

究竟能存什么东西依赖serialize,如果是json就只能存可json化的东西,如果是pickle就只能存可以pickle的东西(我又在讲废话了)

rimo_storage.cache.disk_cache(*, path=None, compress=None, serialize='json')

一个装饰器,差不多就是标准库的functools.cache的存硬盘版本,参数的意思和上面一样。

安装

只要使用pip安装就行啦!

pip install rimo-storage

结束

就这样,大家88,我继续回去做实验啦!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rimo_storage-1.3.2.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

rimo_storage-1.3.2-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file rimo_storage-1.3.2.tar.gz.

File metadata

  • Download URL: rimo_storage-1.3.2.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.26.0 setuptools/50.3.1 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.0

File hashes

Hashes for rimo_storage-1.3.2.tar.gz
Algorithm Hash digest
SHA256 1713ca4cbebacc4def04583526f1c053d828a87f4d16e0ca996f33443b8803f2
MD5 ddd72ef66b64cc53c8caa387a5f77ada
BLAKE2b-256 fd9a2d2ad7102e7f5e40901280e71fd68bf84e15bedb2da5b1e2dced1dabff20

See more details on using hashes here.

File details

Details for the file rimo_storage-1.3.2-py3-none-any.whl.

File metadata

  • Download URL: rimo_storage-1.3.2-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.26.0 setuptools/50.3.1 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.0

File hashes

Hashes for rimo_storage-1.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f5e5286fb25075a8e461ffe13a29ad33a377412f830ed317481d4865e57e7d07
MD5 48745813dff08a46e7e63189dac3b148
BLAKE2b-256 75e9f72325996ff4e818dd48b9c071176ab1d540f88644754da9ccb9a487b120

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page