Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
yolile committed Feb 10, 2024
1 parent c26a3f2 commit 059989b
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 119 deletions.
28 changes: 11 additions & 17 deletions component_charts.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@
"\n",
"def plot_release_count(release_counts):\n",
" # check if input contains the right columns\n",
" if not set([\"collection_id\", \"release_type\", \"release_count\", \"ocid_count\"]).issubset(release_counts.columns):\n",
" if not {\"collection_id\", \"release_type\", \"release_count\", \"ocid_count\"}.issubset(release_counts.columns):\n",
" raise ValueError(\n",
" \"Input data must contain the following columns: collection_id, release_type, release_count, ocid_count\"\n",
" )\n",
" chart = (\n",
" return (\n",
" alt.Chart(release_counts)\n",
" .mark_bar()\n",
" .encode(\n",
Expand Down Expand Up @@ -106,15 +106,13 @@
" .configure_view(strokeWidth=0)\n",
" )\n",
"\n",
" return chart\n",
"\n",
"\n",
"def plot_objects_per_stage(objects_per_stage):\n",
" # check if input contains the right columns\n",
" if not set([\"stage\", \"object_count\"]).issubset(objects_per_stage.columns):\n",
" if not {\"stage\", \"object_count\"}.issubset(objects_per_stage.columns):\n",
" raise ValueError(\"Data must contain columns 'stage' and 'object_count'\")\n",
" # draw chart\n",
" chart = (\n",
" return (\n",
" alt.Chart(objects_per_stage)\n",
" .mark_bar(fill=\"#d6e100\")\n",
" .encode(\n",
Expand Down Expand Up @@ -158,19 +156,18 @@
" )\n",
" .configure_view(strokeWidth=0)\n",
" )\n",
" return chart\n",
"\n",
"\n",
"def plot_releases_by_month(release_dates):\n",
" # check if input contains the right columns\n",
" if not set([\"date\", \"collection_id\", \"release_type\", \"release_count\"]).issubset(release_dates.columns):\n",
" if not {\"date\", \"collection_id\", \"release_type\", \"release_count\"}.issubset(release_dates.columns):\n",
" raise ValueError(\"Data must contain columns 'date', 'collection_id', 'release_type', 'release_count'\")\n",
" # check if number of rows is more than 5000\n",
" if release_dates.shape[0] > 5000:\n",
" alt.data_transformers.disable_max_rows()\n",
"\n",
" # draw chart\n",
" chart = (\n",
" return (\n",
" alt.Chart(release_dates)\n",
" .mark_line(strokeWidth=3)\n",
" .encode(\n",
Expand Down Expand Up @@ -209,15 +206,14 @@
" )\n",
" .configure_view(strokeWidth=0)\n",
" )\n",
" return chart\n",
"\n",
"\n",
"def plot_objects_per_year(objects_per_year):\n",
" # check if input contains the right columns\n",
" if not set([\"year\", \"tenders\", \"awards\"]).issubset(objects_per_year.columns):\n",
" if not {\"year\", \"tenders\", \"awards\"}.issubset(objects_per_year.columns):\n",
" raise ValueError(\"Data must contain columns 'year', 'tenders' and 'awards'\")\n",
" # draw chart\n",
" chart = (\n",
" return (\n",
" alt.Chart(objects_per_year)\n",
" .transform_fold([\"tenders\", \"awards\"])\n",
" .mark_line(strokeWidth=3)\n",
Expand Down Expand Up @@ -260,15 +256,14 @@
" )\n",
" .configure_view(strokeWidth=0)\n",
" )\n",
" return chart\n",
"\n",
"\n",
"def plot_top_buyers(buyers):\n",
" # check if input contains the right columns\n",
" if not set([\"name\", \"total_tenders\"]).issubset(buyers.columns):\n",
" if not {\"name\", \"total_tenders\"}.issubset(buyers.columns):\n",
" raise ValueError(\"Data must contain columns 'name' and 'total_tenders'\")\n",
" # draw chart\n",
" chart = (\n",
" return (\n",
" alt.Chart(buyers)\n",
" .mark_bar(fill=\"#d6e100\")\n",
" .encode(\n",
Expand Down Expand Up @@ -302,8 +297,7 @@
" domain=False,\n",
" )\n",
" .configure_view(strokeWidth=0)\n",
" )\n",
" return chart"
" )\n"
],
"metadata": {
"id": "Bip37aP917XY"
Expand Down
28 changes: 11 additions & 17 deletions template_data_quality_feedback.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,11 @@
"\n",
"def plot_release_count(release_counts):\n",
" # check if input contains the right columns\n",
" if not set([\"collection_id\", \"release_type\", \"release_count\", \"ocid_count\"]).issubset(release_counts.columns):\n",
" if not {\"collection_id\", \"release_type\", \"release_count\", \"ocid_count\"}.issubset(release_counts.columns):\n",
" raise ValueError(\n",
" \"Input data must contain the following columns: collection_id, release_type, release_count, ocid_count\"\n",
" )\n",
" chart = (\n",
" return (\n",
" alt.Chart(release_counts)\n",
" .mark_bar()\n",
" .encode(\n",
Expand Down Expand Up @@ -226,15 +226,13 @@
" .configure_view(strokeWidth=0)\n",
" )\n",
"\n",
" return chart\n",
"\n",
"\n",
"def plot_objects_per_stage(objects_per_stage):\n",
" # check if input contains the right columns\n",
" if not set([\"stage\", \"object_count\"]).issubset(objects_per_stage.columns):\n",
" if not {\"stage\", \"object_count\"}.issubset(objects_per_stage.columns):\n",
" raise ValueError(\"Data must contain columns 'stage' and 'object_count'\")\n",
" # draw chart\n",
" chart = (\n",
" return (\n",
" alt.Chart(objects_per_stage)\n",
" .mark_bar(fill=\"#d6e100\")\n",
" .encode(\n",
Expand Down Expand Up @@ -278,19 +276,18 @@
" )\n",
" .configure_view(strokeWidth=0)\n",
" )\n",
" return chart\n",
"\n",
"\n",
"def plot_releases_by_month(release_dates):\n",
" # check if input contains the right columns\n",
" if not set([\"date\", \"collection_id\", \"release_type\", \"release_count\"]).issubset(release_dates.columns):\n",
" if not {\"date\", \"collection_id\", \"release_type\", \"release_count\"}.issubset(release_dates.columns):\n",
" raise ValueError(\"Data must contain columns 'date', 'collection_id', 'release_type', 'release_count'\")\n",
" # check if number of rows is more than 5000\n",
" if release_dates.shape[0] > 5000:\n",
" alt.data_transformers.disable_max_rows()\n",
"\n",
" # draw chart\n",
" chart = (\n",
" return (\n",
" alt.Chart(release_dates)\n",
" .mark_line(strokeWidth=3)\n",
" .encode(\n",
Expand Down Expand Up @@ -329,15 +326,14 @@
" )\n",
" .configure_view(strokeWidth=0)\n",
" )\n",
" return chart\n",
"\n",
"\n",
"def plot_objects_per_year(objects_per_year):\n",
" # check if input contains the right columns\n",
" if not set([\"year\", \"tenders\", \"awards\"]).issubset(objects_per_year.columns):\n",
" if not {\"year\", \"tenders\", \"awards\"}.issubset(objects_per_year.columns):\n",
" raise ValueError(\"Data must contain columns 'year', 'tenders' and 'awards'\")\n",
" # draw chart\n",
" chart = (\n",
" return (\n",
" alt.Chart(objects_per_year)\n",
" .transform_fold([\"tenders\", \"awards\"])\n",
" .mark_line(strokeWidth=3)\n",
Expand Down Expand Up @@ -380,15 +376,14 @@
" )\n",
" .configure_view(strokeWidth=0)\n",
" )\n",
" return chart\n",
"\n",
"\n",
"def plot_top_buyers(buyers):\n",
" # check if input contains the right columns\n",
" if not set([\"name\", \"total_tenders\"]).issubset(buyers.columns):\n",
" if not {\"name\", \"total_tenders\"}.issubset(buyers.columns):\n",
" raise ValueError(\"Data must contain columns 'name' and 'total_tenders'\")\n",
" # draw chart\n",
" chart = (\n",
" return (\n",
" alt.Chart(buyers)\n",
" .mark_bar(fill=\"#d6e100\")\n",
" .encode(\n",
Expand Down Expand Up @@ -422,8 +417,7 @@
" domain=False,\n",
" )\n",
" .configure_view(strokeWidth=0)\n",
" )\n",
" return chart"
" )\n"
]
},
{
Expand Down
28 changes: 11 additions & 17 deletions template_publisher_analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,11 @@
"\n",
"def plot_release_count(release_counts):\n",
" # check if input contains the right columns\n",
" if not set([\"collection_id\", \"release_type\", \"release_count\", \"ocid_count\"]).issubset(release_counts.columns):\n",
" if not {\"collection_id\", \"release_type\", \"release_count\", \"ocid_count\"}.issubset(release_counts.columns):\n",
" raise ValueError(\n",
" \"Input data must contain the following columns: collection_id, release_type, release_count, ocid_count\"\n",
" )\n",
" chart = (\n",
" return (\n",
" alt.Chart(release_counts)\n",
" .mark_bar()\n",
" .encode(\n",
Expand Down Expand Up @@ -226,15 +226,13 @@
" .configure_view(strokeWidth=0)\n",
" )\n",
"\n",
" return chart\n",
"\n",
"\n",
"def plot_objects_per_stage(objects_per_stage):\n",
" # check if input contains the right columns\n",
" if not set([\"stage\", \"object_count\"]).issubset(objects_per_stage.columns):\n",
" if not {\"stage\", \"object_count\"}.issubset(objects_per_stage.columns):\n",
" raise ValueError(\"Data must contain columns 'stage' and 'object_count'\")\n",
" # draw chart\n",
" chart = (\n",
" return (\n",
" alt.Chart(objects_per_stage)\n",
" .mark_bar(fill=\"#d6e100\")\n",
" .encode(\n",
Expand Down Expand Up @@ -278,19 +276,18 @@
" )\n",
" .configure_view(strokeWidth=0)\n",
" )\n",
" return chart\n",
"\n",
"\n",
"def plot_releases_by_month(release_dates):\n",
" # check if input contains the right columns\n",
" if not set([\"date\", \"collection_id\", \"release_type\", \"release_count\"]).issubset(release_dates.columns):\n",
" if not {\"date\", \"collection_id\", \"release_type\", \"release_count\"}.issubset(release_dates.columns):\n",
" raise ValueError(\"Data must contain columns 'date', 'collection_id', 'release_type', 'release_count'\")\n",
" # check if number of rows is more than 5000\n",
" if release_dates.shape[0] > 5000:\n",
" alt.data_transformers.disable_max_rows()\n",
"\n",
" # draw chart\n",
" chart = (\n",
" return (\n",
" alt.Chart(release_dates)\n",
" .mark_line(strokeWidth=3)\n",
" .encode(\n",
Expand Down Expand Up @@ -329,15 +326,14 @@
" )\n",
" .configure_view(strokeWidth=0)\n",
" )\n",
" return chart\n",
"\n",
"\n",
"def plot_objects_per_year(objects_per_year):\n",
" # check if input contains the right columns\n",
" if not set([\"year\", \"tenders\", \"awards\"]).issubset(objects_per_year.columns):\n",
" if not {\"year\", \"tenders\", \"awards\"}.issubset(objects_per_year.columns):\n",
" raise ValueError(\"Data must contain columns 'year', 'tenders' and 'awards'\")\n",
" # draw chart\n",
" chart = (\n",
" return (\n",
" alt.Chart(objects_per_year)\n",
" .transform_fold([\"tenders\", \"awards\"])\n",
" .mark_line(strokeWidth=3)\n",
Expand Down Expand Up @@ -380,15 +376,14 @@
" )\n",
" .configure_view(strokeWidth=0)\n",
" )\n",
" return chart\n",
"\n",
"\n",
"def plot_top_buyers(buyers):\n",
" # check if input contains the right columns\n",
" if not set([\"name\", \"total_tenders\"]).issubset(buyers.columns):\n",
" if not {\"name\", \"total_tenders\"}.issubset(buyers.columns):\n",
" raise ValueError(\"Data must contain columns 'name' and 'total_tenders'\")\n",
" # draw chart\n",
" chart = (\n",
" return (\n",
" alt.Chart(buyers)\n",
" .mark_bar(fill=\"#d6e100\")\n",
" .encode(\n",
Expand Down Expand Up @@ -422,8 +417,7 @@
" domain=False,\n",
" )\n",
" .configure_view(strokeWidth=0)\n",
" )\n",
" return chart"
" )\n"
]
},
{
Expand Down
28 changes: 11 additions & 17 deletions template_structure_and_format_feedback.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,11 @@
"\n",
"def plot_release_count(release_counts):\n",
" # check if input contains the right columns\n",
" if not set([\"collection_id\", \"release_type\", \"release_count\", \"ocid_count\"]).issubset(release_counts.columns):\n",
" if not {\"collection_id\", \"release_type\", \"release_count\", \"ocid_count\"}.issubset(release_counts.columns):\n",
" raise ValueError(\n",
" \"Input data must contain the following columns: collection_id, release_type, release_count, ocid_count\"\n",
" )\n",
" chart = (\n",
" return (\n",
" alt.Chart(release_counts)\n",
" .mark_bar()\n",
" .encode(\n",
Expand Down Expand Up @@ -226,15 +226,13 @@
" .configure_view(strokeWidth=0)\n",
" )\n",
"\n",
" return chart\n",
"\n",
"\n",
"def plot_objects_per_stage(objects_per_stage):\n",
" # check if input contains the right columns\n",
" if not set([\"stage\", \"object_count\"]).issubset(objects_per_stage.columns):\n",
" if not {\"stage\", \"object_count\"}.issubset(objects_per_stage.columns):\n",
" raise ValueError(\"Data must contain columns 'stage' and 'object_count'\")\n",
" # draw chart\n",
" chart = (\n",
" return (\n",
" alt.Chart(objects_per_stage)\n",
" .mark_bar(fill=\"#d6e100\")\n",
" .encode(\n",
Expand Down Expand Up @@ -278,19 +276,18 @@
" )\n",
" .configure_view(strokeWidth=0)\n",
" )\n",
" return chart\n",
"\n",
"\n",
"def plot_releases_by_month(release_dates):\n",
" # check if input contains the right columns\n",
" if not set([\"date\", \"collection_id\", \"release_type\", \"release_count\"]).issubset(release_dates.columns):\n",
" if not {\"date\", \"collection_id\", \"release_type\", \"release_count\"}.issubset(release_dates.columns):\n",
" raise ValueError(\"Data must contain columns 'date', 'collection_id', 'release_type', 'release_count'\")\n",
" # check if number of rows is more than 5000\n",
" if release_dates.shape[0] > 5000:\n",
" alt.data_transformers.disable_max_rows()\n",
"\n",
" # draw chart\n",
" chart = (\n",
" return (\n",
" alt.Chart(release_dates)\n",
" .mark_line(strokeWidth=3)\n",
" .encode(\n",
Expand Down Expand Up @@ -329,15 +326,14 @@
" )\n",
" .configure_view(strokeWidth=0)\n",
" )\n",
" return chart\n",
"\n",
"\n",
"def plot_objects_per_year(objects_per_year):\n",
" # check if input contains the right columns\n",
" if not set([\"year\", \"tenders\", \"awards\"]).issubset(objects_per_year.columns):\n",
" if not {\"year\", \"tenders\", \"awards\"}.issubset(objects_per_year.columns):\n",
" raise ValueError(\"Data must contain columns 'year', 'tenders' and 'awards'\")\n",
" # draw chart\n",
" chart = (\n",
" return (\n",
" alt.Chart(objects_per_year)\n",
" .transform_fold([\"tenders\", \"awards\"])\n",
" .mark_line(strokeWidth=3)\n",
Expand Down Expand Up @@ -380,15 +376,14 @@
" )\n",
" .configure_view(strokeWidth=0)\n",
" )\n",
" return chart\n",
"\n",
"\n",
"def plot_top_buyers(buyers):\n",
" # check if input contains the right columns\n",
" if not set([\"name\", \"total_tenders\"]).issubset(buyers.columns):\n",
" if not {\"name\", \"total_tenders\"}.issubset(buyers.columns):\n",
" raise ValueError(\"Data must contain columns 'name' and 'total_tenders'\")\n",
" # draw chart\n",
" chart = (\n",
" return (\n",
" alt.Chart(buyers)\n",
" .mark_bar(fill=\"#d6e100\")\n",
" .encode(\n",
Expand Down Expand Up @@ -422,8 +417,7 @@
" domain=False,\n",
" )\n",
" .configure_view(strokeWidth=0)\n",
" )\n",
" return chart"
" )\n"
]
},
{
Expand Down
Loading

0 comments on commit 059989b

Please sign in to comment.