[Docstring-checkins] CVS: dps/dps statemachine.py,1.8,1.9
Status: Pre-Alpha
Brought to you by:
goodger
From: David G. <go...@us...> - 2001-09-13 02:15:37
|
Update of /cvsroot/docstring/dps/dps In directory usw-pr-cvs1:/tmp/cvs-serv4428/dps/dps Modified Files: statemachine.py Log Message: - Added 'nestedSM' and 'nestedSMkwargs' to State. Index: statemachine.py =================================================================== RCS file: /cvsroot/docstring/dps/dps/statemachine.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** statemachine.py 2001/09/12 03:45:42 1.8 --- statemachine.py 2001/09/13 02:15:35 1.9 *************** *** 71,75 **** transition methods, which handle the beginning- and end-of-file. ! e) If you are using `StateWS` as a base class, in order to handle nested indented blocks, you may wish to: --- 71,78 ---- transition methods, which handle the beginning- and end-of-file. ! e) In order to handle nested processing, you may wish to override the ! attributes `State.nestedSM` and/or `State.nestedSMkwargs`. ! ! If you are using `StateWS` as a base class, in order to handle nested indented blocks, you may wish to: *************** *** 456,459 **** --- 459,484 ---- """ + nestedSM = None + """ + The `StateMachine` class for handling nested processing. + + If left as ``None``, `nestedSM` defaults to the class of the state's + controlling state machine. Override it in subclasses to avoid the default. + """ + + nestedSMkwargs = None + """ + Keyword arguments dictionary, passed to the `nestedSM` constructor. + + Two keys must have entries in the dictionary: + + - Key 'stateclasses' must be set to a list of `State` classes. + - Key 'initialstate' must be set to the name of the initial state class. + + If `nestedSMkwargs` is left as ``None``, 'stateclasses' defaults to the + class of the current state, and 'initialstate' defaults to the name of the + class of the current state. Override in subclasses to avoid the defaults. + """ + def __init__(self, statemachine, debug=0): """ *************** *** 488,491 **** --- 513,522 ---- """Debugging mode on/off.""" + if self.nestedSM is None: + self.nestedSM = self.statemachine.__class__ + if self.nestedSMkwargs is None: + self.nestedSMkwargs = {'stateclasses': [self.__class__], + 'initialstate': self.__class__.__name__} + def unlink(self): """Remove circular references to objects no longer required.""" *************** *** 800,805 **** The `StateMachine` class handling indented text blocks. ! If left as ``None``, `indentSM` defaults to the class of the state's ! controlling state machine. Override it in subclasses to avoid the default. """ --- 831,836 ---- The `StateMachine` class handling indented text blocks. ! If left as ``None``, `indentSM` defaults to the value of `State.nestedSM`. ! Override it in subclasses to avoid the default. """ *************** *** 808,819 **** Keyword arguments dictionary, passed to the `indentSM` constructor. ! Two keys must have entries in the dictionary: ! ! - Key 'stateclasses' must be set to a list of `State` classes. ! - Key 'initialstate' must be set to the name of the initial state class. ! ! If `indentSMkwargs` is left as ``None``, 'stateclasses' defaults to the ! class of the current state, and 'initialstate' defaults to the name of the ! class of the current state. Override in subclasses to avoid the defaults. """ --- 839,844 ---- Keyword arguments dictionary, passed to the `indentSM` constructor. ! If left as ``None``, `indentSMkwargs` defaults to the value of ! `State.nestedSMkwargs`. Override it in subclasses to avoid the default. """ *************** *** 828,832 **** knownindentSMkwargs = None """ ! Keyword arguments dictionary, passed to the `indentSM` constructor. If left as ``None``, `knownindentSMkwargs` defaults to the value of --- 853,857 ---- knownindentSMkwargs = None """ ! Keyword arguments dictionary, passed to the `knownindentSM` constructor. If left as ``None``, `knownindentSMkwargs` defaults to the value of *************** *** 842,849 **** State.__init__(self, statemachine, debug) if self.indentSM is None: ! self.indentSM = self.statemachine.__class__ if self.indentSMkwargs is None: ! self.indentSMkwargs = {'stateclasses': [self.__class__], ! 'initialstate': self.__class__.__name__} if self.knownindentSM is None: self.knownindentSM = self.indentSM --- 867,873 ---- State.__init__(self, statemachine, debug) if self.indentSM is None: ! self.indentSM = self.nestedSM if self.indentSMkwargs is None: ! self.indentSMkwargs = self.nestedSMkwargs if self.knownindentSM is None: self.knownindentSM = self.indentSM |