MonkeyType:通过运行时跟踪类型自动将类型注释添加到Python 3代码的工具-python

时间:2021-06-18 18:23:35
【文件属性】:
文件名称:MonkeyType:通过运行时跟踪类型自动将类型注释添加到Python 3代码的工具-python
文件大小:108KB
文件格式:ZIP
更新时间:2021-06-18 18:23:35
其它杂项 MonkeyType:通过运行时跟踪类型自动将类型注释添加到Python 3代码的工具 MonkeyType MonkeyType 收集函数参数和返回值的运行时类型,并且可以根据运行时收集的类型自动生成存根文件,甚至可以将草稿类型注释直接添加到您的 Python 代码中。 示例 在所有导入模块中的函数和方法的调用跟踪日志记录下运行脚本: $ monkeytype run myscript.py 或为代码块启用调用跟踪日志记录: import monkeytype with monkeytype.trace(): ... 默认情况下这会将调用跟踪转储到当前工作目录中文件monkeytype.sqlite3 中的sqlite 数据库中。 然后,您可以使用monkeytype 命令为模块生成存根文件,或将类型注释直接应用于您的代码: $ monkeytype stub some.module $ monkeytype apply some.module 如果 some/module.py 最初包含: def add( a, b): return a + b and myscript.py
【文件预览】:
MonkeyType-main
----README.rst(4KB)
----mypy.ini(324B)
----CONTRIBUTING.rst(3KB)
----.flake8(109B)
----monkeytype()
--------exceptions.py(348B)
--------util.py(3KB)
--------compat.py(5KB)
--------config.py(5KB)
--------db()
--------encoding.py(8KB)
--------__init__.py(943B)
--------py.typed(0B)
--------__main__.py(264B)
--------tracing.py(9KB)
--------stubs.py(32KB)
--------cli.py(14KB)
--------typing.pyi(4KB)
--------typing.py(16KB)
----.circleci()
--------config.yml(6KB)
----demo()
--------mypy.ini(58B)
--------inbox.py(5KB)
--------test_inbox.py(8KB)
--------requirements.txt(291B)
--------models.py(3KB)
--------pytest.ini(93B)
--------setup.cfg(28B)
--------README.md(2KB)
----Pipfile.lock(46KB)
----doc()
--------generation.rst(7KB)
--------make.bat(1KB)
--------faq.rst(2KB)
--------conf.py(6KB)
--------configuration.rst(7KB)
--------index.rst(482B)
--------Makefile(607B)
--------stores.rst(6KB)
--------tracing.rst(7KB)
----RELEASING.rst(1KB)
----tox.ini(121B)
----pytest.ini(103B)
----LICENSE(1KB)
----setup.py(2KB)
----CHANGES.rst(7KB)
----Pipfile(346B)
----tests()
--------cythontest.pyx(340B)
--------test_cli.py(13KB)
--------util.py(2KB)
--------test_config.py(1KB)
--------testmodule()
--------test_tracing.py(10KB)
--------db()
--------test_util.py(3KB)
--------test_typing.py(30KB)
--------__init__.py(0B)
--------test_stubs.py(48KB)
--------conftest.py(347B)
--------test_encoding.py(9KB)
----CODE_OF_CONDUCT.md(243B)
----.gitignore(173B)
----pyproject.toml(100B)

网友评论