summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lepus.uberspace.de>2014-12-10 03:48:17 +0100
committerhut <hut@lepus.uberspace.de>2014-12-10 03:49:57 +0100
commitc7f282dced008ee5d002afee58fa7e055d924113 (patch)
tree908819135082c6163867734260218dabba3de74f /ranger
parent616e1fb8357dab1c588a5507ba183206755e5a74 (diff)
downloadranger-c7f282dced008ee5d002afee58fa7e055d924113.tar.gz
container.directory: more efficient filtering
Diffstat (limited to 'ranger')
-rw-r--r--ranger/container/directory.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/ranger/container/directory.py b/ranger/container/directory.py
index 6a8bd9ea..6b9f054e 100644
--- a/ranger/container/directory.py
+++ b/ranger/container/directory.py
@@ -198,17 +198,18 @@ class Directory(FileSystemObject, Accumulator, Loadable):
 
         self.last_update_time = time()
 
+        filters = []
+
         if not self.settings.show_hidden and self.settings.hidden_filter:
             hidden_filter = re.compile(self.settings.hidden_filter)
-        else:
-            hidden_filter = None
-
-        filters = [(lambda file: not hidden_filter.search(file.basename)) if hidden_filter else None,
-                   (lambda file: self.filter.search(file.basename)) if self.filter else None,
-                   self.inode_type_filter]
-
+            filters.append(lambda file: not hidden_filter.search(file.basename))
+        if self.filter:
+            filters.append(lambda file: self.filter.search(file.basename))
+        if self.inode_type_filter:
+            filters.append(self.inode_type_filter)
         if self.temporary_filter:
             filters.append(lambda file: self.temporary_filter.search(file.basename))
+
         self.files = [f for f in self.files_all if accept_file(f, filters)]
         self.move_to_obj(self.pointed_obj)