本文整理汇总了Python中vilya.models.issue.Issue.get_cached_issues方法的典型用法代码示例。如果您正苦于以下问题:Python Issue.get_cached_issues方法的具体用法?Python Issue.get_cached_issues怎么用?Python Issue.get_cached_issues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vilya.models.issue.Issue
的用法示例。
在下文中一共展示了Issue.get_cached_issues方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_multi_by
# 需要导入模块: from vilya.models.issue import Issue [as 别名]
# 或者: from vilya.models.issue.Issue import get_cached_issues [as 别名]
def get_multi_by(cls, *a, **kw):
""" A wrapper to get project issues """
# args
issue_ids = kw.get('issue_ids')
project = kw.get('project')
creator = kw.get('creator')
assignee = kw.get('assignee')
state = kw.get('state')
start = kw.get('start')
limit = kw.get('limit')
milestone = kw.get('milestone')
tags = kw.get('tags')
order = kw.get('order')
ids = None
# get ids
issue_ids = cls._get_ids_by_project_id(
project.id, order=order,
state=state) if not issue_ids else issue_ids
if milestone:
ids = set(issue_ids) & set(milestone.issue_ids)
if tags:
ids = set(issue_ids) if not ids else ids
for tag in tags:
ids = ids & set(tag.project_issue_ids)
if ids is not None:
issue_ids = filter(lambda x: x in ids, issue_ids)
issues = Issue.get_cached_issues(issue_ids)
# filter
if assignee:
issues = filter(lambda x: x.assignee_id == assignee.name, issues)
if creator:
issues = filter(lambda x: x.creator_id == creator.name, issues)
return dict(issues=issues[start:start + limit], total=len(issues))
示例2: _gets_by_people_id
# 需要导入模块: from vilya.models.issue import Issue [as 别名]
# 或者: from vilya.models.issue.Issue import get_cached_issues [as 别名]
def _gets_by_people_id(cls, project, people_id, state, type):
ids = cls._get_ids_by_project_id(project, order='updated_at',
state=state)
issues = Issue.get_cached_issues(ids)
issues = [issue for issue in issues
if getattr(issue, type) == people_id]
return issues
示例3: gets_by_project_ids
# 需要导入模块: from vilya.models.issue import Issue [as 别名]
# 或者: from vilya.models.issue.Issue import get_cached_issues [as 别名]
def gets_by_project_ids(cls, project_ids, state=None, limit=25, start=0):
data = []
for id in project_ids:
data.extend(cls.get_data_by_target(id))
data = filter_issue_ids_by_state(data, state)
data = filter_issue_ids_by_score(data, 'updated_at')
data = data[start:start + limit]
ids = [issue_id for (issue_id, _, _, _) in data]
return Issue.get_cached_issues(ids)
示例4: get_n_by_issue_ids
# 需要导入模块: from vilya.models.issue import Issue [as 别名]
# 或者: from vilya.models.issue.Issue import get_cached_issues [as 别名]
def get_n_by_issue_ids(cls, issue_ids, state=None):
if not state:
return len(issue_ids)
else:
issues = Issue.get_cached_issues(issue_ids)
open_issues = [issue for issue in issues if issue and not issue.is_closed]
close_issues = [issue for issue in issues if issue and issue.is_closed]
if state == "open":
return len(open_issues)
else:
return len(close_issues)
示例5: _get_issues_by_project_id
# 需要导入模块: from vilya.models.issue import Issue [as 别名]
# 或者: from vilya.models.issue.Issue import get_cached_issues [as 别名]
def _get_issues_by_project_id(cls, id, state=None):
'''get project issues by project id with order and issue state.'''
ids = cls._get_ids_by_project_id(id, state=state)
return Issue.get_cached_issues(ids)