forked from pyta-uoft/pyta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaug_assign.py
31 lines (25 loc) · 923 Bytes
/
aug_assign.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
"""
AugAssign astroid node
An augmented assignment, which is the combination, in a single statement, of a
binary operation and an assignment statement.
Attributes:
- op (Optional[str])
- The operator to be performed on target.
- target (Optional[Name | Subscript | Attribute])
- What is being assigned to.
- value (Optional[NodeNG])
- A single node to be assigned to target.
Type-checking:
See https://docs.python.org/3.6/reference/datamodel.html#emulating-numeric-types.
Attempt to type-check the method call directly corresponding to 'op' (e.g.,
'__iadd__' for '+='). Otherwise, fallback to the corresponding standard
operator (e.g., '__add__' for '+='), making sure to auto-convert arguments
if necessary (as in BinOp).
Example:
AugAssign(
op='+=',
target=AssignName(name='x'),
value=Const(value=1))
"""
# Example:
x += 1