This library is a thin python wrapper around ART implementation in https://raw.github.com/armon/hlld
Installing
pystat can be installed via pypi:
pip install pyart
Building
Get the source:
git clone https://github.com/blackwithwhite666/pyart.git
Compile extension:
python setup.py build_ext --inplace
Usage
Work with tree as with plain mapping:
from pyart import Tree t = Tree() t[b'foo'] = 1 t[b'bar'] = 2 assert t[b'foo'] == 1 assert t[b'bar'] == 2 assert b'foo' in t assert b'bar' in t assert len(t) == 2 del t[b'foo'] assert b'foo' not in t assert len(t) == 1
Iteration over each element of tree:
from pyart import Tree
t = Tree()
t['foo'] = object()
def cb(key, value): print(key, value)
t.each(cb)
>>> ('foo', <object object at 0x7f186020bd70>)
t['foobar'] = object()
t.each(cb)
>>> ('foo', <object object at 0x7f186020bd70>)
>>> ('foobar', <object object at 0x7f186020bd80>)
t.each(cb, prefix=b'foo')
>>> ('foo', <object object at 0x7f186020bd70>)
>>> ('foobar', <object object at 0x7f186020bd80>)
t.each(cb, prefix=b'bar')
Find minimum and maximum:
from pyart import Tree t = Tree() t[b'test'] = None t[b'foo'] = None t[b'bar'] = None assert t.minimum == (b'bar', None) assert t.maximum == (b'test', None)
Copy tree:
from pyart import Tree t = Tree() t[b'test'] = object() c = t.copy() assert c[b'test'] is t[b'test'] assert len(c) == len(t)
TODO
Implement plain python iterator over tree;
Running the test suite
Use Tox to run the test suite:
tox
Changelog
0.2.3
Fix reference counting;
0.2.2
Fix iteration with single element;
0.2.1
Fix segmentation fault on iterator destruction;
0.2.0
Proper exception handling in each;
Support for python native iteration;
0.1.0 (initial release)
Prototype.
Metadata
Release files for pyart 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyart-0.2.3.tar.gz | 47.6 kB | Without provenance | Details for pyart-0.2.3.tar.gz |
Release files / pyart-0.2.3.tar.gz
| Download URL | pyart-0.2.3.tar.gz |
|---|---|
| Size | 47.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b6c3caa0d18bda3dc2fc1e3ca7ac5db8da9c89d66188b0d0b911ddec3e38cc95
|
|
BLAKE2b-256 checksum How to use checksums |
bd88813ba6b870578e337b33b8954a4ec2ed87900934007ec2a7d2338935b316
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for pyart 0.2.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.