本文整理匯總了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