https://github.com/lingfromsh/python-type-check
Python 的自动类型检查
https://github.com/lingfromsh/python-type-check
Last synced: 10 months ago
JSON representation
Python 的自动类型检查
- Host: GitHub
- URL: https://github.com/lingfromsh/python-type-check
- Owner: lingfromSh
- License: mit
- Created: 2020-02-05T14:18:05.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-02-11T11:02:55.000Z (almost 6 years ago)
- Last Synced: 2025-01-09T03:50:50.534Z (12 months ago)
- Language: Python
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Python-Type-Check
> 由于python是动态语言的原因,类型检查是不被提供的。但是平时大多时候还是需要确保参数类型的。
## 目前功能
- 对于str,int,list,tuple等一般传统类型和一般的_GenericAlias类型检查自动支持
- 支持typing.Union类型的自动类型检查
## 目前问题
- 对于typing.AnyStr,typing.SupportsInt等类型不支持
## 快速上手
直接引入,作需要提供类型检查的装饰器即可。
```python
import type_check
import typing
@type_check
def foo(a:int,b:typing.List)->typing.Tuple:
return a, b
```