diff options
author | Anthony Sottile <asottile@umich.edu> | 2019-01-20 17:10:19 -0800 |
---|---|---|
committer | Ian Stapleton Cordasco <graffatcolmingov@gmail.com> | 2019-01-21 08:02:47 -0600 |
commit | 357a2e3cf3461b414ba5a70485a62c411d557c3f (patch) | |
tree | fffc9d5eeb7e32233488cec31228bfeae91f83ec | |
parent | 7272b1048ee319cc058bf83d4b78563573583ce9 (diff) | |
download | pyflakes-357a2e3cf3461b414ba5a70485a62c411d557c3f.tar.gz |
Allow star args in type comments
-rw-r--r-- | pyflakes/checker.py | 5 | ||||
-rw-r--r-- | pyflakes/test/test_type_annotations.py | 8 |
2 files changed, 12 insertions, 1 deletions
diff --git a/pyflakes/checker.py b/pyflakes/checker.py index 7b68b21..480ee00 100644 --- a/pyflakes/checker.py +++ b/pyflakes/checker.py @@ -1037,7 +1037,10 @@ class Checker(object): comment = comment.split(':', 1)[1].strip() func_match = TYPE_FUNC_RE.match(comment) if func_match: - parts = (func_match.group(1), func_match.group(2).strip()) + parts = ( + func_match.group(1).replace('*', ''), + func_match.group(2).strip(), + ) else: parts = (comment,) diff --git a/pyflakes/test/test_type_annotations.py b/pyflakes/test/test_type_annotations.py index 1ed676b..40397e8 100644 --- a/pyflakes/test/test_type_annotations.py +++ b/pyflakes/test/test_type_annotations.py @@ -231,6 +231,14 @@ class TestTypeAnnotations(TestCase): return a + b """) + def test_typeCommentsStarArgs(self): + self.flakes(""" + from mod import A, B, C, D + def f(a, *b, **c): + # type: (A, *B, **C) -> D + return a + b + """) + def test_typeCommentsFullSignatureWithDocstring(self): self.flakes(''' from mod import A, B, C, D |