if
statements can be merged PTC-W0048615 "not of type 'download'"
616 ).format(item=item_id, bundle=bundle.name))
617
618 if 'download_timeout' in attributes:619 if (
620 not isinstance(attributes['download_timeout'], float)
621 or attributes['download_timeout'] <= 0.0
93
94 @classmethod
95 def validate_attributes(cls, bundle, item_id, attributes):
96 if not attributes.get('delete', False): 97 if attributes.get('password') is None and attributes.get('password_hash') is None:
98 raise BundleError(_(
99 "expected either 'password' or 'password_hash' on {item} in bundle '{bundle}'"
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.
if condition1:
if condition2:
dosomething()
if condition1 and condition2:
dosomething()
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.