-
Notifications
You must be signed in to change notification settings - Fork 190
MAINT: Enforce ruff/pyupgrade rules (UP) #1501
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
base: main
Are you sure you want to change the base?
MAINT: Enforce ruff/pyupgrade rules (UP) #1501
Conversation
@@ -23,8 +23,7 @@ def benchmark_param_iter(benchmark): | |||
if not benchmark['params']: | |||
yield None, () | |||
else: | |||
for item in enumerate(itertools.product(*benchmark['params'])): | |||
yield item | |||
yield from enumerate(itertools.product(*benchmark['params'])) |
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.
Hmm, is there a way to leave this? The implicit for loop is tricky here.
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.
Do you mean this change breaks the code? Both version should be functionally equivalent; yield from
is more efficient because the loop is implemented inside Python itself.
I can add noqa: UP028
if you insist on keeping the loop.
@@ -819,8 +818,7 @@ def iter_subclasses(cls): | |||
""" | |||
for x in cls.__subclasses__(): | |||
yield x | |||
for y in iter_subclasses(x): | |||
yield y | |||
yield from iter_subclasses(x) |
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.
Is there a way to leave the explicit loop?
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 can add noqa: UP028
as well.
But what's wrong with yield from
?
UP008 Use `super()` instead of `super(__class__, self)`
UP028 Replace `yield` over `for` loop with `yield from`
UP030 Use implicit references for positional format fields
UP031 Use format specifiers instead of percent format
UP031 Use format specifiers instead of percent format
UP032 Use f-string instead of `format` call
UP032 Use f-string instead of `format` call
UP036 Version block is outdated for minimum Python version
The CI failure seems unrelated:
Maybe related to:
asv/.github/workflows/ci_win.yml
Line 36 in d5f068b
asv/.github/workflows/triggered.yml
Line 60 in d5f068b
PyPy runs might need a higher timeout than
300
.