Skip to content

Commit e20cfea

Browse files
committed
fix dry run
1 parent aea12c4 commit e20cfea

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

download_analytics/output.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def load_spreadsheet(spreadsheet):
154154
return sheets
155155

156156

157-
def load_csv(csv_path, dry_run=False, read_csv_kwargs=None):
157+
def load_csv(csv_path, read_csv_kwargs=None):
158158
"""Load a CSV previously created by download-analytics.
159159
160160
Args:

download_analytics/summarize.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,24 @@ def _sum_counts(base_count, dep_to_count, parent_to_count):
7979
def get_previous_pypi_downloads(input_file, output_folder, dry_run):
8080
"""Read pypi.csv and return a DataFrame of the downloads."""
8181
csv_path = input_file or get_path(output_folder, 'pypi.csv')
82-
return load_csv(csv_path, dry_run=dry_run)
82+
read_csv_kwargs = {
83+
'parse_dates': ['timestamp'],
84+
'dtype': {
85+
'country_code': pd.CategoricalDtype(),
86+
'project': pd.CategoricalDtype(),
87+
'version': pd.CategoricalDtype(),
88+
'type': pd.CategoricalDtype(),
89+
'installer_name': pd.CategoricalDtype(),
90+
'implementation_name': pd.CategoricalDtype(),
91+
'implementation_version': pd.CategoricalDtype(),
92+
'distro_name': pd.CategoricalDtype(),
93+
'distro_version': pd.CategoricalDtype(),
94+
'system_name': pd.CategoricalDtype(),
95+
'system_release': pd.CategoricalDtype(),
96+
'cpu': pd.CategoricalDtype(),
97+
},
98+
}
99+
return load_csv(csv_path, read_csv_kwargs=read_csv_kwargs)
83100

84101

85102
def _ecosystem_count_by_year(downloads, base_project, dependency_projects, parent_projects):

0 commit comments

Comments
 (0)