当前位置: 首页>>代码示例>>Python>>正文


Python report.Report类代码示例

本文整理汇总了Python中vizgrimoire.report.Report的典型用法代码示例。如果您正苦于以下问题:Python Report类的具体用法?Python Report怎么用?Python Report使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Report类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_filter_items

    def get_filter_items(filter_, startdate, enddate, identities_db):
        items = None
        filter_name = filter_.get_name()

        if (filter_name == "repository"):
            metric = DataSource.get_metrics("repositories", SCR)
        elif (filter_name == "company"):
            metric = DataSource.get_metrics("organizations", SCR)
        elif (filter_name == "country"):
            metric = DataSource.get_metrics("countries", SCR)
        elif (filter_name == "domain"):
            metric = DataSource.get_metrics("domains", SCR)
        elif (filter_name == "project"):
            metric = DataSource.get_metrics("projects", SCR)
        elif (filter_name == "people2"):
            metric = DataSource.get_metrics("people2", SCR)
        else:
            logging.error("SCR " + filter_name + " not supported")
            return items

        # workaround due to bug https://phabricator.wikimedia.org/T116484
        from vizgrimoire.report import Report
        automator = Report.get_config()
        DS = SCR
        if DS.get_name()+"_start_date" in Report.get_config()['r']:
            metric.filters.startdate = "'"+Report.get_config()['r'][DS.get_name()+"_start_date"]+"'"
        if DS.get_name()+"_end_date" in Report.get_config()['r']:
            metric.filters.enddate = "'"+Report.get_config()['r'][DS.get_name()+"_end_date"]+"'"
        # end

        items = metric.get_list()
        return items
开发者ID:VizGrimoire,项目名称:GrimoireLib,代码行数:32,代码来源:SCR.py

示例2: ages_study_com

    def ages_study_com (ds, items, period,
                        startdate, enddate, destdir):
        """Perform ages study for companies, if it is specified in Report.

        Produces JSON files for those studies.

        Parameters
        ----------

        ds: { SCM | ITS | MLS }
           Data source
        items: ??
           Items
        period: ??
           Period
        startdate: ??
           Start date
        enddate: ??
           End date
        destdir: string
           Directory for writing the JSON files
        """

        from vizgrimoire.report import Report
        filter_name = "company"
        studies = Report.get_studies()
        ages = None
        for study in studies:
            if study.id == "ages":
                ages = study

        if ages is not None:
            # Get config parameters for producing a connection
            # to the database
            config = Report.get_config()
            db_identities = config['generic']['db_identities']
            dbuser = config['generic']['db_user']
            dbpass = config['generic']['db_password']

            start_string = ds.get_name() + "_start_date"
            end_string = ds.get_name() + "_end_date"
            if start_string in config['r']:
                startdate = "'" + config['r'][start_string] + "'"
            if end_string in config['r']:
                enddate = "'" + config['r'][end_string] + "'"
            ds_dbname = ds.get_db_name()
            dbname = config['generic'][ds_dbname]
            dsquery = ds.get_query_builder()
            dbcon = dsquery(dbuser, dbpass, dbname, db_identities)

            for item in items :
                filter_item = Filter(filter_name, item)
                metric_filters = MetricFilters(
                    period, startdate, enddate,
                    filter_item.get_type_analysis()
                    )
                obj = ages(dbcon, metric_filters)
                res = obj.create_report(ds, destdir)
开发者ID:jgbarah,项目名称:GrimoireLib,代码行数:58,代码来源:data_source.py

示例3: get_filter_bots

    def get_filter_bots(filter_):
        from vizgrimoire.report import Report
        bots = []

        # If not using Report (automator) bots are not supported.
        if Report.get_config() == None:
            return bots

        if filter_.get_name_plural()+'_out' in Report.get_config()['r']:
            fbots = Report.get_config()['r'][filter_.get_name_plural()+'_out']
            bots = fbots.split(",")
            logging.info("BOTS for " + filter_.get_name_plural())
            logging.info(bots)
        return bots
开发者ID:jgbarah,项目名称:GrimoireLib,代码行数:14,代码来源:data_source.py

示例4: create_filter_report_top

    def create_filter_report_top(filter_, period, startdate, enddate, destdir, npeople, identities_db):
        from vizgrimoire.report import Report
        items = Report.get_items()
        if items is None:
            items = EventsDS.get_filter_items(filter_, startdate, enddate, identities_db)
            if (items == None): return
            items = items['name']

        filter_name = filter_.get_name()

        if not isinstance(items, (list)):
            items = [items]

        fn = os.path.join(destdir, filter_.get_filename(EventsDS()))
        createJSON(items, fn)

        for item in items :
            item_name = "'"+ item+ "'"
            logging.info (item_name)
            filter_item = Filter(filter_name, item)

            if filter_name in ("repository"):
                logging.warn("Filter 'repository' detected for top info")
                top_authors = EventsDS.get_top_data(startdate, enddate, identities_db, filter_item, npeople)
                logging.warn(filter_item.get_top_filename(EventsDS())) 
                fn = os.path.join(destdir, filter_item.get_top_filename(EventsDS()))
                createJSON(top_authors, fn)
开发者ID:jgbarah,项目名称:GrimoireLib,代码行数:27,代码来源:EventsDS.py

示例5: create_filter_report_top

    def create_filter_report_top(filter_, period, startdate, enddate, destdir, npeople, identities_db):
        from vizgrimoire.report import Report
        items = Report.get_items()
        if items is None:
            items = SCR.get_filter_items(filter_, startdate, enddate, identities_db)
            if (items == None): return
            items = items['name']

        filter_name = filter_.get_name()

        if not isinstance(items, (list)):
            items = [items]

        fn = os.path.join(destdir, filter_.get_filename(SCR()))
        createJSON(items, fn)

        for item in items :
            item_name = "'"+ item+ "'"
            logging.info (item_name)
            filter_item = Filter(filter_name, item)

            if filter_name in ("company","project","repository"):
                top_mergers = SCR.get_top_data(startdate, enddate, identities_db, filter_item, npeople)
                fn = os.path.join(destdir, filter_item.get_top_filename(SCR()))
                createJSON(top_mergers, fn)
开发者ID:VizGrimoire,项目名称:GrimoireLib,代码行数:25,代码来源:SCR.py

示例6: create_filter_report

    def create_filter_report(filter_, period, startdate, enddate, destdir, npeople, identities_db):
        from vizgrimoire.report import Report
        items = Report.get_items()
        if items is None:
            items =  QAForums.get_filter_items(filter_, startdate, enddate, identities_db)
            if items == None:
                return
            items = items['name']
  
        filter_name = filter_.get_name()

        if not isinstance(items, list):
            items = [items]

        file_items = []
        for item in items:
            if re.compile("^\..*").match(item) is not None: item = "_"+item
            file_items.append(item)

        fn = os.path.join(destdir, filter_.get_filename(QAForums()))
        createJSON(file_items, fn)
        for item in items:
            logging.info(item)
            filter_item = Filter(filter_.get_name(), item)

            evol_data = QAForums.get_evolutionary_data(period, startdate, enddate, identities_db, filter_item)
            fn = os.path.join(destdir, filter_item.get_evolutionary_filename(QAForums()))
            createJSON(completePeriodIds(evol_data, period, startdate, enddate), fn)

            agg = QAForums.get_agg_data(period, startdate, enddate, identities_db, filter_item)
            fn = os.path.join(destdir, filter_item.get_static_filename(QAForums()))
            createJSON(agg, fn)
开发者ID:VizGrimoire,项目名称:GrimoireLib,代码行数:32,代码来源:QAForums.py

示例7: create_filter_report

    def create_filter_report(filter_, period, startdate, enddate, destdir, npeople, identities_db):
        from vizgrimoire.report import Report
        items = Report.get_items()
        if items is None:
            items = MLS.get_filter_items(filter_, startdate, enddate, identities_db)
            if (items == None): return
            items = items['name']

        filter_name = filter_.get_name()

        if not isinstance(items, (list)):
            items = [items]

        items_files = [item.replace('/', '_').replace("<","__").replace(">","___")
            for item in items]

        fn = os.path.join(destdir, filter_.get_filename(MLS()))
        createJSON(items_files, fn)

        if filter_name in ("domain", "company", "repository"):
            items_list = {'name' : [], 'sent_365' : [], 'senders_365' : []}
        else:
            items_list = items

        for item in items :
            item_name = "'"+ item+ "'"
            logging.info (item_name)
            filter_item = Filter(filter_.get_name(), item)

            evol_data = MLS.get_evolutionary_data(period, startdate, enddate, 
                                                  identities_db, filter_item)
            fn = os.path.join(destdir, filter_item.get_evolutionary_filename(MLS()))
            createJSON(evol_data, fn)

            agg = MLS.get_agg_data(period, startdate, enddate, identities_db, filter_item)
            fn = os.path.join(destdir, filter_item.get_static_filename(MLS()))
            createJSON(agg, fn)

            if filter_name in ("domain", "company", "repository"):
                items_list['name'].append(item.replace('/', '_').replace("<","__").replace(">","___"))
                items_list['sent_365'].append(agg['sent_365'])
                items_list['senders_365'].append(agg['senders_365'])

            top_senders = MLS.get_top_data(startdate, enddate, identities_db, filter_item, npeople, False)
            createJSON(top_senders, destdir+"/"+filter_item.get_top_filename(MLS()))

        fn = os.path.join(destdir, filter_.get_filename(MLS()))
        createJSON(items_list, fn)

        if (filter_name == "company"):
            ds = MLS
            if False:
                summary = MLS.get_filter_summary(
                    filter_, period, startdate, enddate,
                    identities_db, 10, self.db.projects_db
                    )
                createJSON (summary,
                            destdir + "/" + filter_.get_summary_filename(MLS))
            # Perform ages study, if it is specified in Report
            MLS.ages_study_com (items, period, startdate, enddate, destdir)
开发者ID:jsmanrique,项目名称:GrimoireLib,代码行数:60,代码来源:MLS.py

示例8: create_filter_report

    def create_filter_report(filter_, period, startdate, enddate, destdir, npeople, identities_db):
        from vizgrimoire.report import Report
        items = Report.get_items()
        if items is None:
            items = IRC.get_filter_items(filter_, startdate, enddate, identities_db)
            if (items == None): return

        if not isinstance(items, (list)):
            items = [items]

        fn = os.path.join(destdir, filter_.get_filename(IRC()))
        createJSON(items, fn)

        for item in items :
            # item_name = "'"+ item+ "'"
            logging.info (item)

            filter_item = Filter(filter_.get_name(), item)

            evol_data = IRC.get_evolutionary_data(period, startdate, enddate, identities_db, filter_item)
            fn = os.path.join(destdir, filter_item.get_evolutionary_filename(IRC()))
            createJSON(completePeriodIds(evol_data, period, startdate, enddate), fn)

            agg = IRC.get_agg_data(period, startdate, enddate, identities_db, filter_item)
            fn = os.path.join(destdir, filter_item.get_static_filename(IRC()))
            createJSON(agg, fn)
开发者ID:VizGrimoire,项目名称:GrimoireLib,代码行数:26,代码来源:IRC.py

示例9: create_filter_report

    def create_filter_report(cls, filter_, period, startdate, enddate, destdir, npeople, identities_db):
        from vizgrimoire.report import Report
        items = Report.get_items()
        if items is None:
            items = cls.get_filter_items(filter_, startdate, enddate, identities_db)
            if (items == None): return
            items = items['name']

        filter_name = filter_.get_name()

        if not isinstance(items, (list)):
            items = [items]

        fn = os.path.join(destdir, filter_.get_filename(cls()))
        createJSON(items, fn)

        if filter_name in ("domain", "company", "repository"):
            items_list = {'name' : [], 'closed_365' : [], 'closers_365' : []}
        else:
            items_list = items

        for item in items :
            item_name = "'"+ item+ "'"
            logging.info (item_name)
            filter_item = Filter(filter_name, item)

            evol_data = cls.get_evolutionary_data(period, startdate, enddate, identities_db, filter_item)
            fn = os.path.join(destdir, filter_item.get_evolutionary_filename(cls()))
            createJSON(evol_data, fn)

            agg = cls.get_agg_data(period, startdate, enddate, identities_db, filter_item)
            fn = os.path.join(destdir, filter_item.get_static_filename(cls()))
            createJSON(agg, fn)

            if filter_name in ["domain", "company", "repository"]:
                items_list['name'].append(item.replace('/', '_'))
                items_list['closed_365'].append(agg['closed_365'])
                items_list['closers_365'].append(agg['closers_365'])

            if filter_name in ["company","domain","repository"]:
                top = cls.get_top_data(startdate, enddate, identities_db, filter_item, npeople)
                fn = os.path.join(destdir, filter_item.get_top_filename(cls()))
                createJSON(top, fn)

        fn = os.path.join(destdir, filter_.get_filename(cls()))
        createJSON(items_list, fn)

        if (filter_name == "company"):
            ds = ITS
            summary = cls.get_filter_summary(
                filter_, period, startdate, enddate,
                identities_db, 10
                )
            createJSON (summary,
                        destdir + "/" + filter_.get_summary_filename(cls))

            # Perform ages study, if it is specified in Report
            cls.ages_study_com (items, period, startdate, enddate, destdir)
开发者ID:jgbarah,项目名称:GrimoireLib,代码行数:58,代码来源:ITS.py

示例10: get_its_from_organizations

    def get_its_from_organizations(self):
        automator = Report.get_config()
        identities_db = automator['generic']['db_identities']

        from_ = """
            FROM issues i
              JOIN people_uidentities pup ON i.submitted_by = pup.people_id 
              JOIN %s.enrollments enr ON enr.uuid = pup.uuid 
              JOIN %s.organizations org ON org.id = enr.organization_id 
        """ % (identities_db, identities_db)
        return from_
开发者ID:jgbarah,项目名称:GrimoireLib,代码行数:11,代码来源:companies_activity.py

示例11: get_top_data

 def get_top_data (startdate, enddate, i_db, filter_, npeople):
     from vizgrimoire.report import Report
     top = {}
     data = SCM.get_top_data_authors (startdate, enddate, i_db, filter_, npeople)
     top = dict(top.items() + data.items())
     organizations_on = False
     if Report.get_filter_automator('company') is not None:
         organizations_on = True
     if organizations_on:
         data = SCM.get_top_data_organizations (startdate, enddate, i_db, filter_, npeople)
         top = dict(top.items() + data.items())
     return top
开发者ID:jgbarah,项目名称:GrimoireLib,代码行数:12,代码来源:SCM.py

示例12: get_mls_from_organizations

    def get_mls_from_organizations(self):
        automator = Report.get_config()
        identities_db = automator['generic']['db_identities']

        from_ = """
            FROM messages m
              JOIN messages_people mp ON m.message_ID = mp.message_id
              JOIN people_uidentities pup ON mp.email_address = pup.people_id 
              JOIN %s.enrollments enr ON enr.upeople_id = pup.uuid 
              JOIN %s.organizations org ON org.id = enr.organization_id 
        """ % (identities_db, identities_db)
        return from_
开发者ID:jgbarah,项目名称:GrimoireLib,代码行数:12,代码来源:companies_activity.py

示例13: get_studies_data

    def get_studies_data(ds, period, startdate, enddate, evol):
        """ Get data from studies to be included in agg and evol global JSONs  """
        from vizgrimoire.report import Report
        data = {}

        db_identities = Report.get_config()['generic']['db_identities']
        dbuser = Report.get_config()['generic']['db_user']
        dbpass = Report.get_config()['generic']['db_password']

        studies = Report.get_studies()

        metric_filters = Report.get_default_filter()

        ds_dbname = ds.get_db_name()
        dbname = Report.get_config()['generic'][ds_dbname]
        dsquery = ds.get_query_builder()
        dbcon = dsquery(dbuser, dbpass, dbname, db_identities)
        evol_txt = "evol"
        if not evol: evol_txt = "agg"
        logging.info("Creating studies for " + ds.get_name() + " " + evol_txt)
        for study in studies:
            try:
                obj = study(dbcon, metric_filters)
                if evol:
                    res = obj.get_ts(ds)
                else:
                    res = obj.get_agg(ds)
                if res is not None:
                    data = dict(res.items() + data.items())
            except TypeError:
                # logging.info(study.id + " does no support standard API. Not used.")
                pass

        return data
开发者ID:jgbarah,项目名称:GrimoireLib,代码行数:34,代码来源:data_source.py

示例14: get_scm_from_organizations

 def get_scm_from_organizations(self, committers = False):
     automator = Report.get_config()
     identities_db = automator['generic']['db_identities']
     if (committers): field = "s.committer_id"
     else:  field = "s.author_id"
     from_ = """
         FROM scmlog s
           JOIN actions a ON a.commit_id = s.id
           JOIN people_uidentities pup ON %s = pup.people_id
           JOIN %s.enrollments enr ON enr.uuid = pup.uuid
           JOIN %s.organizations org ON org.id = enr.organization_id
     """ % (field, identities_db, identities_db)
     return from_
开发者ID:VizGrimoire,项目名称:GrimoireLib,代码行数:13,代码来源:companies_activity.py

示例15: create_filter_report

    def create_filter_report(filter_, period, startdate, enddate, destdir, npeople, identities_db):
        from vizgrimoire.report import Report
        items = Report.get_items()
        if items is None:
            items = EventsDS.get_filter_items(filter_, startdate, enddate, identities_db)
        if (items == None): return

        filter_name = filter_.get_name()
        items = items['name']

        if not isinstance(items, list):
            items = [items]

        file_items = []
        for item in items:
            if re.compile("^\..*").match(item) is not None: item = "_"+item
            file_items.append(item)

        fn = os.path.join(destdir, filter_.get_filename(EventsDS()))
        createJSON(file_items, fn)

        if filter_name in ("repository"):
            items_list = {'name' : [], 'events_365' : [], 'rsvps_365' : []}
        else:
            items_list = items

        for item in items:
            logging.info(item)
            filter_item = Filter(filter_.get_name(), item)

            evol_data = EventsDS.get_evolutionary_data(period, startdate, enddate, identities_db, filter_item)
            fn = os.path.join(destdir, filter_item.get_evolutionary_filename(EventsDS()))
            createJSON(completePeriodIds(evol_data, period, startdate, enddate), fn)

            agg = EventsDS.get_agg_data(period, startdate, enddate, identities_db, filter_item)
            fn = os.path.join(destdir, filter_item.get_static_filename(EventsDS()))
            createJSON(agg, fn)

            if filter_name in ("repository"):
                items_list['name'].append(item.replace('/', '_'))
                items_list['events_365'].append(agg['events_365'])
                items_list['rsvps_365'].append(agg['rsvps_365'])

        EventsDS.create_filter_report_top(filter_, period, startdate, enddate, destdir, npeople, identities_db)

        fn = os.path.join(destdir, filter_.get_filename(EventsDS()))
        createJSON(items_list, fn)
开发者ID:jgbarah,项目名称:GrimoireLib,代码行数:47,代码来源:EventsDS.py


注:本文中的vizgrimoire.report.Report类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。