Skip to content

Commit 8fe3b0f

Browse files
authored
Merge pull request #3240 from learningequality/deepsource-fix-72ad7193
Refactor unnecessary `else` / `elif` when `if` block has a `continue` statement
2 parents ff46849 + c1e873b commit 8fe3b0f

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

contentcuration/contentcuration/models.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,8 +606,7 @@ def generate_new_token(cls):
606606
token = proquint.generate()
607607
if SecretToken.exists(token):
608608
continue
609-
else:
610-
break
609+
break
611610
# after TRIALS attempts and we didn't get a unique token,
612611
# just raise an error.
613612
# See https://stackoverflow.com/a/9980160 on what for-else loop does.

deploy/probers/postmark_api_probe.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,12 @@ def do_probe(self):
2727

2828
if passing:
2929
continue
30-
else:
31-
raise Exception("Postmark's `%s` service has status %s, but we require one of the following: %s" % (
32-
service['name'],
33-
service['status'],
34-
allowed_statuses
35-
)
30+
raise Exception("Postmark's `%s` service has status %s, but we require one of the following: %s" % (
31+
service['name'],
32+
service['status'],
33+
allowed_statuses
3634
)
35+
)
3736

3837

3938
if __name__ == "__main__":

0 commit comments

Comments
 (0)