Import Replacement

2009-01-31 Thread James Pruitt
Imagine there are two files horse.py and buffalo.py. horse.py is imported by
another file rider.py. Is it possible to make it so that under certain
circumstances possibly based on an environment variable or something similar
that when rider.py imports horse.py, it actually imports buffalo.py sort of
like a behind the scenes replacement so that rider.py needs little,
preferably absolutely no modification? Right now, I am investigating the use
of sys.modules and doing something using sys.modules['horse.py'] =
'buffalo.py'.
--
http://mail.python.org/mailman/listinfo/python-list


Import Replacement

2009-01-31 Thread James Pruitt
Imagine there are two files horse.py and buffalo.py. horse.py is imported by
another file rider.py. Is it possible to make it so that under certain
circumstances possibly based on an environment variable or something similar
that when rider.py imports horse.py, it actually imports buffalo.py sort of
like a behind the scenes replacement so that rider.py needs little,
preferably absolutely no modification? Right now, I am investigating the use
of sys.modules and doing something using sys.modules['horse.py'] =
'buffalo.py'.
--
http://mail.python.org/mailman/listinfo/python-list


Regex Generator From Multiple Files

2009-01-05 Thread James Pruitt
I am looking for a way given a number of files, say 3, that represent
technical support tickets in the same format to generate regular expressions
for the different fields automatically.

An example from of one line from each file:
Date: 12/30/2008 Room: 457 Building: Main
Date: 12/31/2008 Room: A21 Building: Annex
Date: 1/4/2009 Room: L69 Building: Library

The program would then, possibly using the python diff library, generate the
regular expression needed to parse out different fields. In this case it
might return a tuple like
("^Date:[\w]+(.*)[\w]+Room","Room:[\w]+(.*)[\w]+Building","Building:[\w]+(.*)[\w]+$")
that would match each of the fields based on the common data and sort of
assume that what doesn't change between them is data we are looking for.
--
http://mail.python.org/mailman/listinfo/python-list


Diff Across Multiple Files

2009-01-05 Thread James Pruitt
I am looking for a way to diff across multiple files; on average around 30
to 60 using python and probably the diff library so that we could see what
is common between all files and sort of ignore the differences.
--
http://mail.python.org/mailman/listinfo/python-list