@@ -54,7 +54,7 @@ def is_binary_string(bytes):
5454 """
5555 nontext = bytes .translate (ALLBYTES , TEXTCHARS )
5656 return bool (nontext )
57-
57+
5858def get_line_offsets (block ):
5959 """ Compute the list of offsets in DataBlock 'block' which correspond to
6060 the beginnings of new lines.
@@ -80,18 +80,18 @@ def get_line_offsets(block):
8080 # Keep track of the count of lines within the "current block"
8181 if next_newline >= block .start and next_newline < block .end :
8282 line_count += 1
83-
83+
8484def colorize (s , fg = None , bg = None , bold = False , underline = False , reverse = False ):
8585 """ Wraps a string with ANSI color escape sequences corresponding to the
8686 style parameters given.
87-
87+
8888 All of the color and style parameters are optional.
89-
89+
9090 Parameters
9191 ----------
9292 s : str
9393 fg : str
94- Foreground color of the text. One of (black, red, green, yellow, blue,
94+ Foreground color of the text. One of (black, red, green, yellow, blue,
9595 magenta, cyan, white, default)
9696 bg : str
9797 Background color of the text. Color choices are the same as for fg.
@@ -106,7 +106,7 @@ def colorize(s, fg=None, bg=None, bold=False, underline=False, reverse=False):
106106 -------
107107 A string with embedded color escape sequences.
108108 """
109-
109+
110110 style_fragments = []
111111 if fg in COLOR_TABLE :
112112 # Foreground colors go from 30-39
@@ -207,7 +207,7 @@ def __init__(self, regex, options=None):
207207 def read_block_with_context (self , prev , fp , fp_size ):
208208 """ Read a block of data from the file, along with some surrounding
209209 context.
210-
210+
211211 Parameters
212212 ----------
213213 prev : DataBlock, or None
@@ -216,11 +216,11 @@ def read_block_with_context(self, prev, fp, fp_size):
216216
217217 fp : filelike object
218218 The source of block data.
219-
219+
220220 fp_size : int or None
221221 Size of the file in bytes, or None if the size could not be
222222 determined.
223-
223+
224224 Returns
225225 -------
226226 A DataBlock representing the "current" block along with context.
@@ -364,7 +364,7 @@ def do_grep_block(self, block, line_num_offset):
364364 block_context = []
365365 line_offsets = None
366366 line_count = None
367-
367+
368368 def build_match_context (match ):
369369 match_line_num = bisect .bisect (line_offsets , match .start () + block .start ) - 1
370370 before_count = min (before , match_line_num )
@@ -457,7 +457,7 @@ def report(self, context_lines, filename=None):
457457 color_substring = colorize (old_substring , ** style )
458458 line = line [:start ] + color_substring + line [end :]
459459 total_offset += len (color_substring ) - len (old_substring )
460-
460+
461461 ns = dict (
462462 lineno = i + 1 ,
463463 sep = {PRE : '-' , POST : '+' , MATCH : ':' }[kind ],
@@ -553,7 +553,7 @@ def __init__(self, skip_hidden_dirs=False, skip_hidden_files=False,
553553 self .skip_exts_simple .add (ext )
554554 else :
555555 self .skip_exts_endswith .append (ext )
556-
556+
557557 self .skip_symlink_dirs = skip_symlink_dirs
558558 self .skip_symlink_files = skip_symlink_files
559559 self .binary_bytes = binary_bytes
@@ -632,8 +632,8 @@ def recognize(self, filename):
632632
633633 'text' :
634634 It should should be grepped for the pattern and the matching
635- lines displayed.
636- 'binary' :
635+ lines displayed.
636+ 'binary' :
637637 The file is binary and should be either ignored or grepped
638638 without displaying the matching lines depending on the
639639 configuration.
@@ -673,12 +673,12 @@ def recognize(self, filename):
673673 return 'skip'
674674 except OSError :
675675 return 'unreadable'
676-
676+
677677 def recognize_directory (self , filename ):
678678 """ Determine what to do with a directory.
679679 """
680680 basename = os .path .split (filename )[- 1 ]
681- if (self .skip_hidden_dirs and basename .startswith ('.' ) and
681+ if (self .skip_hidden_dirs and basename .startswith ('.' ) and
682682 basename not in ('.' , '..' )):
683683 return 'skip'
684684 if self .skip_symlink_dirs and os .path .islink (filename ):
@@ -697,7 +697,7 @@ def recognize_file(self, filename):
697697 return 'skip'
698698 if self .skip_symlink_files and os .path .islink (filename ):
699699 return 'link'
700-
700+
701701 filename_nc = os .path .normcase (filename )
702702 ext = os .path .splitext (filename_nc )[1 ]
703703 if ext in self .skip_exts_simple or ext .startswith ('.~' ):
@@ -776,10 +776,10 @@ def get_grin_arg_parser(parser=None):
776776 parser .add_argument ('-N' , '--no-line-number' , action = 'store_false' ,
777777 dest = 'show_line_numbers' , help = "do not show the line numbers" )
778778 parser .add_argument ('-H' , '--with-filename' , action = 'store_true' ,
779- dest = 'show_filename' , default = True ,
779+ dest = 'show_filename' , default = True ,
780780 help = "show the filenames of files that match [default]" )
781781 parser .add_argument ('--without-filename' , action = 'store_false' ,
782- dest = 'show_filename' ,
782+ dest = 'show_filename' ,
783783 help = "do not show the filenames of files that match" )
784784 parser .add_argument ('--emacs' , action = 'store_true' ,
785785 dest = 'show_emacs' ,
@@ -1043,7 +1043,7 @@ def print_line(filename):
10431043 print filename
10441044
10451045def print_null (filename ):
1046- # Note that the final filename will have a trailing NUL, just like
1046+ # Note that the final filename will have a trailing NUL, just like
10471047 # "find -print0" does.
10481048 sys .stdout .write (filename )
10491049 sys .stdout .write ('\0 ' )
0 commit comments