Skip to content

Commit

Permalink
remove continue usage
Browse files Browse the repository at this point in the history
  • Loading branch information
rtpg committed Jun 18, 2024
1 parent 1e70249 commit e4baf49
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions taggit/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,9 @@ def _to_tag_model_instances(self, tags, tag_kwargs):
seen_tags = set()
for t in tags:
if isinstance(t, self.through.tag_model()):
if t in seen_tags:
continue
seen_tags.add(t)
result.append(t)
if t not in seen_tags:
seen_tags.add(t)
result.append(t)
elif isinstance(t, str):
# we are using a string, so either the tag exists (and we have the lookup)
# or we need to create the value
Expand All @@ -278,11 +277,9 @@ def _to_tag_model_instances(self, tags, tag_kwargs):

# confirm if we've seen it or not (this is where case insensitivity comes
# into play)
if existing_tag in seen_tags:
continue

seen_tags.add(existing_tag)
result.append(existing_tag)
if existing_tag not in seen_tags:
seen_tags.add(existing_tag)
result.append(existing_tag)
else:
raise ValueError(
"Cannot add {} ({}). Expected {} or str.".format(
Expand Down

0 comments on commit e4baf49

Please sign in to comment.