diff options
author | hut <hut@lepus.uberspace.de> | 2014-12-10 15:25:33 +0100 |
---|---|---|
committer | hut <hut@lepus.uberspace.de> | 2014-12-10 15:25:42 +0100 |
commit | 005f82f0b183ec7c562362f992ee8c514c2d593e (patch) | |
tree | c803a919bb0408ec4f7ac6c2253fd2897d1be475 /ranger | |
parent | c7f282dced008ee5d002afee58fa7e055d924113 (diff) | |
download | ranger-005f82f0b183ec7c562362f992ee8c514c2d593e.tar.gz |
container.directory: filtering optimizations
local variables have a better access time
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/container/directory.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/ranger/container/directory.py b/ranger/container/directory.py index 6b9f054e..5b32300a 100644 --- a/ranger/container/directory.py +++ b/ranger/container/directory.py @@ -202,13 +202,16 @@ class Directory(FileSystemObject, Accumulator, Loadable): if not self.settings.show_hidden and self.settings.hidden_filter: hidden_filter = re.compile(self.settings.hidden_filter) - filters.append(lambda file: not hidden_filter.search(file.basename)) + hidden_filter_search = hidden_filter.search + filters.append(lambda file: not hidden_filter_search(file.basename)) if self.filter: - filters.append(lambda file: self.filter.search(file.basename)) + filter_search = self.filter.search + filters.append(lambda file: 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)) + temporary_filter_search = self.temporary_filter_search + filters.append(lambda file: 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) |