本文整理汇总了Python中vizgrimoire.ITS.ITS.get_metrics方法的典型用法代码示例。如果您正苦于以下问题:Python ITS.get_metrics方法的具体用法?Python ITS.get_metrics怎么用?Python ITS.get_metrics使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vizgrimoire.ITS.ITS
的用法示例。
在下文中一共展示了ITS.get_metrics方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_list
# 需要导入模块: from vizgrimoire.ITS import ITS [as 别名]
# 或者: from vizgrimoire.ITS.ITS import get_metrics [as 别名]
def get_list (self):
# Projects activity needs to include subprojects also
logging.info ("Getting projects list for ITS")
from vizgrimoire.metrics.metrics_filter import MetricFilters
q = "SELECT p.id AS name FROM %s.projects p" % (self.db.projects_db)
projects = self.db.ExecuteQuery(q)
data = []
# Loop all projects getting reviews
for project in projects['name']:
type_analysis = ['project', project]
period = None
filter_com = MetricFilters(period, self.filters.startdate,
self.filters.enddate, type_analysis)
mclosed = ITS.get_metrics("closed", ITS)
mclosed.filters = filter_com
issues = mclosed.get_agg()
issues = issues['closed']
if (issues > 0):
data.append([issues,project])
# Order the list using reviews: https://wiki.python.org/moin/HowTo/Sorting
from operator import itemgetter
data_sort = sorted(data, key=itemgetter(0),reverse=True)
names = [name[1] for name in data_sort]
return({"name":names})
示例2: GetClosedSummaryCompanies
# 需要导入模块: from vizgrimoire.ITS import ITS [as 别名]
# 或者: from vizgrimoire.ITS.ITS import get_metrics [as 别名]
def GetClosedSummaryCompanies (period, startdate, enddate, identities_db, closed_condition, num_organizations):
from vizgrimoire.ITS import ITS
count = 1
first_organizations = {}
metric = DataSource.get_metrics("organizations", ITS)
organizations = metric.get_list()
organizations = organizations['name']
for company in organizations:
type_analysis = ["company", "'"+company+"'"]
filter_com = MetricFilters(period, startdate, enddate, type_analysis)
mclosed = ITS.get_metrics("closed", ITS)
mclosed.filters = filter_com
closed = mclosed.get_ts()
# Rename field closed to company name
closed[company] = closed["closed"]
del closed['closed']
if (count <= num_organizations):
#Case of organizations with entity in the dataset
first_organizations = dict(first_organizations.items() + closed.items())
else :
#Case of organizations that are aggregated in the field Others
if 'Others' not in first_organizations:
first_organizations['Others'] = closed[company]
else:
first_organizations['Others'] = [a+b for a, b in zip(first_organizations['Others'],closed[company])]
count = count + 1
first_organizations = completePeriodIds(first_organizations, period, startdate, enddate)
return(first_organizations)
示例3: _get_sql
# 需要导入模块: from vizgrimoire.ITS import ITS [as 别名]
# 或者: from vizgrimoire.ITS.ITS import get_metrics [as 别名]
def _get_sql(self, evolutionary):
""" Implemented using Changers (changed metric should exists first) """
close = True
changers = ITS.get_metrics("changers", ITS)
if changers is None:
# We need to create changers metric
changers = Changers(self.db, self.filters)
q = changers._get_sql(evolutionary, close)
else:
cfilters = changers.filters
changers.filters = self.filters
q = changers._get_sql(evolutionary, close)
changers.filters = cfilters
return q
示例4: _get_top_global
# 需要导入模块: from vizgrimoire.ITS import ITS [as 别名]
# 或者: from vizgrimoire.ITS.ITS import get_metrics [as 别名]
def _get_top_global (self, days = 0, metric_filters = None):
""" Implemented using Closers """
top = None
closers = ITS.get_metrics("closers", ITS)
if closers is None:
closers = Closers(self.db, self.filters)
top = closers._get_top(days, metric_filters)
else:
afilters = closers.filters
closers.filters = self.filters
top = closers._get_top(days, metric_filters)
closers.filters = afilters
top['name'] = top.pop('closers')
return top
示例5: _get_top_global
# 需要导入模块: from vizgrimoire.ITS import ITS [as 别名]
# 或者: from vizgrimoire.ITS.ITS import get_metrics [as 别名]
def _get_top_global (self, days = 0, metric_filters = None):
""" Implemented using Openers """
top = None
openers = ITS.get_metrics("stories_openers", ITS)
if openers is None:
openers = StoriesOpeners(self.db, self.filters)
top = openers._get_top(days, metric_filters)
else:
afilters = openers.filters
openers.filters = self.filters
top = openers._get_top(days, metric_filters)
openers.filters = afilters
top['name'] = top.pop('openers')
return top