A small pure-python package for data structure relatedutility functions.
Project description
A small pure-python package for data structure related utility functions.
from strct.dict import get_nested_val
>>> dict_obj = {'a': {'b': 7}}
>>> get_nested_val(('a', 'b'), dict_obj)
7
1 Installation
Install strct with:
pip install strct
2 Use
strct is divided into five sub-modules:
2.1 dicts
Getting values from nested dicts in various ways; operations on number-valued dicts; merging, normalizing, reversing and printing dicts (nicely)
2.2 lists
Index and element shifts that preserve order.
2.3 sets
Operations on sets:
Getting a set element by a priority list.
2.4 sortedlists
Operations on sortedcontainers.SortedList objects.
2.5 hash
Provide cross-kernel stable hash functions that work for built-in data structures and types, and for any custom data structure complying with the iterable or dict schemes.
3 Contributing
Package author and current maintainer is Shay Palachy (shay.palachy@gmail.com); You are more than welcome to approach him for help. Contributions are very welcomed.
3.1 Installing for development
Clone:
git clone git@github.com:shaypal5/strct.git
Install in development mode with test dependencies:
cd strct
pip install -e ".[test]"
3.2 Running the tests
To run the tests, use:
python -m pytest --cov=strct --doctest-modules
3.3 Adding documentation
This project is documented using the numpy docstring conventions, which were chosen as they are perhaps the most widely-spread conventions that are both supported by common tools such as Sphinx and result in human-readable docstrings (in my personal opinion, of course). When documenting code you add to this project, please follow these conventions.
4 Credits
Created by Shay Palachy (shay.palachy@gmail.com).
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 Distribution
Built Distribution
File details
Details for the file strct-0.0.34.tar.gz
.
File metadata
- Download URL: strct-0.0.34.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c46d38628e442de341601958bc3fb9d7fa2adba4131bdecdf76c20d7079fe885 |
|
MD5 | 86cba9a74c943f9ff150b260f2035ac8 |
|
BLAKE2b-256 | b119a249a8682b1b62afd78fd53d19a1c88f8b4552d5fea74932170b7ea226d7 |
File details
Details for the file strct-0.0.34-py3-none-any.whl
.
File metadata
- Download URL: strct-0.0.34-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 462d04408b77b33388d2f4f71378b5a54ffe9b85e8ac4df4f887cdfba1f563fc |
|
MD5 | 29c367fea838b22019383ccbc508a024 |
|
BLAKE2b-256 | 806cd8dbd24f13b7a1f2117fa23a078e762f0e8b50b164cb789f3fbd4be6d9a4 |