From c8f3d99eab089d337e5fdcb8ff39efd6ab1aa5e9 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 24 May 2020 13:14:33 +0200 Subject: Consistently use set/frozenset for tags. --- alot/commands/thread.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'alot/commands/thread.py') 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) -- cgit v1.2.3