forked from pyta-uoft/pyta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbool_op.py
43 lines (34 loc) · 867 Bytes
/
bool_op.py
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
"""
BoolOp astroid node
A boolean operation, 'or' or 'and'.
Attributes:
- op (Optional[str])
- The operator, 'or' or 'and'.
- values (Optional[list[Expr]])
- A list of the argument expressions
Example 1:
BoolOp(
op='or',
values=[Const(value=None), Const(value=1)])
Example 2:
BoolOp(
op='or',
values=[Const(value=None), Const(value=1), Const(value=2)])
Example 3:
BoolOp(
op='or',
values=[
Const(value=None),
BoolOp(
op='and',
values=[Const(value=1), Const(value=2)])])
Type-checking:
If all of the values have the type type, that type is used as the type of the of BoolOp itself.
Otherwise, the type of the BoolOp is Any.
"""
# Example 1
None or 1
# Example 2
None or 1 or 2
# Example 3
None or 1 and 2