Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix coding errors #149

Merged
merged 4 commits into from
Apr 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()