Multiton
A Multiton metaclass for preventing duplicate instances based on init values.
Free software: MIT license
Documentation: https://multiton.readthedocs.io.
Features
Instanciate a class again and get the first instance with the same value back.
Define which values count
Supply callables to get the needed values from the argument.
Quickstart
from multiton import MultitonMetaFactory
class TestMultiton(metaclass=MultitonMetaFactory(0, (1, lambda x: x[1]), kw_b=None) ):
def __init__(self, a, b, kw_a=None, kw_b=None) -> None:
self.a = a
self.b = b
self.kw_a = kw_a
self.kw_b = kw_b
instance_a = TestMultiton(42, [1, 15, 42], kw_a="this is the first instance", kw_b=15)
instance_b = TestMultiton(42, [5, 15, 801], kw_a="this is the second instance", kw_b=15)
assert instance_a is instance_b
print(instance_b.kw_a)
Credits
This package was created with Cookiecutter and the udreyr/cookiecutter-pypackage project template.
History
0.2.3 (2020-08-13)
Dropped Python 3.5 Support
0.2.2 (2020-08-13)
Fixed README.rst
0.2.1 (2020-08-13)
Refactored multition to use multiple arguments and keyword arguments
0.1.1 (2020-08-13)
Fixed README.md
0.1.0 (2020-08-13)
First release on PyPI.
Metadata
Release files for multiton 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 |
|---|---|---|---|---|
| multiton-0.2.3.tar.gz | 13.0 kB | Without provenance | Details for multiton-0.2.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| multiton-0.2.3-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for multiton-0.2.3-py2.py3-none-any.whl |
Total release size: 18.8 kB
Release files / multiton-0.2.3.tar.gz
| Download URL | multiton-0.2.3.tar.gz |
|---|---|
| Size | 13.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1d333d1187ad9dae71a2b571ed1472c734989d4e7d6b32de10126b585e49bff7
|
|
BLAKE2b-256 checksum How to use checksums |
3976dd6dc8d6e9f4d34c2e0bc7181347201c675c741bf8d7e0f53745e91aa1dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.14.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.9
|
Release files / multiton-0.2.3-py2.py3-none-any.whl
| Download URL | multiton-0.2.3-py2.py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
c178eae4a6898da580c3ad6daec13e9d7cd7028141e243e18554e44b80a44423
|
|
BLAKE2b-256 checksum How to use checksums |
8c480f920891065fa2c3611f20a0433b456ac90f9bf4373f716582ebf0716013
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.14.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.9
|
Security for multiton 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.