Brackette
A simple state manager implementing the memento design pattern and heavily based on the tutorial from refactoring.guru.
The brackette (a bracket-cassette) logo was scribbled by @PostSin on slatepacks.com marketplace for which I paid 2ツ (ツ is grin cryptocurrency) and it was best deal ever!
from brackette.memento import Originator, Caretaker
originator = Originator()
caretaker = Caretaker(originator)
originator.do_stuff('hello')
print(originator._state)
print(originator._hash)
caretaker.backup()
originator.do_stuff('meoreo')
print(originator._state)
print(originator._hash)
caretaker.backup()
originator.do_stuff('kinda')
print(originator._state)
print(originator._hash)
caretaker.backup()
caretaker.undo()
print(originator._state)
print(originator._hash)
caretaker.undo()
print(originator._state)
print(originator._hash)
caretaker.redo()
print(originator._state)
print(originator._hash)
caretaker.undo()
print(originator._state)
print(originator._hash)
caretaker.show_history()
outputs
hello
2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
meoreo
bbba0753c25637757dd58e943bf8089f66aa5a408cc1764458230e3112ab41e1
kinda
29f0e99be96b1bf5bfb5902b10171f4b7d8135fe205fc8c94b81754c0d661513
meoreo
bbba0753c25637757dd58e943bf8089f66aa5a408cc1764458230e3112ab41e1
hello
2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
meoreo
bbba0753c25637757dd58e943bf8089f66aa5a408cc1764458230e3112ab41e1
hello
2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
Caretaker: Here's the list of past mementos:
2021-04-27 14:25:43 UTC 6411ee087bfe7ce14043d451748b5199ef7ccaa42aa6e0f8ab2c63de94281c7d
Caretaker: Here's the list of future mementos:
2021-04-27 14:25:43 UTC 2783de246149f2cfec85bf718a938ddcb0c1bdad249afc56f53882c6de3f8475
2021-04-27 14:25:43 UTC 0a14b4c21ac263fe47312f688975fc1022feb531db396dca9eb9ed0571f862ee
Metadata
Release files for brackette 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 |
|---|---|---|---|---|
| brackette-0.2.1.tar.gz | 4.0 kB | Without provenance | Details for brackette-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| brackette-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for brackette-0.2.1-py3-none-any.whl |
Total release size: 8.7 kB
Release files / brackette-0.2.1.tar.gz
| Download URL | brackette-0.2.1.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5f15423d948ae659c33a481f14fab5b6adb0005ed751dec52af618dcb7d6d2ed
|
|
BLAKE2b-256 checksum How to use checksums |
a147f360c52524fab64bf1d789d67d012b03a17921d6384b8dbf50be5c23c13e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.7.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.7.4
|
Release files / brackette-0.2.1-py3-none-any.whl
| Download URL | brackette-0.2.1-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bd18e56487018b5f8bbd9bd614171e4d05b6ab50913cd23f800d7d8d27ad9ce3
|
|
BLAKE2b-256 checksum How to use checksums |
ff822ff259de9f0a22ba06ba84e8a06d8390c1fa3e525ef9f5cfa63ad864dce9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.7.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.7.4
|
Security for brackette 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.