From be73715d069cfb31d500569c9fc301fbaef8cdbf Mon Sep 17 00:00:00 2001 From: toonn Date: Wed, 15 Jan 2020 21:47:24 +0100 Subject: Replace if statement with dict.get with default --- ranger/container/tags.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/ranger/container/tags.py b/ranger/container/tags.py index ed5b876a..50d5ff72 100644 --- a/ranger/container/tags.py +++ b/ranger/container/tags.py @@ -29,10 +29,7 @@ class Tags(object): return item in self.tags def add(self, *items, **others): - if 'tag' in others: - tag = others['tag'] - else: - tag = self.default_tag + tag = others.get('tag', self.default_tag) self.sync() for item in items: self.tags[item] = tag @@ -48,10 +45,7 @@ class Tags(object): self.dump() def toggle(self, *items, **others): - if 'tag' in others: - tag = others['tag'] - else: - tag = self.default_tag + tag = others.get('tag', self.default_tag) tag = str(tag) if tag not in ALLOWED_KEYS: return -- cgit 1.4.1-2-gfad0