|
From: Karol L. <kar...@kn...> - 2007-02-03 22:51:24
|
I finished refactoring the parsers in the new branch ("parser-refactoring").
Besides moving the loop over to the base class, most of the changes were
connected with moving bits and pieces around and turning variables into class
attributes when they're used across calls of _extract().
All tests now finish like in the trunk, and the user side shouldn't be any
different than it was. Something might go wrong, though, in real-life
situations, so I would be grateful for testing the lateset revision in this
branch with some normal usage (GassSum and, PyMOlyze?). I'm not going to add
anything new here for now.
As to making _extract a dictionary of functions - from here on this is
simple, since the function is already divided into clear parts. It won't
simplify the code anymore, though, so I would leave this for the future. Also
- where would the many extracting funtions be defined? It's not a good idea,
for example, to populate the parser object with so many new attrbiutes.
Also changed/added:
1) Updategprogress is still needed... because alot of the parsing code updates
progress inside loops and such.
2) I wrote a new __setattr__ method for LogFile - it updates the logger, so no
more worrying about this in the parsers!
3) I also added a loop after parsing that deletes all attributes that are not
in self._nodelete (which is set utomatically), so that all the temporary
attributes used across calls of _extract() during parsing go away.
4) Notice that now in order for an attribute to be parsed it HAS TO be added
to LogFile._attrlist, otherwise it will get deleted, even if set by
_extract().
Looking forward to your feedback,
Karol
--
written by Karol Langner
Sat Feb 3 17:38:31 CET 2007
|