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


Python CodeDoubanProject.get方法代码示例

本文整理汇总了Python中vilya.models.project.CodeDoubanProject.get方法的典型用法代码示例。如果您正苦于以下问题:Python CodeDoubanProject.get方法的具体用法?Python CodeDoubanProject.get怎么用?Python CodeDoubanProject.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vilya.models.project.CodeDoubanProject的用法示例。


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

示例1: test_destroy_hook

# 需要导入模块: from vilya.models.project import CodeDoubanProject [as 别名]
# 或者: from vilya.models.project.CodeDoubanProject import get [as 别名]
 def test_destroy_hook(self):
     url = "http://this.is.other.url"
     prj = self._prj()
     hook = CodeDoubanHook.add(url, prj.id)
     hooked_project = CodeDoubanProject.get(hook.project_id)
     assert len(hooked_project.hooks) == 1
     hooked_project = CodeDoubanProject.get(hook.project_id)
     hook.destroy()
     assert len(hooked_project.hooks) == 0
开发者ID:000fan000,项目名称:code,代码行数:11,代码来源:test_hook.py

示例2: unwatch

# 需要导入模块: from vilya.models.project import CodeDoubanProject [as 别名]
# 或者: from vilya.models.project.CodeDoubanProject import get [as 别名]
def unwatch(request):
    user = request.user
    if not user:
        return request.redirect("/")
    errors = ""
    if request.method == "POST":
        proj_id = request.get_form_var('proj_id')
        CodeDoubanProject.del_watch(proj_id, user.name)
        project = CodeDoubanProject.get(proj_id)
        return request.redirect('/%s/' % project.name)

    proj_id = request.get_form_var('proj_id') or ""
    project = CodeDoubanProject.get(proj_id)
    action = "unwatch"
    return st('watch.html', **locals())
开发者ID:000fan000,项目名称:code,代码行数:17,代码来源:__init__.py

示例3: test_add_hook

# 需要导入模块: from vilya.models.project import CodeDoubanProject [as 别名]
# 或者: from vilya.models.project.CodeDoubanProject import get [as 别名]
 def test_add_hook(self):
     url = "http://this.is.a.url"
     prj = self._prj()
     hook = CodeDoubanHook.add(url, prj.id)
     hooked_project = CodeDoubanProject.get(hook.project_id)
     assert hooked_project
     assert hook.__dict__ == hooked_project.hooks[0].__dict__
开发者ID:000fan000,项目名称:code,代码行数:9,代码来源:test_hook.py

示例4: _make_cmd

# 需要导入模块: from vilya.models.project import CodeDoubanProject [as 别名]
# 或者: from vilya.models.project.CodeDoubanProject import get [as 别名]
 def _make_cmd(self):
     assert self.temp_dir
     sphinx_builder = self.config.get('builder', self.builder)  # noqa TODO rm self.builder when no more old config
     assert sphinx_builder in [
         'pickle', 'html'], "sphinx builder %s unknown" % sphinx_builder
     options = []
     prj = CodeDoubanProject.get(self.project_id)
     default_options = {
         'master_doc': self.masterdoc,
         'source_suffix': '.rst',
         'html_short_title': prj.name,
     }
     options_dict = default_options.copy()
     if self.config:
         options_dict.update(self.config)
     for k, v in options_dict.items():
         options.extend(['-D', '%s=%s' % (k, v)])
     cmd = [
         'sphinx-build',
         '-a',  # -- write all files; default is to only write new and changed files
         '-E',  # -- don't use a saved environment, always read all files
         '-b', sphinx_builder,  # -- builder to use
         '-D', 'project=%s' % prj.name,
         # -- override a setting in configuration
     ]
     cmd += options
     cmd += ['-d', os.path.join(self.temp_dir, SPHINX_BUILD_DOCTREES)]  # -- path for the cached environment and doctree files
     cmd += ['-q']
     if self._has_sphinx_conf():
         cmd += ['-c', self.temp_dir]  # -- path where configuration file (conf.py) is located
     else:
         cmd += ['-C']  # No conf.py file
     cmd += [self.temp_dir, self._path(tmp=True)]
     return cmd
开发者ID:leeccong,项目名称:code,代码行数:36,代码来源:sphinx_docs.py

示例5: async_comment_to_pr

# 需要导入模块: from vilya.models.project import CodeDoubanProject [as 别名]
# 或者: from vilya.models.project.CodeDoubanProject import get [as 别名]
def async_comment_to_pr(data):
    ''' commit comment rewrite to pr '''
    type_ = data.get('type')
    if type_ not in ('commit_comment', 'commit_linecomment'):
        return

    comment = data.get('comment')
    ref = comment.get('ref')
    author = comment.get('author')
    content = comment.get('content')
    proj_id = comment.get('project_id')
    comment_uid = comment.get('comment_uid')
    proj = CodeDoubanProject.get(proj_id)
    prs = proj.open_family_pulls
    anchor = comment_uid

    for pr in prs:
        if ref in pr.get_commits_shas():
            content = COMMENT_TEMPLATE.format(content=content,
                                              domain=DOMAIN,
                                              proj=proj.name,
                                              sha=ref,
                                              anchor=anchor)
            ticket = Ticket.get_by_projectid_and_ticketnumber(
                pr.to_proj.id, pr.ticket_id)
            ticket.add_comment(content, author)
开发者ID:000fan000,项目名称:code,代码行数:28,代码来源:comment_actions.py

示例6: __init__

# 需要导入模块: from vilya.models.project import CodeDoubanProject [as 别名]
# 或者: from vilya.models.project.CodeDoubanProject import get [as 别名]
 def __init__(self, ticket):
     self.project = CodeDoubanProject.get(ticket.project_id)
     self.proj_name = self.project.name
     self.ticket_id = ticket.ticket_number
     self.ticket = ticket
     self.pullreq = PullRequest.get_by_proj_and_ticket(
         self.project.id, self.ticket_id)
开发者ID:000fan000,项目名称:code,代码行数:9,代码来源:pull.py

示例7: __init__

# 需要导入模块: from vilya.models.project import CodeDoubanProject [as 别名]
# 或者: from vilya.models.project.CodeDoubanProject import get [as 别名]
 def __init__(self, data):
     NotificationDispatcher.__init__(self, data)
     self._comment = data.get('comment')
     # TODO: get commit author by sha # ...现在应该是 None
     self._commit_author = data.get('commit_author')
     self._is_line_comment = data.get('is_line_comment')  # no use
     self._proj = CodeDoubanProject.get(self._comment.project_id)
开发者ID:000fan000,项目名称:code,代码行数:9,代码来源:comment.py

示例8: __init__

# 需要导入模块: from vilya.models.project import CodeDoubanProject [as 别名]
# 或者: from vilya.models.project.CodeDoubanProject import get [as 别名]
 def __init__(self, project_id, ticket_number, hl_description):
     self.ticket = Ticket.get_by_projectid_and_ticketnumber(
         project_id, ticket_number)
     self.ticket_project = CodeDoubanProject.get(self.ticket.project_id)
     self.author = User(self.ticket.author)
     self.ticket_url = self.ticket.url
     self.hl_description = hl_description if hl_description \
         else self.ticket.description
开发者ID:000fan000,项目名称:code,代码行数:10,代码来源:issue_pr_search.py

示例9: _builders_list

# 需要导入模块: from vilya.models.project import CodeDoubanProject [as 别名]
# 或者: from vilya.models.project.CodeDoubanProject import get [as 别名]
def _builders_list(project_id):
    prj = CodeDoubanProject.get(project_id)
    if not prj.conf['docs']:
        return [DEFAULT_BUILDER]
    blds = [(v.get('sort'), k) for k, v in prj.conf['docs'].items()]
    blds = sorted(blds)
    blds = [_[1] for _ in blds]
    return blds
开发者ID:leeccong,项目名称:code,代码行数:10,代码来源:sphinx_docs.py

示例10: _get_project_by_id

# 需要导入模块: from vilya.models.project import CodeDoubanProject [as 别名]
# 或者: from vilya.models.project.CodeDoubanProject import get [as 别名]
def _get_project_by_id(id):
    project = {}
    _project = CodeDoubanProject.get(id)
    _author = _get_user_by_name(_project.owner_id)
    project = dict(
        id=_project.id,
        name=_project.name,
        owner=_author,
    )
    return project
开发者ID:000fan000,项目名称:code,代码行数:12,代码来源:timeline.py

示例11: __init__

# 需要导入模块: from vilya.models.project import CodeDoubanProject [as 别名]
# 或者: from vilya.models.project.CodeDoubanProject import get [as 别名]
 def __init__(self, builder, project_id):
     self.builder = builder
     self.project_id = project_id
     prj = CodeDoubanProject.get(project_id)
     self.docs_dir = os.path.join(get_repo_root(),
                                  prj.name + DOC_EXT, builder)
     self.config = _builder_conf(project_id, builder)
     self.dir = self.config['dir']
     self.temp_dir = None
     self.temp_dir_root = None
开发者ID:leeccong,项目名称:code,代码行数:12,代码来源:sphinx_docs.py

示例12: __init__

# 需要导入模块: from vilya.models.project import CodeDoubanProject [as 别名]
# 或者: from vilya.models.project.CodeDoubanProject import get [as 别名]
    def __init__(self, id, project_id, sha, state, target_url, description, time, author):
        self.project_id = project_id
        self.sha = sha
        self.id = id
        self.state = state
        self.target_url = target_url
        self.description = description
        self.time = time
        self.author = author

        self.project = CodeDoubanProject.get(self.project_id)
开发者ID:leeccong,项目名称:code,代码行数:13,代码来源:commit_statuses.py

示例13: _builder_conf

# 需要导入模块: from vilya.models.project import CodeDoubanProject [as 别名]
# 或者: from vilya.models.project.CodeDoubanProject import get [as 别名]
def _builder_conf(project_id, builder_name):
    prj = CodeDoubanProject.get(project_id)
    if not prj.conf.get('docs'):
        return {'dir': builder_name}
    conf = prj.conf['docs'].get(builder_name, False)
    if not conf:
        return {'dir': builder_name}
    if 'dir' not in conf:
        conf['dir'] = builder_name  # When no explicit dir, use the name
    if 'checkout_root' not in conf:
        conf['checkout_root'] = SPHINX_DEFAULT_CHECKOUT_ROOT
    return conf
开发者ID:leeccong,项目名称:code,代码行数:14,代码来源:sphinx_docs.py

示例14: add_fork_project

# 需要导入模块: from vilya.models.project import CodeDoubanProject [as 别名]
# 或者: from vilya.models.project.CodeDoubanProject import get [as 别名]
 def add_fork_project(project):
     name = "%s/%s" % (project.owner_id, project.name)
     _project = CodeDoubanProject.add(
         name=name, owner_id=project.owner_id, summary=project.summary,
         product=project.product, fork_from=project.fork_from,
         intern_banned=project.intern_banned)
     if _project:
         fork_from_project = CodeDoubanProject.get(project.fork_from)
         _project.update(project.summary,
                         project.product,
                         name,
                         fork_from_project.intern_banned)
     return _project
开发者ID:000fan000,项目名称:code,代码行数:15,代码来源:__init__.py

示例15: _export_docs_tree

# 需要导入模块: from vilya.models.project import CodeDoubanProject [as 别名]
# 或者: from vilya.models.project.CodeDoubanProject import get [as 别名]
def _export_docs_tree(project_id, tree_hash, temp_dir):
    _call = CodeDoubanProject.get(project_id).git.call
    debug('Exporting docs tree')
    _call('read-tree --empty')
    try:
        _call('read-tree %s' % tree_hash)
    except GytError as e:
        if 'failed to unpack tree object' in e.args[2]:
            return False, 'failed to unpack tree object'
        else:
            raise
    # TODO use gyt repo to handle worktree
    _call('--work-tree %s checkout-index --force -a' % temp_dir)
    debug('Checked out the docs content work-tree')
    return True, ''
开发者ID:leeccong,项目名称:code,代码行数:17,代码来源:sphinx_docs.py


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