diff options
author | toonn <toonn@toonn.io> | 2020-01-15 21:47:24 +0100 |
---|---|---|
committer | toonn <toonn@toonn.io> | 2020-07-05 15:23:42 +0200 |
commit | be73715d069cfb31d500569c9fc301fbaef8cdbf (patch) | |
tree | 1fa512e7eaeb065b3fde0bcd0e594ed0f6cf4968 | |
parent | 7e85b38d8f777dfaaaec975eb2ed617634574e72 (diff) | |
download | ranger-be73715d069cfb31d500569c9fc301fbaef8cdbf.tar.gz |
Replace if statement with dict.get with default
-rw-r--r-- | ranger/container/tags.py | 10 |
1 files 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 |