computed-cached-property
A decorator for caching computed properties in classes. like Vue's Computed-Properties
install
pip install computed-cached-property
example
from computed_cached_property import computed_cached_property
from dataclasses import dataclass
@dataclass
class A:
v1: int = 1
v2: str = 'fuck'
v3: bool = False
@property
@computed_cached_property
def v4(self):
print('run code in v4 function')
return f'v1:{self.v1}, v2:{self.v2}, v3:{self.v3}'
@property
@computed_cached_property(typed=Ture)
# same as @functools.lru_cache(maxsize=1, typed=Ture)
def v5(self):
print('run code in v4 function')
return f'v1:{self.v1}, v2:{self.v2}, v3:{self.v3}'
a1 = A(v1=99)
print(a1.v4)
print(a1.v4)
a1.v2 = 'xxoo'
print(a1.v4)
# output
# run code in v4 function
# v1:99, v2:fuck, v3:False
# v1:99, v2:fuck, v3:False
# run code in v4 function
# v1:99, v2:xxoo, v3:False
Hint
Not recommended for use in a production environment
License
MIT
Metadata
Release files for computed-cached-property 0.0.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 |
|---|---|---|---|---|
| computed-cached-property-0.0.3.tar.gz | 2.6 kB | Without provenance | Details for computed-cached-property-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| computed_cached_property-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for computed_cached_property-0.0.3-py3-none-any.whl |
Total release size: 6.4 kB
Release files / computed-cached-property-0.0.3.tar.gz
| Download URL | computed-cached-property-0.0.3.tar.gz |
|---|---|
| Size | 2.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d2fa1d726669bff0f28ecc0c8437d36df43f59d12cd9e2ecd5c7865f1ea6a06d
|
|
BLAKE2b-256 checksum How to use checksums |
bf9f9e2b8ef3705db09b7e54023689995d98f8d85bf0d703f109104d9b095f88
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
|
Release files / computed_cached_property-0.0.3-py3-none-any.whl
| Download URL | computed_cached_property-0.0.3-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3dc84a3cd2eee906f6e750b00e47d57daf3512f4322bd8bad80054b96a1c890f
|
|
BLAKE2b-256 checksum How to use checksums |
6f6ad1104cf406331a4526893a998704936a340d8c65fadbee63b6893acc8897
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
|
Security for computed-cached-property 0.0.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.