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


Python Comment.select方法代码示例

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


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

示例1: get_data

# 需要导入模块: from model import Comment [as 别名]
# 或者: from model.Comment import select [as 别名]
def get_data():
    query = Comment.select()
    num_data = []
    corpuses = []
    for comment in query:
       data, corpus = create_row(comment) 
       num_data.append(data)
       corpuses.append(corpus)
    return (np.array(num_data), np.array(corpuses))
开发者ID:joeally,项目名称:part-III-proj,代码行数:11,代码来源:classifier2.py

示例2: submit_guesses

# 需要导入模块: from model import Comment [as 别名]
# 或者: from model.Comment import select [as 别名]
def submit_guesses():
   data = json.loads(request.forms.get("data"))
   answers = data['answers']
   quiz_type = data['type']
   num_correct = 0
   total = len(answers) 
   for guess in answers:
       UserGuess.create(guess=int(guess['answer']), comment=guess['comment_id'], quiz_type=quiz_type)
       actual_count = Comment.select().where(Comment.c_id == guess['comment_id'])[0].upvotes
       num_correct += 1 if detect_group(actual_count) == int(guess['answer']) else 0
   return json.dumps({"num_correct": num_correct, "total": total})
开发者ID:joeally,项目名称:part-III-proj,代码行数:13,代码来源:app.py

示例3: list

# 需要导入模块: from model import Comment [as 别名]
# 或者: from model.Comment import select [as 别名]
 def list(self):
     results = Comment.select(Comment.q.handled == False).reversed()
     return dict(title="BandRadar Comments", grid=datagrid, data=results)
开发者ID:agrover,项目名称:BandRadar,代码行数:5,代码来源:comments.py

示例4: training_comments

# 需要导入模块: from model import Comment [as 别名]
# 或者: from model.Comment import select [as 别名]
def training_comments(test_ids, limit=None):
    test_set = set(test_ids)
    comments = Comment.select().join(Submission, on=(Comment.submission == Submission.s_id))
    return filter(lambda comment: comment.c_id not in test_set, comments)
开发者ID:joeally,项目名称:part-III-proj,代码行数:6,代码来源:classifier2.py

示例5: from_group

# 需要导入模块: from model import Comment [as 别名]
# 或者: from model.Comment import select [as 别名]
def from_group(group, groups=groups, num=3):
    """from_group(group[, groups=default_defs, num=3])
   Returns list of num random rows from the comment table based on the a definition held in groups with identifier group"""
    return list(Comment.select().where(groups[group](Comment.upvotes)).order_by(fn.Rand()).limit(num))
开发者ID:joeally,项目名称:part-III-proj,代码行数:6,代码来源:groups.py


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