typesafety:用于Python3的类型安全检查器

时间:2021-05-28 20:11:36
【文件属性】:
文件名称:typesafety:用于Python3的类型安全检查器
文件大小:58KB
文件格式:ZIP
更新时间:2021-05-28 20:11:36
Python 类型安全工具的用法 Typesafety是用于Python(3.2或更高版本)的工具,该工具使用注释-检查函数调用的参数是否有效。 例如,考虑以下代码: def sign ( x ): if not isinstance ( x , int ): raise TypeError ( 'Invalid type {!r}, expected int' . format ( x )) if x < 0> 0 : return 1 return 0 手动类型检查的速度很快,特别是当存在多个参数,复杂的检查等时,会变得很麻烦。如果内部代码(即非API)代码的检查可以更简洁地进行,这不是很酷吗? 如果您可以写: def sign ( x : int ): # ..
【文件预览】:
typesafety-master
----.travis.yml(347B)
----README.rst(7KB)
----features()
--------typechecking_python3.feature(4KB)
--------magic-attributes.feature(2KB)
--------pep484-supported-types.feature(3KB)
--------issue-13-indirect-import.feature(2KB)
--------issue-21-attribute-error-with-autodecorate.feature(2KB)
--------steps()
--------environment.py(1KB)
----.coveragerc(76B)
----.pylintrc(14KB)
----typesafety()
--------pytest.ini(41B)
--------validator.py(11KB)
--------noseplugin.py(4KB)
--------tests()
--------sphinxautodoc.py(5KB)
--------pytest_typesafety.py(2KB)
--------__init__.py(3KB)
--------typing_inspect.py(2KB)
--------finder.py(5KB)
--------pytests()
--------autodecorator.py(5KB)
----tox.ini(382B)
----LICENSE(26KB)
----AUTHORS(271B)
----setup.py(3KB)
----.gitignore(468B)
----scripts()
--------copyright.txt(700B)
--------copyright_files.exclude(13B)
--------copyright.py(6KB)
--------copyright_dirs.exclude(74B)

网友评论