-
Notifications
You must be signed in to change notification settings - Fork 23
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
chore: fix pylint message use-set-for-membership #882
chore: fix pylint message use-set-for-membership #882
Conversation
I wonder if this check flags an error on cases where you are performing a membership test in cases like this?
Or does it only flag cases where we perform membership test on "statically-defined" lists
|
Why don’t you just try? 😉 @tromai, however, the code in your examples above are not membership tests: a
Note also that these are not “errors” per se; the optional pylint checks are mostly recommendations for and improvements of code quality and performance.
|
04e4b75
to
e0fd295
Compare
Signed-off-by: Jens Troeger <[email protected]>
e0fd295
to
10140a7
Compare
Ah, thanks for pointing it out. I made some mistakes when coming up with the examples, please see the revised version here: a: dict[str, str] = get_some_dictionary(...)
return if "key" in a.keys()
# OR: return if "key" in a import glob
return "boo.txt" in glob.iglob("*.txt") a: list[str] = get_some_list(...)
return "boo" in a b = [1,2]
c: list[int] = get_int_list(...)
d = [4,3]
a = [b, c, d]
c in a
I should have been a bit more explicit in my wordings. I meant whether pylint would exit with an error/non-zero status code for those cases, but not about the content of the checks. |
Signed-off-by: Jens Troeger <[email protected]>
This change is part of issue #876 and addresses the
use-set-for-membership
check messages.I’ll add the appropriate configuration to pyproject.toml in a separate PR later.