Technologicat / pyan

Static call graph generator. The official Python 3 version. Development repo.
GNU General Public License v2.0
323 stars 56 forks source link

cannot have a file called “Graph.py” that has module level call to a known function #91

Open AntonObersteiner opened 9 months ago

AntonObersteiner commented 9 months ago

to reproduce: create a file Graph.py with these two lines:

#file Graph.py
def a(): pass
a()

run:

pyan3 --dot Graph.py > graph.dot

this will generate a graph.dot file that contains Graph -> which is invalid.

AntonObersteiner commented 9 months ago

I don’t really know how to solve this. If dot files don’t support some kind of escaping or marking of non-interpreted strings, one could rename the module internally, so the output svg or html just says Graph_ instead or at least give a concise error message whenever a invalid name will appear in the dot string. Then the user can exclude the offending file or remove the calls from the module level.