forked from UnitTestBot/UTBotJava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathannotations2.py
More file actions
71 lines (43 loc) · 1011 Bytes
/
annotations2.py
File metadata and controls
71 lines (43 loc) · 1011 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
from typing import *
def simple_annotations1(x: int, y: int):
if x > 1:
return x + y
else:
return y * 2
def simple_annotations2(x: str, y: str):
if len(x) > 1:
return x + y
else:
return y * 2
def simple_annotations3(x: str, y: bool):
if y:
return x
else:
return x * 2
def simple_annotations4(x: float, y: int):
return x + y
def union(x: Union[int, str]):
if isinstance(x, int):
return 10 * x
else:
return x + "!"
def list_(x: List[int]):
return len(x)
def tuple_1(x: Tuple[int, str]):
return len(x)
def tuple_2(x: Tuple[int, ...]):
return len(x)
def dict_1(x: Dict[int, str]):
return len(x)
def dict_2(x: Dict[int, Union[str, bool]]):
return len(x)
def set_1(x: Set[int]):
return len(x)
def any_1(x: Any):
return x
class Node:
def __init__(self, name: str):
self.name = name
self.children = []
def reduce_1(x: Node):
return x.name