本文整理汇总了Python中score.Score.save方法的典型用法代码示例。如果您正苦于以下问题:Python Score.save方法的具体用法?Python Score.save怎么用?Python Score.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类score.Score
的用法示例。
在下文中一共展示了Score.save方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_result_set
# 需要导入模块: from score import Score [as 别名]
# 或者: from score.Score import save [as 别名]
def create_result_set(self, reading_system, testsuite, user):
from result import Result
from score import Score, AccessibilityScore
from testsuite_app import helper_functions
last_updated = helper_functions.generate_timestamp()
result_set = ResultSet(reading_system = reading_system, testsuite=testsuite, last_updated = last_updated, user = user)
result_set.save()
print "Creating result set"
# create empty results for each test
tests = testsuite.get_tests()
for test in tests:
result = Result(result_set = result_set, test = test)
result.save()
# create empty scores for each category
categories = testsuite.get_categories()
for cat in categories:
if testsuite.testsuite_type == common.TESTSUITE_TYPE_DEFAULT:
score = Score(category = cat, result_set = result_set)
score.save()
else:
score = AccessibilityScore(category = cat, result_set = result_set)
score.save()
if testsuite.testsuite_type == common.TESTSUITE_TYPE_DEFAULT:
overall_score = Score(category = None, result_set = result_set)
overall_score.save()
else:
overall_score = AccessibilityScore(category = None, result_set = result_set)
overall_score.save()
result_set.visibility = reading_system.visibility
return result_set
示例2: create_evaluation
# 需要导入模块: from score import Score [as 别名]
# 或者: from score.Score import save [as 别名]
def create_evaluation(self, reading_system):
"Create and return a new evaluation, along with an initialized set of result objects."
from test import Test
from score import Score
from result import Result
from category import Category
from testsuite import TestSuite
testsuite = TestSuite.objects.get_most_recent_testsuite()
print "Creating evaluation for testsuite {0}".format(testsuite.version_date)
tests = Test.objects.filter(testsuite = testsuite)
evaluation = self.create(
testsuite = testsuite,
last_updated = generate_timestamp(),
percent_complete = 0.00,
reading_system = reading_system
)
evaluation.save()
total_score = Score(category = None, evaluation = evaluation)
total_score.save()
# create results for this evaluation
for t in tests:
result = Result(test = t, evaluation = evaluation, result = RESULT_NOT_ANSWERED)
result.save()
# update the score once results have been created
total_score.update(evaluation.get_all_results())
# create category score entries for this evaluation
categories = Category.objects.filter(testsuite = evaluation.testsuite)
for cat in categories:
score = Score(
category = cat,
evaluation = evaluation
)
score.update(evaluation.get_category_results(cat))
score.save()
return evaluation
示例3:
# 需要导入模块: from score import Score [as 别名]
# 或者: from score.Score import save [as 别名]
#####Slide-Sound########
sounds.play_slide_sound()
grid.fill_random()
if grid.area.all() and not gameover:#grid full and not yet gameover
if not grid.check_merge():
move_timeout = timer + 3 #3 seconds gameover
####Lose Sound####
sounds.play_lose_sound()
gameover = True
else:
if e.key == P.K_m:
show_moves = not show_moves
continue
elif e.type == P.KEYDOWN and gameover:
if move_timeout <= timer and e.key == P.K_RIGHT:
score.save()
new_Round()
#####LOGICBLOCK#####
EM.dispatch("game_logic_start", grid)
#####RENDERBLOCK#####
fizzles.render(D)
EM.dispatch("game_frame_start", D)
delta = grid.area != grid.last #elementwise check for matrix
for x,y in posses:
pos = centers[(x,y)]
val = grid.area[x, y]