本文整理汇总了Python中vilya.models.project.CodeDoubanProject.get_watched_count方法的典型用法代码示例。如果您正苦于以下问题:Python CodeDoubanProject.get_watched_count方法的具体用法?Python CodeDoubanProject.get_watched_count怎么用?Python CodeDoubanProject.get_watched_count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vilya.models.project.CodeDoubanProject
的用法示例。
在下文中一共展示了CodeDoubanProject.get_watched_count方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_fork_and_watch_project
# 需要导入模块: from vilya.models.project import CodeDoubanProject [as 别名]
# 或者: from vilya.models.project.CodeDoubanProject import get_watched_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()
示例2: __init__
# 需要导入模块: from vilya.models.project import CodeDoubanProject [as 别名]
# 或者: from vilya.models.project.CodeDoubanProject import get_watched_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
示例3: get_repo_index_from_project
# 需要导入模块: from vilya.models.project import CodeDoubanProject [as 别名]
# 或者: from vilya.models.project.CodeDoubanProject import get_watched_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