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