ch01-12: clean up by @eumiro

This commit is contained in:
Luciano Ramalho
2021-02-14 20:28:07 -03:00
parent 584a7f21ca
commit 03ace4f4ae
33 changed files with 1383 additions and 86 deletions

View File

@@ -15,7 +15,7 @@ with open(sys.argv[1], encoding='utf-8') as fp:
for line_no, line in enumerate(fp, 1):
for match in WORD_RE.finditer(line):
word = match.group()
column_no = match.start()+1
column_no = match.start() + 1
location = (line_no, column_no)
# this is ugly; coded like this to make a point
occurrences = index.get(word, []) # <1>

View File

@@ -16,7 +16,7 @@ with open(sys.argv[1], encoding='utf-8') as fp:
for line_no, line in enumerate(fp, 1):
for match in WORD_RE.finditer(line):
word = match.group()
column_no = match.start() + 1
column_no = match.start()+1
location = (line_no, column_no)
index[word].append(location) # <2>

View File

@@ -56,7 +56,7 @@ class TransformDict(MutableMapping):
@property
def transform_func(self):
"""This TransformDict's transformation function"""
"""This is TransformDict's transformation function"""
return self._transform
# Minimum set of methods required for MutableMapping