I'm digging into a huge legacy Python class that has a lot of methods. I eventually break complex ones into smaller pieces so the amount of methods increases even more. I wonder if there is a tool that can scan the Python code and build some kind of dependency diagram for its methods.
I define method x()
to be a dependency of method y()
if x()
is called at least once in y()
.
I could use such a tool to isolate (if possible) subsets of class methods that have no external dependencies (all their dependencies are methods from the same subset).
I'm planning to move some functionality into other classes and I think that such an approach would help me to decide which parts to extract from the initial huge class.
Edit: I would really like a command-line tool.