flake8-simplify
flake8-simplify copied to clipboard
[Adjust rule] SIM222
Desired change
- Rule(s): SIM222
- Adjustment:
The rule
Use 'True' instead of '... or True'is wrong
Example
'foo' or True gives 'foo' but not True,
1 or Truegives 1 but not True.
'0' or Truegives '0' but not True
whereas
'' or True gives True
0 or True gives True
In general:
x or True can be calculated as
x if bool(x) else True
There's similar removing case to bool problems with some of the other rules, see my comment on https://github.com/MartinThoma/flake8-simplify/issues/3
Just a short heads up: I'm recently spending most of my free time on PyPDF2. I do see those issues, but it might be a while until I work on them.
PRs have a better chance to get merged soon.