-
-
Notifications
You must be signed in to change notification settings - Fork 276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug pylint 2436 #643
Bug pylint 2436 #643
Conversation
This reverts commit b3fa94a.
…ing hook to filter results of infer_call_result from list and tuples for function array and linspace
…inferred as a list or a tuple
…nce of numpy function calls
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hippo91 The first one with the missing methods makes sense. Can you split that up into its own separate PR? I am not sure about the first one though, as you mentioned in the comment from the original Pylint issue, the type you get depends on what argument you pass into a function. As such, it is entirely possible to get back a list or a tuple depending on the value that went into the function call. I don't think we should be doing anything here, in terms of modelling the types that those functions return, it would still be an Union[tuple, list, recarray, ...]
.
@PCManticore, no pb i'll do a PR just for the first point. |
@PCManticore , the PR for the first part is available under #645. |
@hippo91 Gotcha, that makes sense. I approved the PR, let's fix the conflicts and merge it. |
@PCManticore i fixed the conflicts. Only two unit tests are failing but they are identical to the ones that failed in previous commits. I merged the branch. |
Steps
Description
This PR solve the bug reported as pylint-dev/pylint#2436.
In fact two problems were present.
The first one was a lack of unary operators definition for some numeric types in
brain_numpy
. Thus the inference of such operators failed and a messageinvalid-unary-operand-type
was emitted.The second one was a wrong inference of call to some
numpy
functions. AList
orTuple
instance was present in the inference generator. It has been corrected by adding some transformations in thebrain_numpy
module. Such transformation creates a closure in which the call to classical inference method is made and then filtered to remove undesirable types.Type of Changes
Related Issue
Close pylint-dev/pylint#2436