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


Python Score.get_top_list方法代码示例

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


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

示例1: get

# 需要导入模块: from score import Score [as 别名]
# 或者: from score.Score import get_top_list [as 别名]
	def get(self):
		self.response.out.write( "cronjob here!<br /><br />" )
		
		clean_invisible = unicode( self.request.get( "clean_invisible" ) )
		if clean_invisible == "yes":
			# Get a location.
			location = Country.get_random_location()
			# Get the locations lowest high score.
			for control in config.VALID_CONTROLS:
				lowest_score = Score.get_lowest_score( control, location )
				if lowest_score is None:
					continue
				self.clean_country( control, location, lowest_score )
		
		flush = unicode( self.request.get( "flush" ) )
		if flush == "yes":
			memcache.flush_all()
		
		reflag_week_shallow = unicode( self.request.get(
			"reflag_week_shallow" ) )
		if reflag_week_shallow == "yes":
			Score.reflag_new_week()
			
			Score._delete_cached_list( "tilt", config.LOCATION_WEEK )
			Score._delete_cached_list( "touch", config.LOCATION_WEEK )
			
			for control in ("tilt", "touch"):
				Score.get_top_list(config.TOP_LIST_LENGTH, control,
					config.LOCATION_WEEK)
		
		clear_world_week_duplicates = unicode( self.request.get(
			"clear_world_week_duplicates" ) )
		if clear_world_week_duplicates == "yes":
			for location in ( config.LOCATION_WORLD, config.LOCATION_WEEK ):
				for control in config.VALID_CONTROLS:
					self.delete_duplicates( control, location )
		
		clear_random_country_duplicates = unicode( self.request.get(
			"clear_random_country_duplicates" ) )
		if clear_random_country_duplicates == "yes":
			location = Country.get_random_location()
			for control in config.VALID_CONTROLS:
				self.delete_duplicates( control, location )
		
		clear_country_duplicates = unicode( self.request.get(
			"clear_country_duplicates" ) )
		if clear_country_duplicates != "":
			for control in config.VALID_CONTROLS:
				self.delete_duplicates( control, clear_country_duplicates )
		
		clear_all_country_duplicates = unicode( self.request.get(
			"clear_all_country_duplicates" ) )
		if clear_all_country_duplicates == "yes":
			start_location = Country.next_country()
			location = start_location
			count = 0
			try:
				while True:
					for control in config.VALID_CONTROLS:
						self.delete_duplicates( control, location )
					location = Country.next_country()
					count += 1
			except DeadlineExceededError, ex:
				logging.error( "CronJob.get: Got DeadlineExceededError. " \
					+ "Managed to clear %d countries from \"%s\" to \"%s\"",
					count, start_location, location )
				return
开发者ID:baskus,项目名称:prendo,代码行数:69,代码来源:cronjob.py

示例2: len

# 需要导入模块: from score import Score [as 别名]
# 或者: from score.Score import get_top_list [as 别名]
				count1 += 1
		
		count2 = 0
		for score in fetched:
			if score in to_remove:
				count2 += 1
		
		logging.info( "count1: %d, count2: %d", count1, count2 )
		
		try:
			db.delete( to_remove )
			self.response.out.write(
				"<br />all entities deleted successfully." )
		except Exception, msg:
			self.response.out.write( "<br />Got exception: '%s'." % msg \
				+ "<br />Some or all deletes might have failed." )
		
		if len(to_remove) > 0:
			# Clear the old lists.
			Score._delete_cached_list( control, location )
			# Request new lists so that they're cached.
			Score.get_top_list( config.TOP_LIST_LENGTH, control, location )

application = webapp.WSGIApplication( [ ( "/cronjob", CronJob ) ] )

def main():
	run_wsgi_app( application )

if __name__ == "__main__":
	main()
开发者ID:baskus,项目名称:prendo,代码行数:32,代码来源:cronjob.py


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