Skip to content

Commit 5ba5f8d

Browse files
committed
fix dry run
1 parent e20cfea commit 5ba5f8d

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

download_analytics/main.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22

33
import logging
44

5-
import pandas as pd
6-
75
from download_analytics.metrics import compute_metrics
8-
from download_analytics.output import create_csv, get_path, load_csv
6+
from download_analytics.output import create_csv, get_path
97
from download_analytics.pypi import get_pypi_downloads
8+
from download_analytics.summarize import get_previous_pypi_downloads
109

1110
LOGGER = logging.getLogger(__name__)
1211

@@ -49,27 +48,28 @@ def collect_downloads(
4948
if not projects:
5049
raise ValueError('No projects have been passed')
5150

52-
LOGGER.info(f'Collecting downloads for projects={projects}')
51+
LOGGER.info(f'Collecting new downloads for projects={projects}')
5352

5453
csv_path = get_path(output_folder, 'pypi.csv')
55-
read_csv_kwargs = {
56-
'parse_dates': ['timestamp'],
57-
'dtype': {
58-
'country_code': pd.CategoricalDtype(),
59-
'project': pd.CategoricalDtype(),
60-
'version': pd.CategoricalDtype(),
61-
'type': pd.CategoricalDtype(),
62-
'installer_name': pd.CategoricalDtype(),
63-
'implementation_name': pd.CategoricalDtype(),
64-
'implementation_version': pd.CategoricalDtype(),
65-
'distro_name': pd.CategoricalDtype(),
66-
'distro_version': pd.CategoricalDtype(),
67-
'system_name': pd.CategoricalDtype(),
68-
'system_release': pd.CategoricalDtype(),
69-
'cpu': pd.CategoricalDtype(),
70-
},
71-
}
72-
previous = load_csv(csv_path, dry_run=dry_run, read_csv_kwargs=read_csv_kwargs)
54+
# read_csv_kwargs = {
55+
# 'parse_dates': ['timestamp'],
56+
# 'dtype': {
57+
# 'country_code': pd.CategoricalDtype(),
58+
# 'project': pd.CategoricalDtype(),
59+
# 'version': pd.CategoricalDtype(),
60+
# 'type': pd.CategoricalDtype(),
61+
# 'installer_name': pd.CategoricalDtype(),
62+
# 'implementation_name': pd.CategoricalDtype(),
63+
# 'implementation_version': pd.CategoricalDtype(),
64+
# 'distro_name': pd.CategoricalDtype(),
65+
# 'distro_version': pd.CategoricalDtype(),
66+
# 'system_name': pd.CategoricalDtype(),
67+
# 'system_release': pd.CategoricalDtype(),
68+
# 'cpu': pd.CategoricalDtype(),
69+
# },
70+
# }
71+
previous = get_previous_pypi_downloads(input_file=None, output_folder=output_folder)
72+
# previous = load_csv(csv_path, read_csv_kwargs=read_csv_kwargs)
7373

7474
pypi_downloads = get_pypi_downloads(
7575
projects=projects,

download_analytics/summarize.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def _sum_counts(base_count, dep_to_count, parent_to_count):
7676
return base_count + sum(parent_to_count.values()) + sum(dep_to_count.values())
7777

7878

79-
def get_previous_pypi_downloads(input_file, output_folder, dry_run):
79+
def get_previous_pypi_downloads(input_file, output_folder):
8080
"""Read pypi.csv and return a DataFrame of the downloads."""
8181
csv_path = input_file or get_path(output_folder, 'pypi.csv')
8282
read_csv_kwargs = {
@@ -212,7 +212,7 @@ def summarize_downloads(
212212
`gdrive://{folder_id}`.
213213
214214
"""
215-
downloads = get_previous_pypi_downloads(input_file, output_folder, dry_run)
215+
downloads = get_previous_pypi_downloads(input_file, output_folder)
216216

217217
vendor_df = pd.DataFrame.from_records(vendors)
218218
all_df = _create_all_df()

0 commit comments

Comments
 (0)