Replies: 1 comment
-
There's no configuration today to mark a type as immutable. Ruff uses an internal list. The only configuration option that exists today is to configure functions that are allowed to be called in a default position. https://docs.astral.sh/ruff/settings/#lintflake8-bugbear But that might not be feasible for you, depending on how youw create |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
function-call-in-default-argument states that "Parameters with immutable type annotations will be ignored by this rule".
How can I add immutable type annotations to a parameter?
In the example below, the warning is triggered for karg (a KeyView) and for iarg (a SupportsInt), but for some reason not for sarg (a Sequence). I'd like to tell ruff that karg and sarg are immutable (ideally, I'd like to tell ruff that KeysView and SupportsInt are in general immutable).
Warnings:
my_fun_1
in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variablemy_fun_2
in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variableBeta Was this translation helpful? Give feedback.
All reactions