-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
search method is now case insensitive
- Loading branch information
Martin Simon
committed
Mar 24, 2015
1 parent
55ab396
commit 6ae4c69
Showing
5 changed files
with
52 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
# -*- coding: utf-8 -*- | ||
|
||
__title__ = 'hazelnut' | ||
__version__ = '0.1' | ||
__version__ = '0.2' | ||
__author__ = 'Martin Simon <[email protected]>' | ||
__repo__ = 'https://github.com/c0ding/hazelnut' | ||
__license__ = 'Apache v2.0 License' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
import re | ||
|
||
__title__ = 'hazelnut' | ||
__version__ = '0.1' | ||
__version__ = '0.2' | ||
__author__ = 'Martin Simon <[email protected]>' | ||
__repo__ = 'https://github.com/c0ding/hazelnut' | ||
__license__ = 'Apache v2.0 License' | ||
|
@@ -29,9 +31,8 @@ def dict(self): | |
d = dict(x.strip().split(None, 1) for x in f) | ||
return d | ||
|
||
def search(self, inp): | ||
def search(self, user_inp): | ||
with open(self.get_path(), 'r') as f: | ||
match = [s for s in f if inp in s] | ||
# will have to figure out a way to make this case insensitive. | ||
# mem.search('Swap') and mem.search('swap') should both match. | ||
return match | ||
matcher = re.compile(user_inp, re.IGNORECASE) | ||
match = filter(matcher.match, f) | ||
return match |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters