Am 2011-01-24 um 23:52 schrieb Chris Weisiger:
I've inherited a large codebase that is practically the definition
of "legacy", with all that entails. I've spent a lot of time
removing unused code, renaming variables, creating classes, moving
global variables to locals (let's stuff all our program state into a
single module and then just import that whenever we want to access
it!), and so on, and now I want to start cleaning up the dependency
chains between different modules.
There's several places where I've had to move an import statement
from being at the top of the module to being inside a function right
before it's used, to prevent circular dependencies from causing
imports to fail at program start. I wouldn't be surprised if I've
rendered many of these imports moot, but short of a fair amount of
painful grepping across ~20k lines of Python, I don't know of an
easy way to find them.
Is there a tool that examines your actual and apparent dependencies?
I know there are programs that will generate dependency graphs, but
for those there's little difference between a tight coupling and a
single import statement that isn't actually needed.
I use Eclipse/Aptana with PyDev, and if you manage to setup that
monster, it shows unused imports (as well as unused variables etc.)
quite nicely.
(It can't cope with dynamical class wizardry, like in dabo, and I
don't understand why it fails to find Django classes.)
Greetlings from Lake Constance!
Hraban
---
http://www.fiee.net
https://www.cacert.org (I'm an assurer)
_______________________________________________
Pythonmac-SIG maillist - Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG