'gitea-languages-calculator.py' updaten
This commit is contained in:
parent
00351e1a40
commit
e7ccdf212f
@ -31,14 +31,12 @@ for item in result:
|
|||||||
if language_data:
|
if language_data:
|
||||||
for language, count in language_data.items():
|
for language, count in language_data.items():
|
||||||
if language in language_counts:
|
if language in language_counts:
|
||||||
language_counts[language]['count'] += count
|
language_counts[language]['score'] += count
|
||||||
else:
|
else:
|
||||||
language_counts[language] = {'count': count, 'score': 0}
|
language_counts[language] = {'score': count}
|
||||||
|
|
||||||
for language in language_counts:
|
sorted_data = dict(sorted(language_counts.items(), key=lambda x: x[1]['score'], reverse=True))
|
||||||
language_counts[language]['score'] = language_counts[language]['count'] * len(language)
|
|
||||||
|
print(sorted_data)
|
||||||
|
|
||||||
top_languages = sorted(language_counts, key=lambda x: language_counts[x]['count'], reverse=True)
|
|
||||||
output = [{'language': language, 'top': index+1, 'score': language_counts[language]['score']} for index, language in enumerate(top_languages)]
|
|
||||||
|
|
||||||
print(output)
|
|
Loading…
Reference in New Issue
Block a user