Skip to content

Commit

Permalink
v.0.2
Browse files Browse the repository at this point in the history
search method is now case insensitive
  • Loading branch information
Martin Simon committed Mar 24, 2015
1 parent 55ab396 commit 6ae4c69
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 51 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ DirectMap2M: 8187904 kB
}
```

- Search:
- Search (is case insensitive):

```
>>> mem.search('Swap')
Expand Down
84 changes: 42 additions & 42 deletions STATS
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@

Analyzing: https://github.com/c0ding/hazelnut/blob/master/hazelnut/core.py

Total Lines: 37
Total Lines: 38

Code Lines: 26 (70.2702%)
Blank Lines: 8 (21.6216%)
Code Lines: 28 (73.6842%)
Blank Lines: 9 (23.6842%)

Comment Lines: 3 (8.10810%)
Doc String Lines: 0 (0.0%)
Inline Comments: 1
Doc Strings: 0
Total Comments: 4
Comment Lines: 1 (2.63157%)
Doc String Lines: 0 (0.0%)
Inline Comments: 1
Doc Strings: 0
Total Comments: 2

Longest Code Line: 47
Shortest Code Line: 8 [return d]
Longest Code Line: 47
Shortest Code Line: 8 [return d]

Longest Comment Line: 65
Shortest Comment Line: 23 [# -*- coding: utf-8 ...]
Longest Comment Line: 23
Shortest Comment Line: 23 [# -*- coding: utf-8 ...]

Imports: 0
Functions: 6
Classes: 1
If Statements: 0
Try Statements: 0
Except Statements: 0
Print Statements: 0
Assignments: 10
Variables: 9
Imports: 1
Functions: 6
Classes: 1
If Statements: 0
Try Statements: 0
Except Statements: 0
Print Statements: 0
Assignments: 11
Variables: 10


Done analyzing: https://github.com/c0ding/hazelnut/blob/master/hazelnut/core.py
Expand All @@ -36,32 +36,32 @@

Analyzing: https://github.com/c0ding/hazelnut/blob/master/hazelnut/__init__.py

Total Lines: 10
Total Lines: 10

Code Lines: 7 (70.0%)
Blank Lines: 2 (20.0%)
Code Lines: 7 (70.0%)
Blank Lines: 2 (20.0%)

Comment Lines: 1 (10.0%)
Doc String Lines: 0 (0.0%)
Inline Comments: 1
Doc Strings: 0
Total Comments: 2
Comment Lines: 1 (10.0%)
Doc String Lines: 0 (0.0%)
Inline Comments: 1
Doc Strings: 0
Total Comments: 2

Longest Code Line: 47
Shortest Code Line: 20 [__version__ = '0.1a']
Longest Code Line: 47
Shortest Code Line: 19 [__version__ = '0.2']

Longest Comment Line: 23
Shortest Comment Line: 23 [# -*- coding: utf-8 ...]
Longest Comment Line: 23
Shortest Comment Line: 23 [# -*- coding: utf-8 ...]

Imports: 1
Functions: 0
Classes: 0
If Statements: 0
Try Statements: 0
Except Statements: 0
Print Statements: 0
Assignments: 5
Variables: 5
Imports: 1
Functions: 0
Classes: 0
If Statements: 0
Try Statements: 0
Except Statements: 0
Print Statements: 0
Assignments: 5
Variables: 5


Done analyzing: https://github.com/c0ding/hazelnut/blob/master/hazelnut/__init__.py
Expand Down
2 changes: 1 addition & 1 deletion hazelnut/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
13 changes: 7 additions & 6 deletions hazelnut/core.py
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'
Expand All @@ -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
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name = 'hazelnut',
version = '0.1',
version = '0.2',
url = 'https://github.com/c0ding/hazelnut',
download_url = 'https://github.com/c0ding/hazelnut/archive/master.zip',
author = 'Martin Simon',
Expand Down

0 comments on commit 6ae4c69

Please sign in to comment.