File: switch

package info (click to toggle)
python-echo 0.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 368 kB
  • sloc: python: 2,421; makefile: 148
file content (18 lines) | stat: -rwxr-xr-x 293 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/python3
import sys

from echo import CallbackProperty, add_callback

class Switch(object):
    state = CallbackProperty('off')

def report_change(state):
    if state != 'test':
        sys.exit(1)

s = Switch()
add_callback(s, 'state', report_change)

s.state = 'test'

sys.exit()