-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
42 lines (30 loc) · 738 Bytes
/
test.py
File metadata and controls
42 lines (30 loc) · 738 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from wisepy.talking import Talking
talking = Talking()
@talking
def add(left: 'an integer', right: 'another integer'):
"""
add up two numbers.
"""
left = int(left)
right = int(right)
return left + right
@talking.alias('sum')
def another(*args,
to_float: bool = False,
double=None,
additional_add: int = None):
"""
my sum command
"""
# using type annotation in keyword argument makes the argument
# cast to the specific type.
ret = sum(map(int, args))
if double:
ret = ret * 2
if to_float:
ret = float(ret)
if additional_add:
ret += additional_add
return ret
if __name__ == '__main__':
talking.on()