def u(string): """ This is a unicode() wrapper since u'string' is a Python3 compiler error. """ if is_python3(): return string return unicode(string, encoding='utf-8', errors='strict')
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import re from difflib import SequenceMatcher from sys import stderr from autojump_utils import is_python3 from autojump_utils import last if is_python3(): # pragma: no cover ifilter = filter imap = map os.getcwdu = os.getcwd else: from itertools import ifilter from itertools import imap def match_anywhere(needles, haystack, ignore_case=False): """ Matches needles anywhere in the path as long as they're in the same (but not necessary consecutive) order. For example: needles = ['foo', 'baz'] regex needle = r'.*foo.*baz.*' haystack = [ (path='/foo/bar/baz', weight=10), (path='/baz/foo/bar', weight=10), (path='/foo/baz', weight=10),
def entriefy(data): """Converts a dictionary into an iterator of entries.""" convert = lambda tup: Entry(*tup) if is_python3(): return map(convert, data.items()) return imap(convert, data.iteritems())
from autojump_utils import encode_local from autojump_utils import first from autojump_utils import get_tab_entry_info from autojump_utils import has_uppercase from autojump_utils import in_bash from autojump_utils import is_python3 from autojump_utils import last from autojump_utils import sanitize from autojump_utils import second from autojump_utils import surround_quotes from autojump_utils import take from autojump_utils import unico sys.path.append(os.path.join(os.getcwd(), 'bin')) # noqa if is_python3(): os.getcwdu = os.getcwd xrange = range def u(string): """ This is a unicode() wrapper since u'string' is a Python3 compiler error. """ if is_python3(): return string return unicode(string, encoding='utf-8', errors='strict') # strings @pytest.mark.skipif(is_python3(), reason='Unicode sucks.')
import autojump_utils from autojump_utils import encode_local from autojump_utils import first from autojump_utils import get_tab_entry_info from autojump_utils import has_uppercase from autojump_utils import in_bash from autojump_utils import is_python3 from autojump_utils import last from autojump_utils import sanitize from autojump_utils import second from autojump_utils import surround_quotes from autojump_utils import take from autojump_utils import unico if is_python3(): os.getcwdu = os.getcwd xrange = range def u(string): """ This is a unicode() wrapper since u'string' is a Python3 compiler error. """ if is_python3(): return string return unicode(string, encoding='utf-8', errors='strict') # strings @pytest.mark.skipif(is_python3(), reason="Unicode sucks.")
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import re from difflib import SequenceMatcher from autojump_utils import is_python3 from autojump_utils import last if is_python3(): # pragma: no cover ifilter = filter imap = map os.getcwdu = os.getcwd else: from itertools import ifilter from itertools import imap def match_anywhere(needles, haystack, ignore_case=False): """ Matches needles anywhere in the path as long as they're in the same (but not necessary consecutive) order. For example: needles = ['foo', 'baz'] regex needle = r'.*foo.*baz.*' haystack = [ (path='/foo/bar/baz', weight=10), (path='/baz/foo/bar', weight=10), (path='/foo/baz', weight=10),