Skip to content
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

[brain] numpy.ndarray.__or__ is binary #815

Closed
eugene57 opened this issue Jul 14, 2020 · 3 comments · Fixed by #832
Closed

[brain] numpy.ndarray.__or__ is binary #815

eugene57 opened this issue Jul 14, 2020 · 3 comments · Fixed by #832
Assignees

Comments

@eugene57
Copy link

Steps to reproduce

Lint following file:

import numpy

class BetterNDArray(numpy.ndarray):
  def __or__(self, other):
    return super().__or__(other)

This is likely caused by https://github.com/PyCQA/astroid/blob/master/astroid/brain/brain_numpy_ndarray.py#L74

Current behavior

************* Module numpy_ndarray
numpy_ndarray.py:4:2: W0235: Useless super delegation in method '__or__' (useless-super-delegation)
numpy_ndarray.py:5:11: E1121: Too many positional arguments for method call (too-many-function-args)

Expected behavior

No E1121 error.

python -c "from astroid import __pkginfo__; print(__pkginfo__.version)" output

2.4.1

@hippo91
Copy link
Contributor

hippo91 commented Aug 17, 2020

@eugene57 thanks for the report.
You are right, the __or__ method is a binary operator. The PR #832 corrects this and now the result of pylint on your piece of code is the following:

bug_astroid_815.py:5:4: W0235: Useless super delegation in method '__or__' (useless-super-delegation)

------------------------------------------------------------------
Your code has been rated at 7.50/10 (previous run: 7.50/10, +0.00)

which is, IMO, correct.

@hippo91 hippo91 closed this as completed Aug 17, 2020
@hippo91 hippo91 self-assigned this Aug 17, 2020
@eugene57
Copy link
Author

Yes, the warning is valid. Thank you!

1 similar comment
@eugene57
Copy link
Author

Yes, the warning is valid. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants