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


Python CodeDoubanProject.get_forked_count方法代码示例

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


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

示例1: index_a_project

# 需要导入模块: from vilya.models.project import CodeDoubanProject [as 别名]
# 或者: from vilya.models.project.CodeDoubanProject import get_forked_count [as 别名]
    def index_a_project(cls, project):
        indexes = cls.get_src_indexes_from_project(project)

        # FIXME: change project_rank algrithm
        project_rank = CodeDoubanProject.get_forked_count(project.id)
        for id, data in indexes:
            data['project_rank'] = project_rank

        IndexEngine.create_index_bulk('src', indexes)
开发者ID:000fan000,项目名称:code,代码行数:11,代码来源:src_search.py

示例2: test_fork_and_watch_project

# 需要导入模块: from vilya.models.project import CodeDoubanProject [as 别名]
# 或者: from vilya.models.project.CodeDoubanProject import get_forked_count [as 别名]
    def test_fork_and_watch_project(self):
        p6 = CodeDoubanProject.add('project6', owner_id="admin_user",
                                   summary="test", product="fire")
        p7 = CodeDoubanProject.add('project7', owner_id="other_user",
                                   summary="test", product="fire")

        fork_count = CodeDoubanProject.get_forked_count(p6.id)
        p6fork = p6.fork('project6_other_user', 'other_user')
        fork_count2 = CodeDoubanProject.get_forked_count(p6.id)
        ok_(fork_count2 == fork_count + 1)
        ok_(CodeDoubanProject.get_forked_count(p6fork.id) == 0)

        p6fork2 = p6fork.fork('project6_fork_other_user', 'other_user')
        ok_(CodeDoubanProject.get_forked_count(p6.id) == fork_count + 2)
        ok_(CodeDoubanProject.get_forked_count(p6fork.id) == 1)
        ok_(CodeDoubanProject.get_forked_count(p6fork2.id) == 0)

        watch_count = CodeDoubanProject.get_watched_count(p7.id)
        CodeDoubanProject.add_watch(p7.id, 'admin_user')
        watch_count2 = CodeDoubanProject.get_watched_count(p7.id)
        ok_(watch_count2 == watch_count + 1)

        ok_(len(p7.get_watch_users()) == watch_count2)

        p6.delete()
        p7.delete()
开发者ID:000fan000,项目名称:code,代码行数:28,代码来源:test_project.py

示例3: __init__

# 需要导入模块: from vilya.models.project import CodeDoubanProject [as 别名]
# 或者: from vilya.models.project.CodeDoubanProject import get_forked_count [as 别名]
 def __init__(self, id='', last_updated_str='', hl_description=''):
     self.id = str(id)
     self.project = CodeDoubanProject.get(id)
     self.name = self.project.name
     self.owner = User(self.project.owner_name)
     self.last_updated = datetime.strptime(
         last_updated_str, DATE_FORMAT) if last_updated_str \
         else self.project.time
     self.create_time = self.project.time
     self.description = self.project.summary
     self.url = self.project.url
     self.language = self.project.language
     self.fork_from = self.project.get_forked_from()
     self.forked_count = CodeDoubanProject.get_forked_count(self.project.id)
     self.watched_count = CodeDoubanProject.get_watched_count(
         self.project.id)
     self.hl_description = hl_description or self.description
开发者ID:000fan000,项目名称:code,代码行数:19,代码来源:repo_search.py

示例4: get_repo_index_from_project

# 需要导入模块: from vilya.models.project import CodeDoubanProject [as 别名]
# 或者: from vilya.models.project.CodeDoubanProject import get_forked_count [as 别名]
 def get_repo_index_from_project(cls, project):
     fork_from = project.get_forked_from()
     fork_from = fork_from.name if fork_from else ''
     last_commit = project.repo.get_last_commit('HEAD')
     commit_time = last_commit.commit_time if last_commit else project.time
     index_data = dict(
         id=str(project.id),
         name=project.name,
         owner=project.owner_name,
         description=project.summary,
         url=project.url,
         language=project.language,
         fork_from=fork_from,
         forked_count=CodeDoubanProject.get_forked_count(project.id),
         watched_count=CodeDoubanProject.get_watched_count(project.id),
         create_time=project.time.strftime(DATE_FORMAT),
         last_updated=commit_time.strftime(DATE_FORMAT),
     )
     return index_data
开发者ID:000fan000,项目名称:code,代码行数:21,代码来源:repo_search.py


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