Usage
Eche provides a ClusterHelper class to conveniently handle entity clusters.
from eche import ClusterHelper
ch = ClusterHelper([{"a1", "b1"}, {"a2", "b2"}])
print(ch.clusters)
{0: {'a1', 'b1'}, 1: {'a2', 'b2'}}
Add an element to a cluster
ch.add_to_cluster(0, "c1")
print(ch.clusters)
{0: {'a1', 'b1', 'c1'}, 1: {'a2', 'b2'}}
Add a new cluster
ch.add({"e2", "f1", "c3"})
print(ch.clusters)
{0: {'a1', 'b1', 'c1'}, 1: {'a2', 'b2'}, 2: {'f1', 'e2', 'c3'}}
Remove an element from a cluster
ch.remove("b1")
print(ch.clusters)
{0: {'a1', 'c1'}, 1: {'a2', 'b2'}, 2: {'f1', 'e2', 'c3'}}
The __contains__ function is smartly overloaded. You can check if an entity is in the ClusterHelper:
"a1" in ch
# True
If a cluster is present
{"c1","a1"} in ch
# True
And even if a link exists or not
("f1","e2") in ch
# True
("a1","e2") in ch
# False
To know the cluster id of an entity you can look it up with
print(ch.elements["a1"])
0
To get members of a cluster either use
print(ch.members(0))
{'a1', 'b1', 'c1'}
or simply
print(ch[0])
{'a1', 'b1', 'c1'}
More functions can be found in the Documentation.
Installation
Simply use pip for installation:
pip install eche
Metadata
Release files for eche 0.2.1
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 |
|---|---|---|---|---|
| eche-0.2.1.tar.gz | 11.6 kB | Without provenance | Details for eche-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| eche-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for eche-0.2.1-py3-none-any.whl |
Total release size: 21.9 kB
Release files / eche-0.2.1.tar.gz
| Download URL | eche-0.2.1.tar.gz |
|---|---|
| Size | 11.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
27f0d6fc2bfe3f27361bd1205b2b88d92b30acf99032eef00449a8ab0de348b0
|
|
BLAKE2b-256 checksum How to use checksums |
02f3dacb63e2d2054a22dbd403912eafb8c49f98dabf8be3e3c0b8ca694f5c3c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.1 CPython/3.10.6 Linux/5.19.0-38-generic
|
Release files / eche-0.2.1-py3-none-any.whl
| Download URL | eche-0.2.1-py3-none-any.whl |
|---|---|
| Size | 10.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
277c1fe5dbe40ac92d5eca00917bcb278ccb987f7bf044df885da41779330ad7
|
|
BLAKE2b-256 checksum How to use checksums |
e4a49f497a6cec96f97e5dffcc0929c9d8dadc50539298f923a2b64dfe5fec2e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.1 CPython/3.10.6 Linux/5.19.0-38-generic
|
Security for eche 0.2.1
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.