1
0
mirror of https://github.com/wting/autojump synced 2026-03-02 03:49:26 +00:00

whitespace fixes

This commit is contained in:
William Ting
2014-01-18 09:08:36 -06:00
parent 6e0e3741a5
commit 5f9ac19afd
4 changed files with 24 additions and 10 deletions

View File

@@ -263,10 +263,14 @@ def match_consecutive(needles, haystack, ignore_case=False):
(path="/moo/foo/baz", weight=10),
(path="/foo/baz", weight=10)]
"""
sep = os.sep.replace('\\','\\\\')
if is_windows():
# The normal \\ separator needs to be escaped again for use in regex.
sep = '\\\\'
else:
sep = os.sep
regex_no_sep = '[^' + sep + ']*'
regex_one_sep = regex_no_sep + sep + regex_no_sep
regex_no_sep_end = regex_no_sep + '$'
regex_one_sep = regex_no_sep + sep + regex_no_sep
# can't use compiled regex because of flags
regex_needle = regex_one_sep.join(needles) + regex_no_sep_end
regex_flags = re.IGNORECASE | re.UNICODE if ignore_case else re.UNICODE