From fb6624215ada772cc09ac549ab42f56f55453b8d Mon Sep 17 00:00:00 2001 From: cclauss Date: Wed, 25 Apr 2018 19:19:04 -0600 Subject: [PATCH] Fix coding errors (#149) --- solutions/system_design/mint/mint_mapreduce.py | 2 +- solutions/system_design/pastebin/pastebin.py | 2 +- solutions/system_design/sales_rank/sales_rank_mapreduce.py | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/solutions/system_design/mint/mint_mapreduce.py b/solutions/system_design/mint/mint_mapreduce.py index 2e8339f8..3dc88558 100644 --- a/solutions/system_design/mint/mint_mapreduce.py +++ b/solutions/system_design/mint/mint_mapreduce.py @@ -35,7 +35,7 @@ class SpendingByCategory(MRJob): 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 diff --git a/solutions/system_design/pastebin/pastebin.py b/solutions/system_design/pastebin/pastebin.py index 7cb1f204..7e8d268a 100644 --- a/solutions/system_design/pastebin/pastebin.py +++ b/solutions/system_design/pastebin/pastebin.py @@ -26,7 +26,7 @@ class HitCounts(MRJob): 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 diff --git a/solutions/system_design/sales_rank/sales_rank_mapreduce.py b/solutions/system_design/sales_rank/sales_rank_mapreduce.py index bbe844b4..6eeeb525 100644 --- a/solutions/system_design/sales_rank/sales_rank_mapreduce.py +++ b/solutions/system_design/sales_rank/sales_rank_mapreduce.py @@ -9,7 +9,7 @@ class SalesRanker(MRJob): """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: @@ -25,7 +25,7 @@ class SalesRanker(MRJob): 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 @@ -74,4 +74,4 @@ class SalesRanker(MRJob): if __name__ == '__main__': - HitCounts.run() + SalesRanker.run()