-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
MNT: Enforce ruff/flake8-bugbear rules (B) #28765
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
0b85500
to
6731f90
Compare
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.
I have the feeling that there are some threading subtleties that we might be missing here. Perhaps @ngoldbaum could also take a look at this?
Indeed, the underlying issue remains. I'm not familiar with |
I’ll try to take a look at this next week. |
Needs a rebase. |
this needs a rebase |
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.
There's nothing left for me to complain about 👌🏻. So unless @ngoldbaum has any objections, this should be good to merge.
7e3940a
to
741eb67
Compare
I think you need to do a little more to remove |
e1a7bb3
to
371b363
Compare
I'm not sure why the compilation fails on Windows. numpy/random/_pcg64.pyx compilation error
|
That's odd, let's see if it's reproducible. I re-triggered the failed build. |
60c2e37
to
6c2bb69
Compare
Rebased to fix conflicts. |
I think B006 should be applied, especially in the public API. However, this is better left to a later PR, as some of the mutable arguments are used on purpose. I would nevertheless recommend fixing all occurrences, including those on purpose, even if the code is more verbose. For example: def action(cache=[]):
... should be changed to: _cache = []
def action(cache=None):
if cache is None:
cache = _cache
... I find the intent is easier to understand. |
Using `hasattr(x, "__call__")` to test if x is callable is unreliable. Use `callable(x)` for consistent results.
Do not perform function call in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable In all these cases, the argument is designed to be persistent.
Do not assert blind exception: `Exception`
Found useless expression. Either assign it to a variable or remove it.
Loop control variable overrides iterable it iterates
abstract base class has no abstract methods or properties
Star-arg unpacking after a keyword argument is strongly discouraged
`except` handlers should only be exception classes or tuples of exception classes
Do not use mutable data structures for `ContextVar` defaults
B909 Mutation to loop iterable during iteration
Co-authored-by: Joren Hammudoglu <jhammudoglu@gmail.com>
Co-authored-by: Joren Hammudoglu <jhammudoglu@gmail.com>
Co-authored-by: Joren Hammudoglu <jhammudoglu@gmail.com>
Co-authored-by: Joren Hammudoglu <jhammudoglu@gmail.com>
The memusage function is only exercised in typing tests.
This reverts commit 371b363.
Thanks Dimitri! |
No description provided.