about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authortoonn <toonn@toonn.io>2020-01-15 21:47:24 +0100
committertoonn <toonn@toonn.io>2020-07-05 15:23:42 +0200
commitbe73715d069cfb31d500569c9fc301fbaef8cdbf (patch)
tree1fa512e7eaeb065b3fde0bcd0e594ed0f6cf4968
parent7e85b38d8f777dfaaaec975eb2ed617634574e72 (diff)
downloadranger-be73715d069cfb31d500569c9fc301fbaef8cdbf.tar.gz
Replace if statement with dict.get with default
-rw-r--r--ranger/container/tags.py10
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