Skip to main content

The `Status` class represents the status of some event.

Project description

statuses

The Status class represents the status of some event. It is one of either:

  • Failed
  • NotStarted
  • InProgress(progress)
  • Succeeded

Installation

$ pip install statuses

Example

from typing import Iterable

from status import InProgress, Failed, NotStarted, Succeeded

class Report:
    def __init__(self: "Report"):
        self.status = NotStarted()

    def run(self: "Report", foo: str, bar: Iterable[int]):
        if foo == "badstring":
            self.status = Failed()

        for i, b in enumerate(bar):
            self.status = InProgress(i / len(bar) * 100)
            print(self.status)

        self.status = Succeeded()

r = Report()
print(r.status)
r.run("goodstring", range(10))
print(r.status)

Documentation

Ugly looking documentation can be located at docs/index.html.

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

statuses-0.4.0.tar.gz (7.2 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