Пример #1
0
    def get_stats_suite(self, suite, **kwargs):
        if suite not in statistics.suites(session, 'all'):
            raise Http404Error()  # security, to avoid suite='../../foo',
            # to include <img>s, etc.
        stats_file = os.path.join(current_app.config["CACHE_DIR"],
                                  "license_stats.data")
        res = extract_stats(filename=stats_file,
                            filter_suites=[suite])
        licenses = [license.replace(suite + '.', '') for license in res.keys()]
        dual_stats_file = os.path.join(app.config["CACHE_DIR"],
                                       "dual_license.data")
        dual_res = extract_stats(filename=dual_stats_file,
                                 filter_suites=[suite])

        dual_licenses = [license.replace(suite + '.', '') for license
                         in dual_res.keys()]

        info = qry.get_suite_info(session, suite)

        return dict(results=res,
                    licenses=sorted(licenses),
                    dual_results=dual_res,
                    dual_licenses=sorted(dual_licenses),
                    suite=suite,
                    rel_date=str(info.release_date),
                    rel_version=info.version)
Пример #2
0
    def get_stats_suite(self, suite, **kwargs):
        if suite not in statistics.suites(session, "all"):
            raise Http404Error()  # security, to avoid suite='../../foo',
            # to include <img>s, etc.
        stats_file = current_app.config["CACHE_DIR"] / "license_stats.data"
        res = extract_stats(filename=stats_file, filter_suites=[suite])
        licenses = [license.replace(suite + ".", "") for license in res.keys()]
        dual_stats_file = app.config["CACHE_DIR"] / "dual_license.data"
        dual_res = extract_stats(filename=dual_stats_file,
                                 filter_suites=[suite])

        dual_licenses = [
            license.replace(suite + ".", "") for license in dual_res.keys()
        ]

        info = qry.get_suite_info(session, suite)

        return dict(
            results=res,
            licenses=sorted(licenses),
            dual_results=dual_res,
            dual_licenses=sorted(dual_licenses),
            suite=suite,
            rel_date=str(info.release_date),
            rel_version=info.version,
        )
Пример #3
0
    def get_stats_suite(self, suite, **kwargs):
        if suite not in statistics.suites(session, 'all'):
            raise Http404Error()  # security, to avoid suite='../../foo',
            # to include <img>s, etc.
        stats_file = current_app.config["CACHE_DIR"] / "stats.data"
        res = extract_stats(filename=stats_file,
                            filter_suites=["debian_" + suite])
        info = qry.get_suite_info(session, suite)

        return dict(results=res,
                    languages=SLOCCOUNT_LANGUAGES,
                    suite=suite,
                    rel_date=str(info.release_date),
                    rel_version=info.version)
Пример #4
0
    def get_stats_suite(self, suite, **kwargs):
        if suite not in statistics.suites(session, 'all'):
            raise Http404Error()  # security, to avoid suite='../../foo',
            # to include <img>s, etc.
        stats_file = os.path.join(current_app.config["CACHE_DIR"],
                                  "stats.data")
        res = extract_stats(filename=stats_file,
                            filter_suites=["debian_" + suite])
        info = qry.get_suite_info(session, suite)

        return dict(results=res,
                    languages=SLOCCOUNT_LANGUAGES,
                    suite=suite,
                    rel_date=str(info.release_date),
                    rel_version=info.version)