py2store¶
py2store: tools to create simple and consistent interfaces to complicated and varied data sources.
The core has moved to the dol package (Data Object Layer); py2store keeps the original
names, re-exports them, and keeps the local-file stores that still live here. A store is a
MutableMapping whose keys and values are transformed on the way in and out, so that files,
zip archives or databases are read and written like a dict.
Main entry points:
LocalTextStore,LocalBinaryStore,LocalPickleStore,LocalJsonStore: the files under a root directory as a dictQuickStore: the pickle store with a temporary default root and directories created on writewrap_kvs,filt_iter,cached_keys: transform a store’s keys, values or iteration (fromdol.trans)kvhead,ihead: peek at the first items of a store or an iterable
>>> from py2store import kvhead
>>> kvhead({'a': 1, 'b': 2})
('a', 1)
Functions
|
Get the first item of an iterable, or a list of the first |
|
Get the first |
- py2store.ihead(store, n=1)[source]¶
Get the first item of an iterable, or a list of the first
nitems.With
n=1the item itself is returned (Noneif the iterable is empty); otherwise a list of at mostnitems.>>> ihead(iter('abc')) 'a' >>> ihead('abc', 2) ['a', 'b'] >>> ihead(iter('')) is None True
- py2store.kvhead(store, n=1)[source]¶
Get the first
(key, value)item of a store, or a list of the firstnitems.With
n=1the item itself is returned (Noneif the store is empty); otherwise a list of at mostnitems, in the store’s iteration order.>>> kvhead({'a': 1, 'b': 2}) ('a', 1) >>> kvhead({'a': 1, 'b': 2}, 5) [('a', 1), ('b', 2)] >>> kvhead({}) is None True
Modules
Utils to load stores from store specifications. |
|
|
Makes a new class with append (and consequential extend) methods |
Forwards to dol.base: |
|
Forwards to dol.caching: |
|
Forwards to dol.dig: |
|
Forwards to dol.errors: |
|
py2store Extensions, Add-ons, etc. |
|
Forwards to dol.filesys: |
|
key mapping |
|
Functions to read from and write to misc sources. |
|
Forwards to dol.mixins: |
|
functionalities meant to be configurable |
|
Forwards to dol.naming: |
|
Modified from https://github.com/r1chardj0n3s/parse |
|
Forwards to dol.paths: |
|
base persisters -- now all forwarding to separate libraries |
|
a package of serializers |
|
Forwards to dol.signatures: |
|
Data Object Layers for a few standard libs. |
|
Forwards to dol.sources: |
|
a package of various stores |
|
test files |
|
Forwards to dol.trans: |
|
Forwards to dol.util: |
|
general utils |