python 2.x的类型提示
takayi的Python项目详细描述
# Takayi
Type hints for python 2.X.
`takayi` means `high` in japanese.
## Usage
```python
from takayi.parser import Parser, typehints
parser = Parser()
# ==================================================
@typehints(parser)
def get_sum(x, y):
# type: (int, int) -> int
返回x+y
u sum=get-sum(1,2)结果应为3
takayi.exc.parameterTypeerror:expect=>;[<;type'int'>;,<;type'int'>;],actual=>;[<;type'int'>;,<;type'str'>;]
u err sum=get-sum(1,“hello”)
y=10) == 11
# ==================================================
class Node(object): pass
node = Node()
@typehints(parser, attach_cls=Node)
def get_node():
# type: () -> Node
return node
```
## TODO
- [x] Support kwargs type check
- [ ] More types. 仅供参考:[PEP484](https://www.python.org/dev/peps/pep-0484/)
Type hints for python 2.X.
`takayi` means `high` in japanese.
## Usage
```python
from takayi.parser import Parser, typehints
parser = Parser()
# ==================================================
@typehints(parser)
def get_sum(x, y):
# type: (int, int) -> int
返回x+y
u sum=get-sum(1,2)结果应为3
takayi.exc.parameterTypeerror:expect=>;[<;type'int'>;,<;type'int'>;],actual=>;[<;type'int'>;,<;type'str'>;]
u err sum=get-sum(1,“hello”)
y=10) == 11
# ==================================================
class Node(object): pass
node = Node()
@typehints(parser, attach_cls=Node)
def get_node():
# type: () -> Node
return node
```
## TODO
- [x] Support kwargs type check
- [ ] More types. 仅供参考:[PEP484](https://www.python.org/dev/peps/pep-0484/)