Skip to content

Commit

Permalink
Fix coding errors (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
cclauss authored and donnemartin committed Apr 26, 2018
1 parent bb49172 commit fb66242
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion solutions/system_design/mint/mint_mapreduce.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def mapper(self, _, line):
if period == self.current_year_month():
yield (period, category), amount

def reducer(self, key, value):
def reducer(self, key, values):
"""Sum values for each key.
(2016-01, shopping), 125
Expand Down
2 changes: 1 addition & 1 deletion solutions/system_design/pastebin/pastebin.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def mapper(self, _, line):
period = self.extract_year_month(line)
yield (period, url), 1

def reducer(self, key, value):
def reducer(self, key, values):
"""Sum values for each key.
(2016-01, url0), 2
Expand Down
6 changes: 3 additions & 3 deletions solutions/system_design/sales_rank/sales_rank_mapreduce.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def within_past_week(self, timestamp):
"""Return True if timestamp is within past week, False otherwise."""
...

def mapper(self, _ line):
def mapper(self, _, line):
"""Parse each log line, extract and transform relevant lines.
Emit key value pairs of the form:
Expand All @@ -25,7 +25,7 @@ def mapper(self, _ line):
if self.within_past_week(timestamp):
yield (category, product_id), quantity

def reducer(self, key, value):
def reducer(self, key, values):
"""Sum values for each key.
(foo, p1), 2
Expand Down Expand Up @@ -74,4 +74,4 @@ def steps(self):


if __name__ == '__main__':
HitCounts.run()
SalesRanker.run()

0 comments on commit fb66242

Please sign in to comment.