本文整理汇总了Python中vizgrimoire.report.Report.get_studies方法的典型用法代码示例。如果您正苦于以下问题:Python Report.get_studies方法的具体用法?Python Report.get_studies怎么用?Python Report.get_studies使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vizgrimoire.report.Report
的用法示例。
在下文中一共展示了Report.get_studies方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_studies_data
# 需要导入模块: from vizgrimoire.report import Report [as 别名]
# 或者: from vizgrimoire.report.Report import get_studies [as 别名]
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
示例2: ages_study_com
# 需要导入模块: from vizgrimoire.report import Report [as 别名]
# 或者: from vizgrimoire.report.Report import get_studies [as 别名]
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)