class X:
val: str
def __bool__(self) -> bool:
return self.val != ""
$ ruff check test.py --select=PLC1901
test.py:5:28: PLC1901 `self.val != ""` can be simplified to `self.val` as an empty string is falsey
Found 1 error.
Trying to correct this to self.val will lead to an error:
TypeError: __bool__ should return bool, returned str