[X] Have you checked to see if your issue still exists on the master branch? See the docs for instructions on how to setup a local build of Refurb.
[X] Have you looked at the open/closed issues to see if anyone has already reported your issue?
The Bug
I am upstreaming this issue from ruff (https://github.com/astral-sh/ruff/issues/9191), because I did not see any special handling for the operator.contains operand and the test case in this repo is also wrong.
f = lambda a, b: a in b
should be replaced by operator.contains according to rule 118
This code snippet will show you that the operands are indeed reversed.
import functools
import operator
f = lambda a, b: a in b
print(functools.reduce(f, ["str", {"str"}]))
print(functools.reduce(operator.contains, ["str", {"str"}]))
Version Info
Technically from RUFF, but it's present on master.
Has your issue already been fixed?
master
branch? See the docs for instructions on how to setup a local build of Refurb.The Bug
I am upstreaming this issue from ruff (https://github.com/astral-sh/ruff/issues/9191), because I did not see any special handling for the
operator.contains
operand and the test case in this repo is also wrong.should be replaced by
operator.contains
according to rule 118However, according to the documentation contains is actually equivalent to
b in a
!This code snippet will show you that the operands are indeed reversed.
Version Info
Python Version
3.10
Config File
Extra Info
None