Parsing fails with Python 3.5 matrix multiply infix operator #191
Comments
What about new_matrix = (matrix
@ another_matrix) |
The @ is the first character of the line there, but not the first character of the expression. The fix should look at the first character of the expression. |
Thanks for reporting this. Since I started maintaining this project, I wanted to replace the underlying parsing engine to something more robust and, mainly, 3rd party. Parsing Python code is no small undertaking and I feel that each bugfix is just putting out fires instead of dealing with the underlying problem. My current direction is to use pylint's |
I and @PCManticore have been doing some major refactoring of astroid, partly to make it better to use as a library for projects that aren't pylint. You can see what we have in progress in the 2.0 branch of the main astroid repository and here, https://github.com/PCManticore/astroid. Eventually, astroid will split into two libraries, one with all the static analysis code and one with the code for the ASTs. I haven't had much time to work on that this summer, but I expect at some point to be picking it up and finishing it. If you have questions or need help, I'm sure one of us would be willing to assist you. |
@ceridwen that sounds good. Right now I'm still refactoring and adding more tests so that it'll be an easier transition to replace the underlying engine, but I will definitely take you up on that help once I'll start to integrate with |
Short update: using |
pydocstyle fails when parsing files that use the Python 3.5 matrix multiply infix operator
@
.Steps to reproduce
Create file
blah.py
:Run pydocstyle on
blah.py
:Output:
Source of problem
The problem is in
pydocstyle.Parser#parse_definitions
where@
is assumed to exclusively be part of a decorator in the lines:I'm not sufficiently intimately familiar with the valid Python syntax to suggest a fix, but you could presumably solve the problem by assuming that any
@
characters encountered while parsing an expression are matrix multiply operators if they're not the first non-whitespace character of the expression.The text was updated successfully, but these errors were encountered: