1
0
mirror of https://github.com/wting/autojump synced 2024-10-27 20:34:07 +00:00

remove nested filters

This commit is contained in:
William Ting 2014-03-04 22:50:31 -06:00
parent 255f548b4a
commit 12a4667824

View File

@ -162,6 +162,7 @@ def detect_smartcase(needles):
def find_matches(entries, needles, check_entries=True):
"""Return an iterator to matching entries."""
# TODO(ting|2014-02-18): replace assertion with test
assert isinstance(needles, list), "Needles must be a list."
ignore_case = detect_smartcase(needles)
@ -185,16 +186,14 @@ def find_matches(entries, needles, check_entries=True):
reverse=True)
return ifilter(
not_cwd,
ifilter(
exists,
chain(
match_consecutive(needles, data, ignore_case),
match_fuzzy(needles, data, ignore_case),
match_anywhere(needles, data, ignore_case),
# default return value so calling shell functions have an
# argument to `cd` to
[Entry('.', 0)])))
lambda entry: not_cwd(entry) and exists(entry),
chain(
match_consecutive(needles, data, ignore_case),
match_fuzzy(needles, data, ignore_case),
match_anywhere(needles, data, ignore_case),
# default return value so calling shell functions have an
# argument to `cd` to
[Entry('.', 0)]))
def handle_tab_completion(needle, entries):