diff options
author | Anton Khirnov <anton@khirnov.net> | 2020-05-24 13:14:33 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2020-05-24 14:01:09 +0200 |
commit | c8f3d99eab089d337e5fdcb8ff39efd6ab1aa5e9 (patch) | |
tree | f5e269b6d85d078e0ad43cfde1c36a56ecca0b0e /alot/commands/thread.py | |
parent | b1f6be9d1808406c94c5c033b50abb5f7517e82b (diff) |
Consistently use set/frozenset for tags.
Diffstat (limited to 'alot/commands/thread.py')
-rw-r--r-- | alot/commands/thread.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/alot/commands/thread.py b/alot/commands/thread.py index de948747..1da58560 100644 --- a/alot/commands/thread.py +++ b/alot/commands/thread.py @@ -483,7 +483,6 @@ class EditNewCommand(Command): tags = set(self.message.get_tags()) tags.difference_update({'inbox', 'sent', 'draft', 'killed', 'replied', 'signed', 'encrypted', 'unread', 'attachment'}) - tags = list(tags) # set body text mailcontent = self.message.get_body_text() envelope = Envelope(bodytext=mailcontent, tags=tags) @@ -1078,7 +1077,7 @@ class TagCommand(Command): else: messages = [ui.current_buffer.get_selected_message()] - tags = [t for t in self.tagsstring.split(',') if t] + tags = frozenset(filter(None, self.tagsstring.split(','))) try: for m in messages: if self.action == 'add': @@ -1088,13 +1087,13 @@ class TagCommand(Command): elif self.action == 'remove': m.remove_tags(tags) elif self.action == 'toggle': - to_remove = [] - to_add = [] + to_remove = set() + to_add = () for t in tags: if t in m.get_tags(): - to_remove.append(t) + to_remove.add(t) else: - to_add.append(t) + to_add.add(t) m.remove_tags(to_remove) m.add_tags(to_add) |