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
B008 discourages function calls in default arguments e.g.
deffoo(bar=bar_factory()): ...
This is a pattern commonly used in our codebase, such as inject in the link below. I think we're expecting to continue it even after lazy devices are supported (see #483), so plans would look something like:
defmy_plan(x: Motor=i03.x()): ...
This issue is to discuss whether we should configure our projects to ignore the error and allow this behaviour because we know best, or follow ruff best practices and find another way to inject devices.
I'm going to throw in an early vote for the latter.
our specific use case is the device-singleton one, and the linked ruff page says this: If the use of a singleton is intentional, assign the result call to a module-level variable, and use that variable in the default argument:
which is consistent with how the i22 stopflow plan uses PANDA = inject("panda1")
B008 discourages function calls in default arguments e.g.
This is a pattern commonly used in our codebase, such as
inject
in the link below. I think we're expecting to continue it even after lazy devices are supported (see #483), so plans would look something like:This issue is to discuss whether we should configure our projects to ignore the error and allow this behaviour because we know best, or follow ruff best practices and find another way to inject devices.
I'm going to throw in an early vote for the latter.
Originally posted by @callumforrester in #737 (comment)
The text was updated successfully, but these errors were encountered: