Consider merging collapsible if statements
69 elif tok == SUBPATTERN:
70 val = (*val[0:3], create_subpattern(_simplify_sre_list(val[3])))
71
72 elif tok == IN: 73 if data is True:
74 tok, val = ANY, None
75
Description
Nested if
statements can be collapsed into a single if
statement by separating their condition using and
operator.
Merging collapsible if
statements increases the code's readability.
Bad practice
if condition1:
if condition2:
dosomething()
Preferred
if condition1 and condition2:
dosomething()
Exception:
DeepSource will not raise this issue when the nested if
statements have comments in between them, as it could be explaining why the nested if
is in place.