本文整理汇总了Python中statemachine.StateMachine.run方法的典型用法代码示例。如果您正苦于以下问题:Python StateMachine.run方法的具体用法?Python StateMachine.run怎么用?Python StateMachine.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类statemachine.StateMachine
的用法示例。
在下文中一共展示了StateMachine.run方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: startthegoddamnedgame
# 需要导入模块: from statemachine import StateMachine [as 别名]
# 或者: from statemachine.StateMachine import run [as 别名]
def startthegoddamnedgame():
m = StateMachine()
m.add_state("GameStarts", game_started)
m.add_state("p1TurnStart", p1_turn_start)
m.add_state("p2TurnStart", p2_turn_start)
m.add_state("p1TurnEnd", p1_turn_end)
m.add_state("p2TurnEnd", p2_turn_end)
m.add_state("p1Win", p1_win)
m.add_state("p2Win", p2_win)
m.add_state("Game_Over", None, end_state=1)
m.set_start("GameStarts")
m.run(allTiles)
示例2: run
# 需要导入模块: from statemachine import StateMachine [as 别名]
# 或者: from statemachine.StateMachine import run [as 别名]
def run(fpin, fpout):
global fpindex
fpindex = fpout
m = StateMachine();
m.add_state(parse)
m.add_state(NOTES)
m.add_state(QUOTES)
m.add_state(segment)
m.add_state(error, end_state=1)
m.add_state(eof, end_state=1)
m.set_start(parse)
m.run((fpin, ''))
示例3: handle
# 需要导入模块: from statemachine import StateMachine [as 别名]
# 或者: from statemachine.StateMachine import run [as 别名]
def handle (self):
m = StateMachine()
try:
m.add_state('greeting', greeting)
m.add_state('helo', helo)
m.add_state('mail', mail)
m.add_state('rcpt', rcpt)
m.add_state('data', data)
m.add_state('process', process)
m.add_state('done', None, end_state=1)
m.set_start('greeting')
m.run((self, {}))
# in the event of an exception, capture the current
# state and cargo dict and use the information
# as part of the message sent to stdout
except Exception as e:
exception_data = {'state':m.current_state}
if m.current_cargo:
exception_data['data'] = m.current_cargo[1]
e.args = (exception_data,)
raise
示例4: return
# 需要导入模块: from statemachine import StateMachine [as 别名]
# 或者: from statemachine.StateMachine import run [as 别名]
print " >>"
return (newState, val)
def twenties_counter(val):
print "TWENTIES State:",
while 1:
if val <= 0 or val >= 30:
newState = "Out_of_Range"; break
elif 1 <= val < 10:
newState = "ONES"; break
elif 10 <= val < 20:
newState = "TENS"; break
else:
print " *%2.1f+" % val,
val = math_func(val)
print " >>"
return (newState, val)
def math_func(n):
from math import sin
return abs(sin(n))*31
if __name__== "__main__":
m = StateMachine()
m.add_state("ONES", ones_counter)
m.add_state("TENS", tens_counter)
m.add_state("TWENTIES", twenties_counter)
m.add_state("OUT_OF_RANGE", None, end_state=1)
m.set_start("ONES")
m.run(1)
示例5: __init__
# 需要导入模块: from statemachine import StateMachine [as 别名]
# 或者: from statemachine.StateMachine import run [as 别名]
class SamParaParser:
def __init__(self):
# These attributes are set by the parse method
self.doc = None
self.para = None
self.current_string = None
self.flow = None
self.stateMachine = StateMachine()
self.stateMachine.add_state("PARA", self._para)
self.stateMachine.add_state("ESCAPE", self._escape)
self.stateMachine.add_state("END", None, end_state=1)
self.stateMachine.add_state("ANNOTATION-START", self._annotation_start)
self.stateMachine.add_state("CITATION-START", self._citation_start)
self.stateMachine.add_state("BOLD-START", self._bold_start)
self.stateMachine.add_state("ITALIC-START", self._italic_start)
self.stateMachine.add_state("MONO-START", self._mono_start)
self.stateMachine.add_state("QUOTES-START", self._quotes_start)
self.stateMachine.add_state("INLINE-INSERT", self._inline_insert)
self.stateMachine.set_start("PARA")
self.patterns = {
"escape": re.compile(r"\\"),
"escaped-chars": re.compile(r"[\\\(\{\}\[\]_\*,`]"),
"annotation": re.compile(
r'(?<!\\)\{(?P<text>.*?)(?<!\\)\}(\(\s*(?P<type>\S*?\s*[^\\"\']?)(["\'](?P<specifically>.*?)["\'])??\s*(\((?P<namespace>\w+)\))?\))?'
),
"bold": re.compile(r"\*(?P<text>\S.+?\S)\*"),
"italic": re.compile(r"_(?P<text>\S.*?\S)_"),
"mono": re.compile(r"`(?P<text>\S.*?\S)`"),
"quotes": re.compile(r'"(?P<text>\S.*?\S)"'),
"inline-insert": re.compile(r">>\((?P<attributes>.*?)\)"),
"citation": re.compile(
r"(\[\s*\*(?P<id>\S+)(\s+(?P<id_extra>.+?))?\])|(\[\s*\#(?P<name_name>\S+)(\s+(?P<extra>.+?))?\])|(\[\s*(?P<citation>.*?)\])"
),
}
def parse(self, para, doc, strip=True):
if para is None:
return None
self.doc = doc
self.para = Para(para, strip)
self.current_string = ""
self.flow = Flow()
self.stateMachine.run(self.para)
return self.flow
def _para(self, para):
try:
char = para.next_char
except IndexError:
self.flow.append(self.current_string)
self.current_string = ""
return "END", para
if char == "\\":
return "ESCAPE", para
elif char == "{":
return "ANNOTATION-START", para
elif char == "[":
return "CITATION-START", para
elif char == "*":
return "BOLD-START", para
elif char == "_":
return "ITALIC-START", para
elif char == "`":
return "MONO-START", para
elif char == '"':
return "QUOTES-START", para
elif char == ">":
return "INLINE-INSERT", para
else:
self.current_string += char
return "PARA", para
def _annotation_start(self, para):
match = self.patterns["annotation"].match(para.rest_of_para)
if match:
self.flow.append(self.current_string)
self.current_string = ""
annotation_type = match.group("type")
text = match.group("text")
# If there is an annotated phrase with no annotation, look back
# to see if it has been annotated already, and if so, copy the
# closest preceding annotation.
if annotation_type is None:
# First look back in the current flow
# (which is not part of the doc structure yet).
previous = self.flow.find_last_annotation(text)
if previous is not None:
self.flow.append(previous)
else:
# Then look back in the document.
previous = self.doc.find_last_annotation(text)
if previous is not None:
self.flow.append(previous)
# Else raise an exception.
else:
raise SAMParserError(
"Blank annotation found: {"
#.........这里部分代码省略.........
示例6: return
# 需要导入模块: from statemachine import StateMachine [as 别名]
# 或者: from statemachine.StateMachine import run [as 别名]
print 'player 2 wins!'
newState = 'game_end'
return(newState, inpList)
def game_end(inpList):
print 'End of game!'
return None
##########################################################################
# Setting up game:
allTiles = []
allTiles.extend(User1.tiles)
allTiles.extend(User2.tiles)
if __name__ == "__main__":
m = StateMachine()
m.add_state("GameStarts", game_started)
m.add_state("p1TurnStart", p1_turn_start)
m.add_state("p2TurnStart", p2_turn_start)
m.add_state("p1TurnEnd", p1_turn_end)
m.add_state("p2TurnEnd", p2_turn_end)
m.add_state("p1Win", p1_win)
m.add_state("p2Win", p2_win)
m.add_state("GameOver", game_end)
m.add_state("Out of range", None, end_state=1)
m.set_start("GameStarts")
m.run(allTiles)
示例7: __init__
# 需要导入模块: from statemachine import StateMachine [as 别名]
# 或者: from statemachine.StateMachine import run [as 别名]
class ParserScript:
def __init__(self,db,file_name,log_file_name=None):
self.sm = StateMachine()
self.db=db
self.cur = self.db.cursor()
file=codecs.open(file_name,'r','utf8')
if log_file_name: self.log=codecs.open(log_file_name,'w','utf8')
self.line=self.get_script_line(file)
self.SQL=u''
self.r=re.compile('SET[\\s]+TERM')
self.ex_term=';'
self.create_state(self.sm)
self.State=''
self.log=None
print "Parse script class"
def run(self):
self.sm.run(['','READ_LINE'])
def get_script_line(self,file):
while 1:
str=file.readline()
if not str: break
yield str
def get_line(self,val):
if len(val[0].strip())==0:
newState='CLEAN_REM'
val[1]=newState
else:
newState=val[1]
try:
s=self.line.next()
val[0]+=s
except:
newState='COMMIT'
if newState<>'COMMIT' and len(re.sub('\\s+','',val[0]).strip())==0 :
newState='READ_LINE'
return (newState, val)
def clean_leades_rem(self,val):
newState='EX_TERM'
if val[0].strip()[:2]=='--':
val[0]=''
newState='READ_LINE'
if val[0].strip()[:2]=='/*':
pos=val[0].find('*/')
if pos==-1:
newState='READ_LINE'
else:
val[0]=re.sub('\\s+','',val[0][pos+2:])
if len(val[0].strip())==0:
newState='READ_LINE'
val[1]=newState
return (newState, val)
def get_term(self,val):
pos_term=val[0].find(self.ex_term)
if pos_term==-1:
newState='READ_LINE'
val[1]='TERM'
else:
self.SQL+=val[0][:pos_term]
newState='EXEC_SQL'
val[0]=val[0][pos_term+1:]
return (newState, val)
def get_ex_term(self,val):
#print 'EX_TERM>> '+val[0]
pos_ex_term=self.r.search(val[0])
newState='EXT_TERM'
if pos_ex_term==None:
newState='TERM'
elif val[0][:pos_ex_term.start()].strip()=='':
pos=val[0].find(self.ex_term)
if pos==-1:
val[1]=newState
newState='READ_LINE'
else:
self.ex_term=re.sub('SET[\\s]+TERM','',val[0][pos_ex_term.start():pos]).strip()
val[1]=newState
newState='READ_LINE'
val[0]=val[0][pos+1:]
else:
if val[0][:pos_ex_term].find(';')<>-1:
val[1]=newState
newState='TERM'
return (newState, val)
def exec_SQL(self,val):
#print self.SQL+'<<\n'
if self.log:
self.log.write(self.SQL)
self.log.write('<<\n')
try:
self.cur.execute(self.SQL)
except kdb.ProgrammingError,e:
if e[0]<>-607:
newState='ERROR'
self.SQL=''
#.........这里部分代码省略.........
示例8: __init__
# 需要导入模块: from statemachine import StateMachine [as 别名]
# 或者: from statemachine.StateMachine import run [as 别名]
class SamParaParser:
def __init__(self):
# These attributes are set by the parse method
self.doc = None
self.para = None
self.current_string = None
self.flow = None
self.stateMachine = StateMachine()
self.stateMachine.add_state("PARA", self._para)
self.stateMachine.add_state("ESCAPE", self._escape)
self.stateMachine.add_state("END", None, end_state=1)
self.stateMachine.add_state("ANNOTATION-START", self._annotation_start)
self.stateMachine.add_state("CITATION-START", self._citation_start)
self.stateMachine.add_state("BOLD-START", self._bold_start)
self.stateMachine.add_state("ITALIC-START", self._italic_start)
self.stateMachine.add_state("CODE-START", self._code_start)
self.stateMachine.add_state("QUOTES-START", self._quotes_start)
self.stateMachine.add_state("INLINE-INSERT", self._inline_insert)
self.stateMachine.add_state("CHARACTER-ENTITY", self._character_entity)
self.stateMachine.set_start("PARA")
self.patterns = {
'escape': re.compile(r'\\', re.U),
'escaped-chars': re.compile(r'[\\\(\{\}\[\]_\*,\.\*`"&]', re.U),
'annotation': re.compile(
r'(?<!\\)\{(?P<text>.*?)(?<!\\)\}(\(\s*(?P<type>\S*?\s*[^\\"\']?)(["\'](?P<specifically>.*?)["\'])??\s*(\((?P<namespace>\w+)\))?\s*(~(?P<language>[\w-]+))?\))?', re.U),
'bold': re.compile(r'\*(?P<text>((?<=\\)\*|[^\*])*)(?<!\\)\*', re.U),
'italic': re.compile(r'_(?P<text>((?<=\\)_|[^_])*)(?<!\\)_', re.U),
'code': re.compile(r'`(?P<text>(``|[^`])*)`', re.U),
'quotes': re.compile(r'"(?P<text>((?<=\\)"|[^"])*)(?<!\\)"', re.U),
'inline-insert': re.compile(r'>\((?P<attributes>.*?)\)', re.U),
'character-entity': re.compile(r'&(\#[0-9]+|#[xX][0-9a-fA-F]+|[\w]+);'),
'citation': re.compile(r'(\[\s*\*(?P<id>\S+)(\s+(?P<id_extra>.+?))?\])|(\[\s*\#(?P<name_name>\S+)(\s+(?P<extra>.+?))?\])|(\[\s*(?P<citation>.*?)\])', re.U)
}
def parse(self, para, doc, strip=True):
if para is None:
return None
self.doc = doc
self.para = Para(para, strip)
self.current_string = ''
self.flow = Flow()
self.stateMachine.run(self.para)
return self.flow
def _para(self, para):
try:
char = para.next_char
except IndexError:
self.flow.append(self.current_string)
self.current_string = ''
return "END", para
if char == '\\':
return "ESCAPE", para
elif char == '{':
return "ANNOTATION-START", para
elif char == '[':
return "CITATION-START", para
elif char == "*":
return "BOLD-START", para
elif char == "_":
return "ITALIC-START", para
elif char == "`":
return "CODE-START", para
elif char == '"':
return "QUOTES-START", para
elif char == ">":
return "INLINE-INSERT", para
elif char == "&":
return "CHARACTER-ENTITY", para
else:
self.current_string += char
return "PARA", para
def _annotation_start(self, para):
match = self.patterns['annotation'].match(para.rest_of_para)
if match:
self.flow.append(self.current_string)
self.current_string = ''
annotation_type = match.group('type')
language = match.group('language')
text = self._unescape(match.group("text"))
# If there is an annotated phrase with no annotation, look back
# to see if it has been annotated already, and if so, copy the
# closest preceding annotation.
if annotation_type is None and not language:
# First look back in the current flow
# (which is not part of the doc structure yet).
previous = self.flow.find_last_annotation(text)
if previous is not None:
self.flow.append(previous)
else:
# Then look back in the document.
previous = self.doc.find_last_annotation(text)
if previous is not None:
self.flow.append(previous)
# Else output a warning.
else:
#.........这里部分代码省略.........
示例9: Path
# 需要导入模块: from statemachine import StateMachine [as 别名]
# 或者: from statemachine.StateMachine import run [as 别名]
return True
else:
return False
_0to1 = Path('0 to state 1').from_(state0).to_(state1).when('go to 1')
_0to2 = Path('0 to state 2').from_(state0).to_(state2).when('go to 2')
_1to2 = Path('1 to state 2').from_(state1).to_(state2).when(testfunc1)
_2to3 = Path('2 to state 3').from_(state2).to_(state3).when(testfunc2)
test = TestObject(state0)
#and start loop
while(True):
line = raw_input('input>>')
if line == 'quit':
break
pre_state = test.state.state_desc
output = statemachine.run(test,line)
if output is not False:
print 'output is :'+output
print 'state change: from %s to %s.' % (pre_state,test.state.state_desc)
else:
print 'invalid input:'+line
示例10: __init__
# 需要导入模块: from statemachine import StateMachine [as 别名]
# 或者: from statemachine.StateMachine import run [as 别名]
class SamParser:
def __init__(self):
self.stateMachine = StateMachine()
self.stateMachine.add_state("NEW", self._new_file)
self.stateMachine.add_state("SAM", self._sam)
self.stateMachine.add_state("BLOCK", self._block)
self.stateMachine.add_state("CODEBLOCK-START", self._codeblock_start)
self.stateMachine.add_state("CODEBLOCK", self._codeblock)
self.stateMachine.add_state("PARAGRAPH-START", self._paragraph_start)
self.stateMachine.add_state("PARAGRAPH", self._paragraph)
self.stateMachine.add_state("RECORD-START", self._record_start)
self.stateMachine.add_state("RECORD", self._record)
self.stateMachine.add_state("LIST-ITEM", self._list_item)
self.stateMachine.add_state("NUM-LIST-ITEM", self._num_list_item)
self.stateMachine.add_state("BLOCK-INSERT", self._block_insert)
self.stateMachine.add_state("END", None, end_state=1)
self.stateMachine.set_start("NEW")
self.current_paragraph = None
self.doc = DocStructure()
self.source = None
self.patterns = {
'comment': re.compile(r'\s*#.*'),
'block-start': re.compile(r'(\s*)([a-zA-Z0-9-_]+):(?:\((.*?)\))?(.*)'),
'codeblock-start': re.compile(r'(\s*)```(.*)'),
'codeblock-end': re.compile(r'(\s*)```\s*$'),
'paragraph-start': re.compile(r'\w*'),
'blank-line': re.compile(r'^\s*$'),
'record-start': re.compile(r'\s*[a-zA-Z0-9-_]+::(.*)'),
'list-item': re.compile(r'(\s*)(\*\s+)(.*)'),
'num-list-item': re.compile(r'(\s*)([0-9]+\.\s+)(.*)'),
'block-insert': re.compile(r'(\s*)>>\(.*?\)\w*')
}
def parse(self, source):
self.source = source
try:
self.stateMachine.run(self.source)
except EOFError:
raise Exception("Document ended before structure was complete. At:\n\n"
+ self.current_paragraph)
def paragraph_start(self, line):
self.current_paragraph = line.strip()
def paragraph_append(self, line):
self.current_paragraph += " " + line.strip()
def pre_start(self, line):
self.current_paragraph = line
def pre_append(self, line):
self.current_paragraph += line
def _new_file(self, source):
line = source.next_line
if line[:4] == 'sam:':
self.doc.new_root('sam', line[5:])
return "SAM", source
else:
raise Exception("Not a SAM file!")
def _block(self, source):
line = source.currentLine
match = self.patterns['block-start'].match(line)
indent = len(match.group(1))
element = match.group(2).strip()
attributes = match.group(3)
content = match.group(4).strip()
if content[:1] == ':':
return "RECORD-START", source
else:
self.doc.new_block(element, attributes, content, indent)
return "SAM", source
def _codeblock_start(self, source):
line = source.currentLine
local_indent = len(line) - len(line.lstrip())
match = self.patterns['codeblock-start'].match(line)
attributes = re.compile(r'\((.*?)\)').match(match.group(2).strip())
language = attributes.group(1)
self.doc.new_block('codeblock', language, None, local_indent)
self.pre_start('')
return "CODEBLOCK", source
def _codeblock(self, source):
line = source.next_line
if self.patterns['codeblock-end'].match(line):
self.doc.new_flow(Pre(self.current_paragraph))
return "SAM", source
else:
self.pre_append(line)
return "CODEBLOCK", source
def _paragraph_start(self, source):
line = source.currentLine
local_indent = len(line) - len(line.lstrip())
self.doc.new_block('p', None, '', local_indent)
self.paragraph_start(line)
#.........这里部分代码省略.........
示例11: return
# 需要导入模块: from statemachine import StateMachine [as 别名]
# 或者: from statemachine.StateMachine import run [as 别名]
newState = "pos_state"
elif word in negative_adjectives:
newState = "neg_state"
else:
newState = "error_state"
return (newState, txt)
elif state == "not_state":
if word in positive_adjectives:
newState = "neg_state"
elif word in negative_adjectives:
newState = "pos_state"
else:
newState = "error_state"
return (newState, txt)
if __name__ == "__main__":
m = StateMachine()
m.add_state("Start", transitions)
m.add_state("Python_state", transitions)
m.add_state("is_state", transitions)
m.add_state("not_state", transitions)
m.add_state("neg_state", None, end_state=1)
m.add_state("pos_state", None, end_state=1)
m.add_state("error_state", None, end_state=1)
m.set_start("Start")
m.run("Python is great")
"""
m.run("Python is difficult")
m.run("Perl is ugly")
"""
示例12: __init__
# 需要导入模块: from statemachine import StateMachine [as 别名]
# 或者: from statemachine.StateMachine import run [as 别名]
#.........这里部分代码省略.........
self.no_connect()
return None
def detect_codecs(self):
if sys_name=='nt':
return 'CP866'
else:
return 'UTF8'
def parse_cmd(self,argv):
is_parse=1
i=0
cmd=''
print len(argv)
if len(argv)>1:
try:
while i<len(argv):
print argv[i],i,argv[i] in ['i','c','u']
if argv[i] in ['i','c','u']:
cmd=argv[i]
print cmd
i+=1
elif self.params.has_key(argv[i]):
self.params[argv[i]]=argv[i+1]
print argv[i+1]
i+=2
else:
print i
self.bad_parameters()
is_parse=0
break
print self.params
except:
self.bad_parameters()
is_parse=0
else:
if is_parse:
self.cmd=cmd
self.mydb=self.connect_db()
else:
self.help()
def create_state(self,m):
m.add_state('c', self.clean_db) #, 'TERM','EXT_TERM','COMMIT','SKIP'
m.add_state('cid', self.clean_db) #clean after install
m.add_state('id', self.create_db_structures)
m.add_state('d', self.create_dictionares)
m.add_state('u',self.update_db)
m.add_state('ERROR',self.error)
m.add_state('',None,end_state=1)
def run_command(self):
if self.cmd:
if self.cmd=='i':
cmd='cid'
else:
cmd=self.cmd
self.sm.set_start(cmd)
self.sm.run(cmd)
def clean_db(self,val):
import clean_db
CC=clean_db.IndexerClean()
if CC.clean(self.mydb)==1:
newState=val[1:]
else:
newState='ERROR'
return (newState, newState)
def create_db_structures(self,val):
from parse_script import ParserScript
input_file=os.path.dirname(__file__)+'\\indexer.sql'
#output_file=os.path.dirname(__file__)+'\\out.sql'
parser=ParserScript(self.mydb,input_file)
parser.run()
if parser.State=='COMPLIT':
newState=val[1:]
else:
newState='ERROR'
print "Error in create structures"
return (newState, newState)
def create_dictionares(self,val):
import dict_encode
if dict_encode.run(self.mydb)==1:
newState=val[1:]
else:
newState='ERROR'
print "Error in create dictionaries"
return (newState, newState)
def update_db(self,val):
return('','')
def error(self,val):
print 'ERROR in state '+val
newState=''
return (newState, newState)
示例13: StateMachine
# 需要导入模块: from statemachine import StateMachine [as 别名]
# 或者: from statemachine.StateMachine import run [as 别名]
startstate = MetaRescue
resumed = True
logging.info("Resuming at Metadata Rescue...")
else:
startstate = MetaClone
# STATEMACHINE
sm = StateMachine(0.1, startstate, globals(), locals())
BTRACE_POLL_COUNT = 0
def btrace_poller(smobj):
global BTRACE_POLL_COUNT
if btrace.blkparse is not None and btrace.parser is not None:
lines_read = btrace.parser.read_btrace()
BTRACE_POLL_COUNT += 1
if lines_read > 0:
# unused are marked finished so when ANDed using ddrescuelog
# only definitely unused parts remain finished
btracelog = btrace.parser.write_ddrescuelog(OPTIONS,
'non-tried', 'finished', 0, DEVSIZE)
if ddrescue.VIEWER is not None:
shutil.copyfile(btracelog, ddrescue.ddrlog)
sm.add_persistent_task(btrace_poller)
# EXECUTE
sm.run()
# CLEANUP BEFORE NORMAL EXIT
cleanup()
示例14: go
# 需要导入模块: from statemachine import StateMachine [as 别名]
# 或者: from statemachine.StateMachine import run [as 别名]
def go(self):
m = StateMachine()
# for tmp in self.__cargos:
# print(tmp)
'''Present'''
m.add_state("Start", self.start_transitions)
m.add_state('1A_state', self._1A_state_transitions)
m.add_state('1C_state', None, end_state=1)
m.add_state('2A_state', self._2A_state_transitions)
m.add_state('2B_state', None, end_state=1)
m.add_state('2C_state', None, end_state=1)
m.add_state('Z1_VBP_state', self._Z1_VBP_state_transitions)
m.add_state('Z1_VBZ_state', self._Z1_VBZ_state_transitions)
m.add_state('1B_VBP_state', None, end_state=1)
m.add_state('1B_VBZ_state', None, end_state=1)
m.add_state('1D_state', None, end_state=1) ### TODO: review, we add quan-subj state for uw-166
m.add_state('Z2_state', self._Z2_state_transitions)
m.add_state('3A_state', self._3A_state_transitions)
m.add_state('3B_state', None, end_state=1)
m.add_state('3C_state', None, end_state=1)
m.add_state('4A_state', self._4A_state_transitions)
m.add_state('4B_state', None, end_state=1)
m.add_state('4C_state', None, end_state=1)
'''Past'''
m.add_state('5A_state', self._5A_state_transitions)
m.add_state('5C_state', None, end_state=1)
m.add_state('6A_state', self._6A_state_transitions)
m.add_state('6B_state', None, end_state=1)
m.add_state('6C_state', None, end_state=1)
m.add_state('Z3_state', self._Z3_state_transitions)
m.add_state('5B_state', None, end_state=1)
m.add_state('Z4_state', self._Z4_state_transitions)
m.add_state('7A_state', self._7A_state_transitions)
m.add_state('7B_state', None, end_state=1)
m.add_state('7C_state', None, end_state=1)
m.add_state('8A_state', self._8A_state_transitions)
m.add_state('8B_state', None, end_state=1)
m.add_state('8C_state', None, end_state=1)
'''Future and MD'''
m.add_state('ZM_state', self._ZM_state_transitions)
m.add_state('9A_state', self._9A_state_transitions)
m.add_state('9C_state', None, end_state=1)
m.add_state('10A_state', self._10A_state_transitions)
m.add_state('10B_state', None, end_state=1)
m.add_state('10C_state', None, end_state=1)
# m.add_state('Z3_state', self._Z3_state_transitions)
m.add_state('9B_state', self._9B_state_transitions)
# m.add_state('Z5_state', self._Z5_state_transitions) Z5 merged with 9B
m.add_state('11A_state', self._11A_state_transitions)
m.add_state('11B_state', None, end_state=1)
m.add_state('11C_state', None, end_state=1)
m.add_state('12A_state', self._12A_state_transitions)
m.add_state('12B_state', None, end_state=1)
m.add_state('12C_state', None, end_state=1)
m.add_state('error_state', None, end_state=1)
m.set_start("Start")
m.run(self.__cargos, actions)
return m.get_tvstate(), m.get_action()