projects
/
saartuer.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
c3f869a
)
Inherit superclass constrcutor where applicable; avoid repeating superclass name
author
Ralf Jung
<post@ralfj.de>
Thu, 10 Oct 2013 13:47:10 +0000
(15:47 +0200)
committer
Ralf Jung
<post@ralfj.de>
Thu, 10 Oct 2013 13:47:10 +0000
(15:47 +0200)
statemachine.py
patch
|
blob
|
history
diff --git
a/statemachine.py
b/statemachine.py
index 1fa66b99b17daed756319635a7a3e1bb8bcda3c3..81b6b87ef3f8c5c250e1b771750fa5cf50e0e94c 100644
(file)
--- a/
statemachine.py
+++ b/
statemachine.py
@@
-73,8
+73,6
@@
class StateMachine():
raise Exception("Unknown command number: %d" % ev)
class StateStart(State):
raise Exception("Unknown command number: %d" % ev)
class StateStart(State):
- def __init__(self, sm):
- State.__init__(self,sm)
def handle_pins_event(self):
thepins = self.pins()
for pin in thepins:
def handle_pins_event(self):
thepins = self.pins()
for pin in thepins:
@@
-86,8
+84,6
@@
class StateMachine():
return StateAuf
class StateZu(State):
return StateAuf
class StateZu(State):
- def __init__(self,sm):
- State.__init__(self,sm)
def handle_pins_event(self):
pins = self.pins()
if not pins.door_locked:
def handle_pins_event(self):
pins = self.pins()
if not pins.door_locked:
@@
-97,7
+93,7
@@
class StateMachine():
class StateOpening(State):
def __init__(self,callback,sm):
class StateOpening(State):
def __init__(self,callback,sm):
-
State
.__init__(self,sm)
+
super()
.__init__(self,sm)
self.callbacks=[callback]
# FIXME: can we send "202 processing: Trying to open the door" here? Are the callbacks multi-use?
self.tries = 0
self.callbacks=[callback]
# FIXME: can we send "202 processing: Trying to open the door" here? Are the callbacks multi-use?
self.tries = 0
@@
-128,16
+124,13
@@
class StateMachine():
return StateZu(self.state_machine)
class AbstractStateWhereOpeningIsRedundant(State):
return StateZu(self.state_machine)
class AbstractStateWhereOpeningIsRedundant(State):
- def __init__ (self,sm):
- State.__init__(sm):
def handle_open_event(self, callback):
def handle_open_event(self, callback):
+ # FIXME contradicting original plan where open would be ignored in StateAboutToOpen?
callback("299 redundant: Space seems to be already open. Still processing your request tough.")
logger.warning("Received OPEN command in StateAboutToOpen. This should not be necessary.")
self.actor().act(Actor.CMD_OPEN)
class StateAboutToOpen(AbstractStateWhereOpeningIsRedundant):
callback("299 redundant: Space seems to be already open. Still processing your request tough.")
logger.warning("Received OPEN command in StateAboutToOpen. This should not be necessary.")
self.actor().act(Actor.CMD_OPEN)
class StateAboutToOpen(AbstractStateWhereOpeningIsRedundant):
- def __init__(self, sm):
- AbstractStateWhereOpeningIsRedundant.__init__(sm)
def handle_pins_event(self):
pins = self.pins()
if pins.door_locked:
def handle_pins_event(self):
pins = self.pins()
if pins.door_locked:
@@
-155,7
+148,7
@@
class StateMachine():
class StateAuf(AbstractStateWhereOpeningIsRedundant):
def __init__(self,sm):
class StateAuf(AbstractStateWhereOpeningIsRedundant):
def __init__(self,sm):
-
AbstractStateWhereOpeningIsRedundant
.__init__(sm)
+
super()
.__init__(sm)
self.last_buzzed = None
def handle_pins_event(self):
pins = self.pins()
self.last_buzzed = None
def handle_pins_event(self):
pins = self.pins()