Mypyind is a tool to find all the occurrences of given function call, based on mypy.
- Install required dependencies of mypy.
pip install -r mypy-requirements.txt`
pip install -e .
- Add the fullpath of function in
mypyind/data/seed.txt
- then call mypyind to a target directory, then mypyind will iteratively find all occurrences.
python mypyind {target_directory}
- The result will be stored in files listed below.
mypyind/data/found.txt
: All unique function fullnames that are foundmypyind/data/found.log
: Iteration logsmypyind/data/found.json
: JSON representation of found.log
Example seed is given in mypyind/data/seed.txt
. It contains mypy.build.order_ascc
.
If you run python mypyind ./mypy
, then mypyind will try to find all function call to mypy.build.order_ascc
in mypy
directory.
The example result is given in mypyind/data/found.txt
, mypyind/data/found.log
and mypyind/data/found.json
.
Each line of found.txt
contains a fullname of function call that is found.
Each line of found.log
contains a fullname of function call that is found, and the fullname of function that calls it.
[Time] [Iteration Number] [Fullname of function call] is called from [Fullname of function that calls it]
found.json
is a re-rendered JSON representation of found.log
.
If a function call has caller, it's items have caller's fullname as key and number of iteration when it was found as value.
{
"Fullname of function call": {
"Fullname of function that calls the function": Iteration Numer,
...
}
}
At first iteration, mypyind will find all the function call to mypy.build.order_ascc
in mypy
directory, and store the result in result files.
Then, mypyind will find all the function call to found functions, and store the result in result files.
This process will be repeated until no new function call is found.
Since this tool is based on mypy, it has same limitation with mypy. Other than that, since mypy is static type checker, it cannot find function call that is dynamically generated.
To honor original writers of mypy, Mypy(-)ind is a combination of mypy and find.