Created
March 20, 2010 12:01
-
-
Save maxp/338632 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Use a flag to indicate the state of the bus. | |
| class _StateEnum(object): | |
| class State(object): | |
| name = None | |
| def __repr__(self): | |
| return "states.%s" % self.name | |
| def __setattr__(self, key, value): | |
| if isinstance(value, self.State): | |
| value.name = key | |
| object.__setattr__(self, key, value) | |
| states = _StateEnum() | |
| states.STOPPED = states.State() | |
| states.STARTING = states.State() | |
| states.STARTED = states.State() | |
| states.STOPPING = states.State() | |
| states.EXITING = states.State() | |
| # from cherrypy/process |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment