Monkeytype A module that can add comments automatically!
To download First:
Pip Install Monkeytype
Take the sample code of the official website as an example
# moudle.py def Add (A, b): return A + b
This test.py file will call the Add () method
#test. py
fromimport addprint(Add (1, 2))
We execute the following command in the cmd window:
Monkeytype Run test.py
After the program is executed, you can see that 3 is returned.
Ok! The point is that we found a monkeytype.sqlite3 file.
The official website explains this:
By default this would dump call traces to a SQLite database in the "file in the monkeytype.sqlite3
" current working directory. You can then use monkeytype
the command to generate a stub file for a module, or apply the type annotations directly to your CO De.
Execute the command under CMD:
Monkeytype stub Some.module
You can see clearly the comments on a and B, and the Add method
To apply comments to your code:
Monkeytype Apply Some.module
Look at the module.py file again:
The code has been automatically annotated.
Detailed operation guide, reference:
http://monkeytype.readthedocs.io/en/latest/index.html#
Python Foundation ===monkeytype can automatically add comments to the module!