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


Python issue.Issue类代码示例

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


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

示例1: _get_issue_comment_by_uid

def _get_issue_comment_by_uid(uid):
    issue = {}
    # uid: issue-type-id-number
    if uid and uid.startswith('issue-'):
        fields = uid.split('-')
        if len(fields) != 6:
            return issue
        _, _, type, id, number, comment_number = fields
        if type == 'project':
            _issue = ProjectIssue.get(id, number=number)
            _issue = Issue.get_cached_issue(_issue.issue_id)
            _target = _get_project_by_name(_issue.target.name)
        elif type == 'team':
            _issue = TeamIssue.get(id, number=number)
            _issue = Issue.get_cached_issue(_issue.issue_id)
            _target = _get_team_by_uid(_issue.target.uid)
        else:
            return issue
    _author = _get_user_by_name(_issue.creator_id)
    _closer = _get_user_by_name(_issue.closer_id) if _issue.closer_id else {}
    issue = dict(
        id=_issue.issue_id,
        name=_issue.title,
        author=_author,
        closer=_closer,
    )
    issue[_issue.target_type] = _target
    return issue
开发者ID:000fan000,项目名称:code,代码行数:28,代码来源:timeline.py

示例2: test_issue_stat

    def test_issue_stat(self):
        issue_rs = get_all_issue()
        assert len(issue_rs) == 0
        issue_open_count = len(filter(lambda x: x[1] is None, issue_rs))
        assert issue_open_count == 0
        assert len(issue_rs) - issue_open_count == 0

        i1 = Issue.add('test1', 'test des1', 'testuser1', 'assignee')
        issue_rs = get_all_issue()
        assert len(issue_rs) == 1
        issue_open_count = len(filter(lambda x: x[1] is None, issue_rs))
        assert issue_open_count == 1
        assert len(issue_rs) - issue_open_count == 0

        i2 = Issue.add('test2', 'test des1', 'testuser1', 'assignee')
        i3 = Issue.add('test3', 'test des1', 'testuser2', 'assignee')
        issue_rs = get_all_issue()
        assert len(issue_rs) == 3
        issue_open_count = len(filter(lambda x: x[1] is None, issue_rs))
        assert issue_open_count == 3
        assert len(issue_rs) - issue_open_count == 0

        i1.close('testuser1')
        issue_rs = get_all_issue()
        assert len(issue_rs) == 3
        issue_open_count = len(filter(lambda x: x[1] is None, issue_rs))
        assert issue_open_count == 2
        assert len(issue_rs) - issue_open_count == 1

        issue_comment_count = get_issue_comment_count()
        assert issue_comment_count == 0
        IssueComment.add(i2.id, 'content', 'test')
        IssueComment.add(i3.id, 'content', 'test1')
        issue_comment_count = get_issue_comment_count()
        assert issue_comment_count == 2
开发者ID:leeccong,项目名称:code,代码行数:35,代码来源:test_stat.py

示例3: __init__

 def __init__(
     self,
     id,
     project_id,
     issue_id,
     number,
     title=None,
     creator=None,
     assignee=None,
     closer=None,
     created_at=None,
     updated_at=None,
     closed_at=None,
     type="",
 ):
     Issue.__init__(
         self,
         issue_id,
         title,
         creator,
         assignee,
         closer,
         created_at,
         updated_at,
         closed_at,
         type=type,
         target_id=project_id,
     )
     self.id = id
     self.project_id = project_id
     self.issue_id = issue_id
     self.number = number
开发者ID:mozillazg,项目名称:code,代码行数:32,代码来源:project_issue.py

示例4: assign

 def assign(self, user_id):
     Issue.assign(self, user_id)
     self.clear_cache()
     mc.delete(MC_KEY_PROJECT_ISSUE_ASSIGNEE_N % (
         self.project_id, user_id, 'open'))
     mc.delete(MC_KEY_PROJECT_ISSUE_ASSIGNEE_N % (
         self.project_id, user_id, 'closed'))
开发者ID:000fan000,项目名称:code,代码行数:7,代码来源:project_issue.py

示例5: add

 def add(
     cls,
     title,
     description,
     creator,
     number=None,
     team=None,
     project=None,
     assignee=None,
     closer=None,
     created_at=None,
     updated_at=None,
     closed_at=None,
 ):
     issue = Issue.add(
         title, description, creator, assignee=assignee, closer=closer, type=cls.target_type, target_id=project
     )
     if issue and project:
         number = PICounter.incr(project, number)
         store.execute(
             "insert into project_issues (project_id, issue_id, number) " "values (%s, %s, %s) ",
             (project, issue.id, number),
         )
         store.commit()
         mc.delete(MC_KEY_PROJECT_ISSUE_CREATOR_N % (project, creator, "open"))
         mc.delete(MC_KEY_PROJECT_ISSUE_CREATOR_N % (project, creator, "closed"))
         cls._clean_cache(project)
         return Issue.get_cached_issue(issue.id)
开发者ID:mozillazg,项目名称:code,代码行数:28,代码来源:project_issue.py

示例6: __init__

 def __init__(self, id, team_id, issue_id, number, title=None,
              creator=None, assignee=None, closer=None,
              created_at=None, updated_at=None, closed_at=None,
              type=''):
     Issue.__init__(self, issue_id, title, creator, assignee, closer,
                    created_at, updated_at, closed_at, self.target_type)
     self.number = self.id
     from vilya.models.fair import FAIR_ID
     self.team_id = FAIR_ID
开发者ID:000fan000,项目名称:code,代码行数:9,代码来源:fair_issue.py

示例7: test_close_issue

 def test_close_issue(self):
     i = Issue.add('test', 'test description', 'test', 'assignee')
     i.close("test")
     i = Issue.get(i.id)
     assert i.title == 'test'
     assert i.description == 'test description'
     assert i.creator_id == 'test'
     assert i.closer_id == "test"
     assert i.assignee_id == 'assignee'
开发者ID:000fan000,项目名称:code,代码行数:9,代码来源:test_issue.py

示例8: test_update_issue

 def test_update_issue(self):
     i = Issue.add('test', 'test description', 'test', 'assignee')
     i.update("test1", "test1 description")
     i = Issue.get(i.id)
     assert i.title == 'test1'
     assert i.description == 'test1 description'
     assert i.creator_id == 'test'
     assert i.assignee_id == 'assignee'
     assert i.closer_id is None
开发者ID:000fan000,项目名称:code,代码行数:9,代码来源:test_issue.py

示例9: __init__

 def __init__(self, id, team_id, issue_id, number, title=None,
              creator=None, assignee=None, closer=None,
              created_at=None, updated_at=None, closed_at=None, type=''):
     Issue.__init__(self, issue_id, title,
                    creator, assignee, closer,
                    created_at, updated_at, closed_at, type=type,
                    target_id=team_id)
     self.id = id
     self.team_id = team_id
     self.issue_id = issue_id
     self.number = number
开发者ID:leeccong,项目名称:code,代码行数:11,代码来源:team_issue.py

示例10: test_closed_issue_should_not_vote

    def test_closed_issue_should_not_vote(self):
        self.test_team_issue.close(self.testuser1)
        self.test_team_issue = Issue.get_cached_issue(
            self.test_team_issue.issue_id)
        count = self.test_team_issue.upvote_by_user(self.testuser2)
        assert count == 0

        self.test_project_issue.close(self.testuser1)
        self.test_project_issue = Issue.get_cached_issue(
            self.test_project_issue.issue_id)
        count = self.test_project_issue.upvote_by_user(self.testuser2)
        assert count == 0
开发者ID:000fan000,项目名称:code,代码行数:12,代码来源:test_issue_upvote.py

示例11: get_multi_by

    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))
开发者ID:000fan000,项目名称:code,代码行数:35,代码来源:project_issue.py

示例12: get_by_proj_name_and_number

    def get_by_proj_name_and_number(cls, proj_name, number):
        from vilya.models.project import CodeDoubanProject

        project = CodeDoubanProject.get_by_name(proj_name)
        project_issue = cls.get(project.id, number=number)
        issue_id = project_issue.issue_id
        return Issue.get_cached_issue(issue_id)
开发者ID:mozillazg,项目名称:code,代码行数:7,代码来源:project_issue.py

示例13: test_add_issue

 def test_add_issue(self):
     i = Issue.add('test', 'test description', 'test', 'assignee')
     assert isinstance(i, Issue)
     assert i.title == 'test'
     assert i.description == 'test description'
     assert i.creator_id == 'test'
     assert i.assignee_id == 'assignee'
开发者ID:000fan000,项目名称:code,代码行数:7,代码来源:test_issue.py

示例14: __init__

    def __init__(self, issue_id):
        self.target = get_fair()
        self.issue_number = issue_id  # fair issue 直接拿 issue_id 当 number

        self.issue_id = issue_id
        self.issue = Issue.get_cached_issue(issue_id)
        self.issue_template = 'issue/team_issue.html'
开发者ID:leeccong,项目名称:code,代码行数:7,代码来源:fair.py

示例15: get_participated_issues

 def get_participated_issues(cls, user_id, state=None):
     from vilya.models.issue import Issue
     issues_created = cls.gets_by_creator_id(user_id, state)
     issues = [issue for issue in Issue.gets_by_participated_user(user_id,
                                                                  state)
               if issue not in issues_created]
     return issues
开发者ID:000fan000,项目名称:code,代码行数:7,代码来源:user_issue.py


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