Small dill wrapper with Metadata
Project description
dillO
A small dill wrapper with Metadata and Verification Hash
Installation
From Source
$ python3 setup.py install
From pip
$ pip3 install dill-O
In-memory Storage
from dillo import Dillo
file = Dillo('My dillO')
# some object instances as obj
file.store(obj)
# Read back from Memory
obj = file.read()
On File Storage
from dillo import Dillo
file = Dillo('My dillO')
# some object instances as obj
file.store(obj) # store the object `before` you write
file.write_file('./filename.dillO') # write dillO files
Read back from Files
from dillo import Dillo
file = Dillo.read_file('./filename.dillO') # Read to memory
obj = file.read() # Read object
JSON
JSON Files
from dillo import Dillo
file = Dillo('My dillO', type='json')
# some object instances as obj
file.store(obj) # store the object `before` you write
file.write_file('./filename.json') # write JSON files
JSON Strings
from dillo import Dillo
file = Dillo('My dillO', type='json')
# some object instances as obj
file.store(obj) # store the object `before` you write
file.json_string() # get JSON string
JSON Objects
from dillo import Dillo
file = Dillo('My dillO', type='json')
# some object instances as obj
file.store(obj) # store the object `before` you write
file.json() # get JSON Object
Interpreter Sessions
On Memory
>>> a = 10
>>> b = a + 20
>>> # Save a Session
>>> from dillo import Dillo_Session
>>> session = Dillo_Session.store_session('This Session')
>>> # Load a On Memory Session
>>> session.load_session()
On File
>>> a = 10
>>> b = a + 20
>>> # Save a Session
>>> from dillo import Dillo_Session
>>> session = Dillo_Session.store_session('This Session')
>>> # Load on a File
>>> session.write_file('./filename.sdillo')
Read Back
>>> from dillo import Dillo_Session
>>> session = Dillo_Session.read_file('./filename.sdillo')
>>> session.load_session()
>>> a
10
>>> b
30
Sample Files
dillO
-----METADATA-----
Name : Array JSON
dillO : pickle
Sign : SHA256
Tags :
Length : 271 Bytes
-----DILLO-----
gASVBAEAAAAAAACMCmRpbGwuX2RpbGyUjA1fY3JlYXRlX2FycmF5lJOUKGgAjAlfZ2V0X2F0dHKUk5R
oAIwOX2ltcG9ydF9tb2R1bGWUk5SMHG51bXB5LmNvcmUuX211bHRpYXJyYXlfdW1hdGiUhZRSlIwMX3
JlY29uc3RydWN0lIaUUpSMBW51bXB5lIwHbmRhcnJheZSTlEsAhZRDAWKUh5QoSwFLBYWUaA2MBWR0e
XBllJOUjAJpOJSJiIeUUpQoSwOMATyUTk5OSv____9K_____0sAdJRiiUMoAQAAAAAAAAACAAAAAAAA
AAMAAAAAAAAABAAAAAAAAAAFAAAAAAAAAJR0lE50lFKULg==
-----SIGN-----
1ac33161cd72c5ce8ec286ea322a02372e1d759a6724f64d33417ac8274d2808
JSON
{"py/object": "dillo.dillo.Dillo", "name": "Array JSON", "type": "json", "sign": "SHA256", "protocol": null, "byref": false, "fmode": 2, "recurse": false, "_stream": {"py/b64": "gASVBAEAAAAAAACMCmRpbGwuX2RpbGyUjA1fY3JlYXRlX2FycmF5lJOUKGgAjAlfZ2V0X2F0dHKUk5RoAIwOX2ltcG9ydF9tb2R1bGWUk5SMHG51bXB5LmNvcmUuX211bHRpYXJyYXlfdW1hdGiUhZRSlIwMX3JlY29uc3RydWN0lIaUUpSMBW51bXB5lIwHbmRhcnJheZSTlEsAhZRDAWKUh5QoSwFLBYWUaA2MBWR0eXBllJOUjAJpOJSJiIeUUpQoSwOMATyUTk5OSv////9K/////0sAdJRiiUMoAQAAAAAAAAACAAAAAAAAAAMAAAAAAAAABAAAAAAAAAAFAAAAAAAAAJR0lE50lFKULg=="}, "ignore": false, "tags": {"py/set": []}, "hash": {"py/b64": "MWFjMzMxNjFjZDcyYzVjZThlYzI4NmVhMzIyYTAyMzcyZTFkNzU5YTY3MjRmNjRkMzM0MTdhYzgyNzRkMjgwOA=="}}
License MIT
Copyright (c) 2021 Anubhav Mattoo
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file dill_O-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: dill_O-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07c1a291f27da2750328e7f1893f2134f8b2567d48122ba435d7790d1abc12ba |
|
MD5 | 584c9941847243413d618ea3ec4c05ec |
|
BLAKE2b-256 | 715dca67c04fe4b24e04290bd80497f95be48f9fc66c585cc661286f4fa4636d |