-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
MNT: Apply assorted ruff/Pylint Refactor rules (PLR) #28755
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
Conversation
b85d6e2
to
567df2e
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
50566e0
to
dcb64c5
Compare
Class method defined without decorator
Cannot have defined parameters for properties
Useless `return` statement at end of function
062d730
to
a09f875
Compare
PLR1714 should not be applied to >>> import numpy as np
>>>
>>> dt = np.dtype('m8')
>>>
>>> dt == 'm8'
True
>>>
>>> dt in {'m8'}
False
>>> Which is best?
On the other hand, it can be applied to |
Consider merging multiple comparisons. Use a `set` if the elements are hashable. Co-authored-by: Joren Hammudoglu <jhammudoglu@gmail.com>
Use `elif` instead of `else` then `if`, to reduce indentation
Co-authored-by: Joren Hammudoglu <jhammudoglu@gmail.com>
Co-authored-by: Joren Hammudoglu <jhammudoglu@gmail.com>
Something like that (or |
I'm not sure what to use here:
In practice: >>> import numpy as np
>>>
>>> dt = np.dtype('m8')
>>>
>>> dt.base
dtype('<m8')
>>> dt.char
'm'
>>> dt.descr
[('', '<m8')]
>>> dt.name
'timedelta64'
>>> dt.str
'<m8'
>>> dt.type
<class 'numpy.timedelta64'>
>>> str(dt)
'timedelta64'
>>> dt == 'm8'
True
>>> dt == '<m8'
True
>>> |
My guess is that |
I see. I suggest we don't modify tests, as they implicitly check that
I can modify this file: numpy/numpy/lib/_npyio_impl.py Lines 951 to 952 in e4f0cd3
|
Co-authored-by: Joren Hammudoglu <jhammudoglu@gmail.com>
Co-authored-by: Joren Hammudoglu <jhammudoglu@gmail.com>
Thanks Dimitri :) |
No description provided.