From 62e25927fc0b9cd1d6435ad674a3c1c3e248ba22 Mon Sep 17 00:00:00 2001 From: kik-kik Date: Mon, 8 Aug 2022 12:08:09 +0200 Subject: [PATCH 1/2] fixed flake8 errors for desktop-mobile-mau-2020 --- .../desktop_mau/desktop_mau_dau.py | 9 +++++---- jobs/desktop-mobile-mau-2020/mobile_mau/mobile_mau.py | 9 ++++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/jobs/desktop-mobile-mau-2020/desktop_mau/desktop_mau_dau.py b/jobs/desktop-mobile-mau-2020/desktop_mau/desktop_mau_dau.py index 0438a3cf..ff018b33 100644 --- a/jobs/desktop-mobile-mau-2020/desktop_mau/desktop_mau_dau.py +++ b/jobs/desktop-mobile-mau-2020/desktop_mau/desktop_mau_dau.py @@ -27,10 +27,10 @@ DESKTOP_QUERY = (ROOT_DIR / "mau_dau.sql").read_text() DESKTOP_USER_STATE_QUERY = """ -SELECT +SELECT * -FROM - `moz-fx-data-derived-datasets.analysis.xluo_kpi_plot_country_new_or_rescurrected_dau` +FROM + `moz-fx-data-derived-datasets.analysis.xluo_kpi_plot_country_new_or_rescurrected_dau` """ @@ -454,7 +454,8 @@ def plot_dau_mau_ratio(desktop_data): fontdict={"fontsize": 18, "color": "black"}, ) - # axs[1].plot.area([ind_dat["country_x"].isin(country_list)]["date", "country_x", "pcnt"], subplots=True) + # axs[1].plot.area([ind_dat["country_x"]\ + # .isin(country_list)]["date", "country_x", "pcnt"], subplots=True) dat2 = ind_dat[ind_dat["country_x"].isin(country_list)][ ["date", "country_x", "pcnt_MAU"] ].pivot(index="date", columns="country_x", values="pcnt_MAU") diff --git a/jobs/desktop-mobile-mau-2020/mobile_mau/mobile_mau.py b/jobs/desktop-mobile-mau-2020/mobile_mau/mobile_mau.py index 9e67c4be..0efd1d38 100644 --- a/jobs/desktop-mobile-mau-2020/mobile_mau/mobile_mau.py +++ b/jobs/desktop-mobile-mau-2020/mobile_mau/mobile_mau.py @@ -57,7 +57,7 @@ def create_table(template, platform, actual, forecast): - 1 ) - data_end_date = actual["date"].max().date() + # data_end_date = actual["date"].max().date() return template.render( platform=platform, @@ -84,7 +84,8 @@ def create_table(template, platform, actual, forecast): def create_plot(platform, y_min, y_max, actuals, forecast, plot_start_date, slice_name): """ - Display a plot given a platform (each mobile product), data for actuals and forecast, and slice (Global or Tier 1). + Display a plot given a platform (each mobile product), + data for actuals and forecast, and slice (Global or Tier 1). """ main_metric_color = "#CA3524" main_metric_color_ci = "#DDDDDD" @@ -185,7 +186,9 @@ def create_plot(platform, y_min, y_max, actuals, forecast, plot_start_date, slic # autosize=force_width is None, # width=force_width, # height=force_height, - title='{} {} MAU at end of day {}'.format( + title=""" + {} {} MAU at end of day {} + """.format( slice_name, platform, data_end_date, From 59b7086a73cabce4ee266ee41007880b85834e32 Mon Sep 17 00:00:00 2001 From: kik-kik Date: Mon, 8 Aug 2022 12:25:23 +0200 Subject: [PATCH 2/2] updated requirements to get flake8 pytest plugin working --- jobs/desktop-mobile-mau-2020/mobile_mau/mobile_mau.py | 6 +++--- jobs/desktop-mobile-mau-2020/requirements.txt | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/jobs/desktop-mobile-mau-2020/mobile_mau/mobile_mau.py b/jobs/desktop-mobile-mau-2020/mobile_mau/mobile_mau.py index 0efd1d38..b5bb3aa6 100644 --- a/jobs/desktop-mobile-mau-2020/mobile_mau/mobile_mau.py +++ b/jobs/desktop-mobile-mau-2020/mobile_mau/mobile_mau.py @@ -186,13 +186,13 @@ def create_plot(platform, y_min, y_max, actuals, forecast, plot_start_date, slic # autosize=force_width is None, # width=force_width, # height=force_height, - title=""" - {} {} MAU at end of day {} + title="""\ + {} {} MAU at end of day {}\ """.format( slice_name, platform, data_end_date, - ), + ).strip(), titlefont={ "size": 24, }, diff --git a/jobs/desktop-mobile-mau-2020/requirements.txt b/jobs/desktop-mobile-mau-2020/requirements.txt index 25e66444..dff560a2 100644 --- a/jobs/desktop-mobile-mau-2020/requirements.txt +++ b/jobs/desktop-mobile-mau-2020/requirements.txt @@ -3,6 +3,7 @@ google-cloud-bigquery==1.27.2 google-cloud-bigquery-storage==1.0.0 google-cloud-storage==1.31.0 Jinja2==2.11.3 +flake8==3.8.4 matplotlib==3.3.2 numpy==1.19.2 pandas==1.1.2