Skip to content

Commit

Permalink
Formatted code
Browse files Browse the repository at this point in the history
  • Loading branch information
derphilipp committed Feb 1, 2016
1 parent 6c14cb0 commit 4281964
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pwgrep/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def run(args):
parser_result = commandline_parser.CommandLineParser().parse(args)
grepper = process.Grepper(parser_result)

#printer = ResultPrinter(parser_result)
# printer = ResultPrinter(parser_result)

any_match = False
if not parser_result.options.PATH:
Expand Down
6 changes: 4 additions & 2 deletions pwgrep/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from pwgrep import search_result

import sys
import re


class SearchFile(object):
Expand All @@ -12,7 +13,7 @@ class SearchFile(object):

class RegexSearcher(object):
def __init__(self, regex):
self.regex_txt= re.compile(regex)
self.regex_txt = re.compile(regex)

def search_line_txt(self, line):
result = []
Expand All @@ -36,7 +37,8 @@ def __init__(self, regexes, invert_match=False):
def __iter__(self):
for line_nr, line in enumerate(sys.stdin):
if self.invert_match != bool(self.regexes.regex_txt.search(line)):
yield search_result.SearchResult(line_number=line_nr, match_text=line)
yield search_result.SearchResult(line_number=line_nr,
match_text=line)


class Grepper(object):
Expand Down
4 changes: 2 additions & 2 deletions pwgrep/search_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def search_in_file(filename, regexes, invert_match, no_filename,
yield filename
else:
for line_nr, line in results_in_text_file(filename,
regexes.regex_txt,
invert_match):
regexes.regex_txt,
invert_match):
# match_occurred = True
printer_helper.print_match(filename, line, regexes.regex_txt,
no_filename,
Expand Down
11 changes: 5 additions & 6 deletions pwgrep/search_result.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
class SearchResult(object):
def __init__(self,
def __init__(self,
line_number=None,
before_match_text = None,
match_text=None,
after_match_text = None,
filename = None
before_match_text=None,
match_text=None,
after_match_text=None,
filename=None
):

self.line_number = line_number
self.before_match_text = before_match_text
self.match_text = match_text
self.after_match_text = after_match_text
self.filename = filename

0 comments on commit 4281964

Please sign in to comment.