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

Asyncio support #49

Closed vrbadev closed 3 years ago

vrbadev commented 3 years ago

I have encountered problems while using pyan3 with codes involving asyncio lib.

The error is:

File "F:\Anaconda3\lib\site-packages\pyan\analyzer.py", line 815, in analyze_functiondef
    raise TypeError("Expected ast.FunctionDef; got %s" % (type(ast_node)))
TypeError: Expected ast.FunctionDef; got <class '_ast.AsyncFunctionDef'>

And the simplest proposed solution would be probably changing lines 814 a 815 in analyzer.py to:

if not isinstance(ast_node, ast.FunctionDef) and not isinstance(ast_node, ast.AsyncFunctionDef):
            raise TypeError("Expected ast.(Async)FunctionDef; got %s" % (type(ast_node)))

(Worked for me.)

Technologicat commented 3 years ago

This was fixed in 461e95c, but the PyPI package hasn't been updated yet. It should work now. Thanks for reporting!

Technologicat commented 3 years ago

PyPI package pyan3 updated. Please try again with the latest version, and reopen this issue if necessary.