Beispiel #1
0
    def get_stats(self):
        stats_file = app.config["CACHE_DIR"] / "license_stats.data"
        res = extract_stats(filename=stats_file)

        dual_stats_file = app.config["CACHE_DIR"] / "dual_license.data"
        dual_res = extract_stats(filename=dual_stats_file)
        dual_licenses = [
            license.replace("overall.", "") for license in dual_res.keys()
            if "overall." in license
        ]

        licenses = [
            license.replace("overall.", "") for license in res.keys()
            if "overall." in license
        ]

        release_suites = [
            x for x in statistics.suites(session, suites="release")
        ]
        devel_suites = [x for x in statistics.suites(session, suites="devel")]

        return dict(
            results=res,
            licenses=sorted(licenses),
            dual_results=dual_res,
            dual_licenses=sorted(dual_licenses),
            release_suites=release_suites,
            devel_suites=devel_suites,
        )
Beispiel #2
0
    def get_stats(self):

        stats_file = os.path.join(app.config["CACHE_DIR"],
                                  "license_stats.data")
        res = extract_stats(filename=stats_file)

        dual_stats_file = os.path.join(app.config["CACHE_DIR"],
                                       "dual_license.data")
        dual_res = extract_stats(filename=dual_stats_file)
        dual_licenses = [license.replace('overall.', '') for license
                         in dual_res.keys()
                         if 'overall.' in license]

        licenses = [license.replace('overall.', '') for license in res.keys()
                    if 'overall.' in license]

        release_suites = [x for x in
                          statistics.suites(session, suites='release')]
        devel_suites = [x for x in statistics.suites(session, suites='devel')]

        return dict(results=res,
                    licenses=sorted(licenses),
                    dual_results=dual_res,
                    dual_licenses=sorted(dual_licenses),
                    release_suites=release_suites,
                    devel_suites=devel_suites)
Beispiel #3
0
    def get_stats(self):
        stats_file = os.path.join(app.config["CACHE_DIR"], "stats.data")
        res = extract_stats(filename=stats_file)

        all_suites = ["debian_" + x for x in statistics.suites(session, suites="all")]
        release_suites = ["debian_" + x for x in statistics.suites(session, suites="release")]
        devel_suites = ["debian_" + x for x in statistics.suites(session, suites="devel")]

        return dict(
            results=res,
            languages=SLOCCOUNT_LANGUAGES,
            all_suites=all_suites,
            release_suites=release_suites,
            devel_suites=devel_suites,
        )
Beispiel #4
0
    def get_stats(self):
        stats_file = os.path.join(app.config["CACHE_DIR"], "stats.data")
        res = extract_stats(filename=stats_file)

        all_suites = ["debian_" + x for x in
                      statistics.suites(session, suites='all')]
        release_suites = ["debian_" + x for x in
                          statistics.suites(session, suites='release')]
        devel_suites = ["debian_" + x for x in
                        statistics.suites(session, suites='devel')]

        return dict(results=res,
                    languages=SLOCCOUNT_LANGUAGES,
                    all_suites=all_suites,
                    release_suites=release_suites,
                    devel_suites=devel_suites)
Beispiel #5
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,
        )
Beispiel #6
0
def __target_suites(session, suites=None):
    if not suites:
        sticky_suites = statistics.sticky_suites(session)
        suites = [suite
                  for suite in statistics.suites(session, suites='all')
                  if suite not in sticky_suites]
    return suites
Beispiel #7
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)
Beispiel #8
0
    def get_stats(self):

        stats_file = os.path.join(app.config["CACHE_DIR"],
                                  "license_stats.data")
        res = extract_stats(filename=stats_file)

        dual_stats_file = os.path.join(app.config["CACHE_DIR"],
                                       "dual_license.data")
        dual_res = extract_stats(filename=dual_stats_file)
        dual_licenses = [
            license.replace('overall.', '') for license in dual_res.keys()
            if 'overall.' in license
        ]

        licenses = [
            license.replace('overall.', '') for license in res.keys()
            if 'overall.' in license
        ]
        all_suites = [
            suite for suite in statistics.suites(session, suites='all')
        ]
        all_suites = all_suites[all_suites.index('squeeze'):]
        return dict(results=res,
                    licenses=sorted(licenses),
                    dual_results=dual_res,
                    dual_licenses=sorted(dual_licenses),
                    suites=all_suites)
Beispiel #9
0
    def get_objects(self, suite):
        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(app.config["CACHE_DIR"], "stats.data")
        res = extract_stats(filename=stats_file,
                            filter_suites=["debian_" + suite])

        return dict(results=res,
                    languages=SLOCCOUNT_LANGUAGES,
                    suite=suite)
Beispiel #10
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)
Beispiel #11
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)
Beispiel #12
0
    def get_stats(self):

        stats_file = os.path.join(app.config["CACHE_DIR"],
                                  "license_stats.data")
        res = extract_stats(filename=stats_file)

        dual_stats_file = os.path.join(app.config["CACHE_DIR"],
                                       "dual_license.data")
        dual_res = extract_stats(filename=dual_stats_file)
        dual_licenses = [license.replace('overall.', '') for license
                         in dual_res.keys()
                         if 'overall.' in license]

        licenses = [license.replace('overall.', '') for license in res.keys()
                    if 'overall.' in license]
        all_suites = [suite for suite in
                      statistics.suites(session, suites='all')]
        all_suites = all_suites[all_suites.index('squeeze'):]
        return dict(results=res,
                    licenses=sorted(licenses),
                    dual_results=dual_res,
                    dual_licenses=sorted(dual_licenses),
                    suites=all_suites)