def tag_releases_summary(): return_value = OrderedDict() reports_manager = ReportsManager() releases_summary = reports_manager.get_reports('releases') if releases_summary: report = releases_summary.get().report_json_str release_report_json = json.loads(report) if isinstance(report, str) else {} pkg_manager = PackagesManager() lang_locale_dict = {lang: locale for locale, lang in pkg_manager.get_locale_lang_tuple()} for release, summary in release_report_json.items(): if summary.get('languages'): release_report_json[release]['languages'] = \ OrderedDict(sorted(summary['languages'].items())) return_value.update(dict( relsummary=release_report_json, last_updated=releases_summary.get().report_updated, lang_locale=lang_locale_dict )) return return_value
def tag_trending_languages(): return_value = OrderedDict() reports_manager = ReportsManager() releases_summary = reports_manager.get_reports('releases') release_manager = ReleaseBranchManager() latest_release = release_manager.get_latest_release() pkg_manager = PackagesManager() lang_locale_dict = { lang: locale for locale, lang in pkg_manager.get_locale_lang_tuple() } if releases_summary and latest_release: releases_summary = releases_summary.get() trending_languages = reports_manager.get_trending_languages( releases_summary.report_json, *latest_release) if trending_languages and isinstance(trending_languages, (list, tuple)): return_value["trending_languages"] = trending_languages[:9] return_value["lang_locale_dict"] = lang_locale_dict return_value["latest_release"] = latest_release return return_value
def tag_releases_summary(): return_value = OrderedDict() reports_manager = ReportsManager() releases_summary = reports_manager.get_reports('releases') if releases_summary: report = releases_summary.get().report_json_str release_report_json = json.loads(report) if isinstance(report, str) else {} pkg_manager = PackagesManager() lang_locale_dict = { lang: locale for locale, lang in pkg_manager.get_locale_lang_tuple() } for release, summary in release_report_json.items(): if summary.get('languages'): release_report_json[release]['languages'] = \ OrderedDict(sorted(summary['languages'].items())) return_value.update( dict(relsummary=release_report_json, last_updated=releases_summary.get().report_updated, lang_locale=lang_locale_dict)) return return_value