Did I find the right examples for you? yes no

All Samples(2)  |  Call(2)  |  Derive(0)  |  Import(0)

        def save(name):
    f = open("%s.py" % name, 'w')
    f.write('\n# %s' % os.path.basename(sys.argv[0])) # echo command line ...
    f.write(' %s\n' % ' '.join(['%s' % arg for arg in sys.argv[1:]])) # ...etc.
    f.write('# %s states, %s transitions, %s accepting states, %s unsafe states, %s finished and %s deadend states\n' % \
            (len(states),len(graph),len(accepting),len(unsafe),len(finished),len(deadend)))
    f.write('\n# actions here are just labels, but must be symbols with __name__ attribute\n\n')
    f.writelines([ actiondef(aname)+'\n' for aname in anames ])
    f.write('\n# states, key of each state here is its number in graph etc. below\n\n')
    f.write('states = {\n')
    for i,s in enumerate(states):
        f.write('  %s\n' % state(i,s))
    f.write('}\n')
    f.write('\n# initial state, accepting states, unsafe states, frontier states, deadend states\n\n')
    f.write('%s\n' % initial_state())
    f.write('%s\n' % accepting_states())
    f.write('%s\n' % unsafe_states())
    f.write('%s\n' % frontier_states())
    f.write('%s\n' % finished_states())
    f.write('%s\n' % deadend_states())
    f.write('%s\n' % runstarts_states())
    f.write('\n# finite state machine, list of tuples: (current, (action, args, result), next)\n\n')
    f.write('graph = (\n')
    f.writelines([ '  %s,\n' % transition(t) for t in graph ])
    f.write(')\n')
    f.close()
        


src/p/y/PyModel-1.0/pymodel/pma.py   PyModel(Download)
            (len(Analyzer.states),len(Analyzer.graph),len(Analyzer.accepting),len(Analyzer.unsafe))
        mname = options.output if options.output else '%sFSM' % args[0]
        Analyzer.save(mname)
 
if __name__ == '__main__':

src/p/y/PyModel-HEAD/pymodel/pma.py   PyModel(Download)
            (len(Analyzer.states),len(Analyzer.graph),len(Analyzer.accepting),len(Analyzer.unsafe))
        mname = options.output if options.output else '%sFSM' % args[0]
        Analyzer.save(mname)
 
if __name__ == '__main__':