本文整理汇总了Python中session.Session.all方法的典型用法代码示例。如果您正苦于以下问题:Python Session.all方法的具体用法?Python Session.all怎么用?Python Session.all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类session.Session
的用法示例。
在下文中一共展示了Session.all方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: refine_scan_action_estimates
# 需要导入模块: from session import Session [as 别名]
# 或者: from session.Session import all [as 别名]
def refine_scan_action_estimates():
# FIXME: Should also check last SERPs of all queries (no clicks after page switch -> no record of scans)
queries_count = Query.count()
every_tenth = int(queries_count / 10)
sys.stdout.write("Refining scan action estimates for %i queries..." % queries_count)
current_queries_count = 0
for session in Session.all():
for query in session.sorted_queries():
current_queries_count += 1
sys.stdout.write('.')
if current_queries_count % every_tenth == 0:
sys.stdout.write('-' + str(current_queries_count) + '-')
sys.stdout.flush()
# First page examined but nothing clicked -> no record of scanned snippets
# Estimate scans by looking at total scanning time, and comparing to average scanning time
if len(query.document_read_actions()) == 0 and query.never_switched_from_first_serp():
estimate_single_serp_query_scan_actions(query)
elif query.no_document_actions_on_last_serp():
estimate_last_serp_query_scan_actions(query)
sys.stdout.write('\n')