Debian Codegraph @

rpython/rtyper/test/snippet.py

raw symbols SCIP
1 # generic
2
3 def simple1():
4 return 1
5
6
7 def simple2():
8 return False
9
10
11 def not1(n):
12 return not n
13
14
15 def not2(n):
16 t = not n
17 if not n:
18 t += 1
19 return t
20
21
22 # bools
23
24 def bool1(n):
25 if n:
26 return 3
27 return 5
28
29
30 def bool_cast1(n):
31 n += bool(False)
32 n += bool(True)
33 n += bool(0)
34 n += bool(1)
35 n += bool(6)
36 n += bool(7.8)
37 n += bool(n)
38 return n
39
40
41 #ints
42
43 def int1(n):
44 i = 0
45
46 i += n<<3
47 i <<= 3
48
49 i += n>>3
50 i >>= 3
51
52 i += n%3
53 i %= n
54
55 i += n^3
56 i ^= n
57
58 i += n&3
59 i &= n
60
61 i += n^3
62 i ^= n
63
64 i += n|3
65 i |= n
66
67 i += ~n
68
69 n += False
70 n += True
71 n += bool(False)
72 n += bool(True)
73
74 i += abs(i)
75 i &= 255
76
77 #i **= n
78 #i += n**3
79
80 i += -n
81 i += +n
82 i += not n
83
84 if n < 12.5:
85 n += 666
86
87 while n:
88 i = i + n
89 n = n - 1
90 return i
91
92
93 def int_cast1(n):
94 n += int(False)
95 n += int(True)
96 n += int(0)
97 n += int(1)
98 n += int(8)
99 n += int(5.7)
100 n += int(n)
101 return n
102
103
104 # floats
105
106 def float1(n):
107 i = 0
108
109 n += False
110 n += True
111 n += bool(False)
112 n += bool(True)
113
114 i += abs(i)
115 i &= 255
116
117 i += -n
118 i += +n
119 i += not n
120
121 if n < 12.5:
122 n += 666
123
124 while n >= 0:
125 i = i + n
126 n = n - 1
127 return i
128
129
130 def float_cast1(n):
131 n += float(False)
132 n += float(True)
133 n += float(0)
134 n += float(1)
135 n += float(6)
136 n += float(7.8)
137 n += float(n)
138 return n
139
140
141 def main(args=[]):
142 b = True
143 i = 23
144 f = 45.6
145 b1 = bool1(b)
146 i1 = int1(i)
147 f1 = float1(f)
148 return 0
149
150
151 if __name__ == '__main__':
152 main()