OLD | NEW |
1 def redundant_parenthesis(x, y, z): | 1 def redundant_parenthesis(x, y, z): |
2 # * A111 | 2 # * A111 |
3 while (x): | 3 while (x): |
4 # * A111 | 4 # * A111 |
5 if ((x or y) and z): | 5 if ((x or y) and z): |
6 pass | 6 pass |
7 # * A111 | 7 # * A111 |
8 elif (x == max(y, z)): | 8 elif (x == max(y, z)): |
9 pass | 9 pass |
10 else: | 10 else: |
11 return | 11 return |
12 | 12 |
| 13 # * A111 |
| 14 for (a, b, c) in y: |
| 15 # * A111 |
| 16 result = (a + b + c) |
| 17 # * A111 |
| 18 return result or ('foo') |
| 19 |
| 20 # A111 |
| 21 (a, b, c) = x |
| 22 del a, b, c |
| 23 |
13 | 24 |
14 def mandatory_parenthesis(x, y, z): | 25 def mandatory_parenthesis(x, y, z): |
15 if (): | 26 if (): |
16 return | 27 return |
17 if (x, y, z): | 28 if (x, y, z): |
18 return | 29 return |
19 | 30 |
20 if (x or y) and z: | 31 if (x or y) and z: |
21 return | 32 return |
22 if x and (y or z): | 33 if x and (y or z): |
23 return | 34 return |
24 | 35 |
25 if (x or | 36 if (x or |
26 y): | 37 y): |
27 return | 38 return |
| 39 |
| 40 |
| 41 def acceptable_parenthesis(x, y, z): |
| 42 a = (x == y) |
| 43 b = (x or y == z) |
| 44 c = (x + y) / z |
| 45 d = (x and y) or z |
| 46 return (a, b, c, d) |
OLD | NEW |