diff options
author | davidovski <david@davidovski.xyz> | 2021-12-07 23:02:43 +0000 |
---|---|---|
committer | davidovski <david@davidovski.xyz> | 2021-12-07 23:02:43 +0000 |
commit | 075149bb1c92e3dc5df9fd07feebe60a3c8e4fef (patch) | |
tree | d9a97bc49b96657629045b29c989610208d54da0 /src/verbs/sync.py | |
parent | 7887f4d828c0ec15b209afc49f2671e368cb2c70 (diff) |
fixed issues with getting most popular package
Diffstat (limited to 'src/verbs/sync.py')
-rw-r--r-- | src/verbs/sync.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/verbs/sync.py b/src/verbs/sync.py index 38a8a39..07ed2ec 100644 --- a/src/verbs/sync.py +++ b/src/verbs/sync.py @@ -47,7 +47,16 @@ def validate_package(package, versions, repo, verbose=False): popularity[checksum] = 0 popularity[checksum] += 1 - most_popular = sorted(popularity)[-1] + most_popular = "" + p_count = -1 + for p,c in popularity.items(): + if c > p_count: + most_popular = p + p_count = c + + if verbose: + ##print(package, ":", popularity) + print(most_popular) sources = [v[1] for v in versions if v[0] == most_popular] # change the packages dict to list all the sources |