Re: [ANN] Lupa 0.6 - Lua in Python

2010-07-19 Thread Fabrizio Milo aka misto
This is very very interesting.

Do you have any direct application of it ?
I know games like World of Warcraft uses Lua as scripting language.

Thanks.

Fabrizio
--
Luck favors the prepared mind. (Pasteur)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: cPAMIE 2.0 released!!

2006-02-22 Thread Fabrizio Milo
you forgot the link :)

http://pamie.sourceforge.net/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: aborting without killing the python interpreter

2006-02-19 Thread Fabrizio Milo
import sys

def main():
print 'exiting'
sys.exit()

try:
   main()
except SystemExit:
   pass


 I suspect I may need to use exceptions, but I'm hoping
 not to need them. Thanks.

Use the Exceptions!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: strange error I can't figure out...

2006-02-18 Thread Fabrizio Milo
Is well indented ?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: GUI and graph

2005-12-23 Thread Fabrizio Milo
 pydot is pretty amazing in its abilitity to make nice, readable renderings of 
 graph data.
 http://dkbza.org/pydot.html

Well It's thanks to graphwiz..

http://www.research.att.com/sw/tools/graphviz/

I suggest to read the DOT language specification ( it is really easy )
and to roll up your own python script to build your dot file.

Fabrizio Milo aka Misto
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pyUnit and dynamic test functions

2005-12-22 Thread Fabrizio Milo
 thanks for any input or any alternate approach to it

I think that your approach is not fair.

You should create a TestCase for each of your data input, add it to a TestSuite
and run the test suite.

Here is a stub for loading just a 'dict' type, hoping it is helpful


import unittest
import glob
from string import split,strip

def getUSStates(*args):
   #Fake
   return {'AK:': 'Alaska', 'CA:': 'California', 'AR:': 'Arkansas',
'CO:': 'Colorado', 'WY:': 'Wyoming', 'AZ:': 'Arizona', 'AL:':
'Alabama'}

class TestStubException( Exception ):
   '''
   Test case creation failed.
   '''

class TestStub( unittest.TestCase ):

   def __init__( self, fname, farg, t_out, out ):
   unittest.TestCase.__init__(self,'testRun')
   self.fname = eval(fname,globals())
   self.input = farg
   self.fparse = getattr(self,'load_%s' % t_out)
   self.output = self.fparse( out )

   def load_dict(self,data):
   assert data[0] is '{', 'Wrong dict format %s' % data
   assert data[-1] is '}', 'Wrong dict format %s' % data
   items = data[1:-1].split(',')
   return dict( map( split, map( strip, items ) ) )

   def testRun(self):
   self.assertEquals( self.fname(self.input), self.output )


def build_tests( filename ):
   try:
   fd = open( filename, 'r')
   tc = TestStub( *fd.read().split(~) )
   del fd
   return tc
   except:
   import traceback; traceback.print_exc()
   raise TestStubException( 'Failed creating test case from file
: %s'%filename )

if __name__== '__main__':

   tc_data = glob.glob('*.txt') # all text files with data

   ts = unittest.TestSuite()

   for tc_file in tc_data:
   ts.addTest( build_tests( tc_file ) )

   unittest.TextTestRunner().run(ts)


Fabrizio Milo aka Misto
-- 
http://mail.python.org/mailman/listinfo/python-list