Skip to content

Commit de028a7

Browse files
authored
Merge pull request #308 from tekktrik/dev/stats-fix
Fix iteration over results
2 parents c91f0db + 4f4bd6d commit de028a7

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

adabot/circuitpython_libraries.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -231,17 +231,16 @@ def run_library_checks(validators, kw_args, error_depth):
231231
library_pypi_names = [
232232
repo["name"].replace("_", "-").lower() for repo in common_funcs.list_repos()
233233
]
234+
library_pypi_stats = []
235+
blinka_pypi_stats = None
234236
total_library_pypi_stats = 0
235-
library_pypi_stats = [
236-
stat for stat in pypi_stats if stat.name in library_pypi_names
237-
]
238-
top_library_pypi_stats = library_pypi_stats[:10]
239-
total_library_pypi_stats = 0
240-
for stat in library_pypi_stats:
237+
for stat in pypi_stats:
238+
if stat.name == "adafruit-blinka":
239+
blinka_pypi_stats = stat
240+
if stat.name in library_pypi_names:
241+
library_pypi_stats.append(stat)
241242
total_library_pypi_stats += stat.num_downloads
242-
blinka_pypi_stats = [
243-
stat for stat in pypi_stats if stat.name == "adafruit-blinka"
244-
][0]
243+
top_library_pypi_stats = library_pypi_stats[:10]
245244
else:
246245
pypi_stats = None
247246

0 commit comments

Comments
 (0)