You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- for p in self.predicates:
- if not (yield p.is_satisfied.asynq()): # noqlint
- return False
- return True
+ return all((yield p.is_satisfied.asynq()) for p in self.predicates)
This code is using the asynq framework, causing the unusual yield. Ruff should not apply this fix if there is a yield in the condition, as the yield will end up in the inner generator expression, where it is a SyntaxError in recent Python versions.
While looking at the code I noticed that Ruff already protects against this class of bug with await, but the protection is slightly too eager: it applies if there is an await in the for loop's iter expression. However, the iter expression of a genexp is evaluated in the outer scope, so it's fine if there's an await there.
I will submit a PR soon with a proposed fix.
Also worth noting that Ruff ate the comment here. That feels like a bug too, but it's probably more involved to fix so I'll skip it for now.
The text was updated successfully, but these errors were encountered:
Using SIM110 I ran into this change:
This code is using the asynq framework, causing the unusual yield. Ruff should not apply this fix if there is a
yield
in the condition, as theyield
will end up in the inner generator expression, where it is a SyntaxError in recent Python versions.While looking at the code I noticed that Ruff already protects against this class of bug with
await
, but the protection is slightly too eager: it applies if there is anawait
in the for loop's iter expression. However, the iter expression of a genexp is evaluated in the outer scope, so it's fine if there's anawait
there.I will submit a PR soon with a proposed fix.
Also worth noting that Ruff ate the comment here. That feels like a bug too, but it's probably more involved to fix so I'll skip it for now.
The text was updated successfully, but these errors were encountered: