Skip to main content

Object-specific undoing and redoing functionality through wrapper class

Project description

unredoable

Python package providing object-specific undoing & redoing functionality through wrapper class

Build codecov Python 3.6 PyPI MIT License

Download

pip install unredoable

Usage

from unredoable import Unredoable

class StateManager:
    def __init__(self, state_variable):
        self.unredoable_state_variable = Unredoable(state_variable, max_stack_depths=10, craft_deep_copies=False)
        
        # state_variable may be of whatever type, whether custom or not, 
        # the sole restraint it's subject to, is that is needs to implement 
        # either __copy__ or __deepcopy__, depending on the passed 
        # 'craft_deep_copies' parameter
        
    def alter_state_variable(self):
        self.unredoable_state_variable.push_state()
        
        self.unredoable_state_variable.obj += 1

if __name__ == '__main__':
    manager = StateManager(69)
    
    manager.alter_state_variable()
    manager.alter_state_variable()
    
    manager.unredoable_state_variable.undo()  # unredoable_state_variable = 70
    manager.unredoable_state_variable.redo()  # unredoable_state_variable = 71

Author

Janek Zangenberg

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

unredoable-0.0.5.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

unredoable-0.0.5-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file unredoable-0.0.5.tar.gz.

File metadata

  • Download URL: unredoable-0.0.5.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.14 CPython/3.8.13 Linux/5.15.0-46-generic

File hashes

Hashes for unredoable-0.0.5.tar.gz
Algorithm Hash digest
SHA256 6a950d6e77f1db18075b089c27e231a83eb0c4907ecbe9e304709a0d4bb3e9b1
MD5 f65789abfe4633d1d452a87199a6b443
BLAKE2b-256 2644a7e6271c503b66f089dcf5a79fb2bd15816a26e756dca07646366247ba1f

See more details on using hashes here.

File details

Details for the file unredoable-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: unredoable-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.14 CPython/3.8.13 Linux/5.15.0-46-generic

File hashes

Hashes for unredoable-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 df242d3e0b72eacb830e74fff42ca36536ceb7c8b5a171ad8e653d689e968ad9
MD5 c09fd282311e95b41225bb3d296f8391
BLAKE2b-256 788e3fef64590465f9182b25669048654fbb518b6a7e584bc6a080e8e875d5d7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page