From 896b1c856225b864b260e5f7e199502087a0f83d Mon Sep 17 00:00:00 2001 From: William Ting Date: Sat, 4 Oct 2014 18:49:05 -0700 Subject: [PATCH] Use ternary. --- bin/autojump | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/bin/autojump b/bin/autojump index 13e8783..b562eec 100755 --- a/bin/autojump +++ b/bin/autojump @@ -272,11 +272,8 @@ def match_consecutive(needles, haystack, ignore_case=False): (path="/moo/foo/baz", weight=10), (path="/foo/baz", weight=10)] """ - if is_windows(): - # The normal \\ separator needs to be escaped again for use in regex. - sep = '\\\\' - else: - sep = os.sep + # The normal \\ separator needs to be escaped again for use in regex. + sep = '\\\\' if is_windows() else os.sep regex_no_sep = '[^' + sep + ']*' regex_no_sep_end = regex_no_sep + '$' regex_one_sep = regex_no_sep + sep + regex_no_sep