Skip to main content

A task flow in Python with do and undo

Project description

pyundo

A task flow in Python with do and undo.

Example

from __future__ import print_function
from pyundo import TaskBase, LineFlow


class Task(TaskBase):
    def __init__(name):
        self.name = name

    def do(self):
        print("Do the task: {0}".format(self.name))

    def undo(self):
        print("Undo the task: {0}".format(self.name))


def main():
    flow = LineFlow()
    flow.add(Task("task1"))
    flow.add(Task("task2"))
    flow.add(Task("task3"))
    flow.execute()


if __name__ == "__main__":
    main()

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

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

Source Distribution

pyundo-0.1.tar.gz (6.7 kB view hashes)

Uploaded Source

Supported by

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