summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Myint <git@stevenmyint.com>2015-12-21 17:46:45 -0800
committerSteven Myint <git@stevenmyint.com>2015-12-21 17:46:45 -0800
commite8a5c67b23678d778982a202ee0c46513e584b05 (patch)
tree0c85c6db09b4b4be8b209b76146f2310a64e06fc
parent8d80642a76e16af6a8756a21b9ef9ec9a4b32108 (diff)
downloadpyflakes-matmul.tar.gz
Handle matrix-multiplication operator ("@")matmul
https://docs.python.org/3.6/whatsnew/3.5.html#pep-465-a-dedicated-infix-operator-for-matrix-multiplication This fixes https://bugs.launchpad.net/pyflakes/+bug/1523163.
-rw-r--r--pyflakes/checker.py3
-rw-r--r--pyflakes/test/test_other.py7
2 files changed, 9 insertions, 1 deletions
diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index fe20146..7155b54 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -767,7 +767,8 @@ class Checker(object):
# same for operators
AND = OR = ADD = SUB = MULT = DIV = MOD = POW = LSHIFT = RSHIFT = \
BITOR = BITXOR = BITAND = FLOORDIV = INVERT = NOT = UADD = USUB = \
- EQ = NOTEQ = LT = LTE = GT = GTE = IS = ISNOT = IN = NOTIN = ignore
+ EQ = NOTEQ = LT = LTE = GT = GTE = IS = ISNOT = IN = NOTIN = \
+ MATMULT = ignore
# additional node types
COMPREHENSION = KEYWORD = FORMATTEDVALUE = handleChildren
diff --git a/pyflakes/test/test_other.py b/pyflakes/test/test_other.py
index 0ac96a3..ae6cea2 100644
--- a/pyflakes/test/test_other.py
+++ b/pyflakes/test/test_other.py
@@ -1736,3 +1736,10 @@ class TestAsyncStatements(TestCase):
...
await trans.end()
''')
+
+ @skipIf(version_info < (3, 5), 'new in Python 3.5')
+ def test_matmul(self):
+ self.flakes('''
+ def foo(a, b):
+ return a @ b
+ ''')