本文整理匯總了Python中r2.models.LiveAdWeights.get方法的典型用法代碼示例。如果您正苦於以下問題:Python LiveAdWeights.get方法的具體用法?Python LiveAdWeights.get怎麽用?Python LiveAdWeights.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類r2.models.LiveAdWeights
的用法示例。
在下文中一共展示了LiveAdWeights.get方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: live_by_subreddit
# 需要導入模塊: from r2.models import LiveAdWeights [as 別名]
# 或者: from r2.models.LiveAdWeights import get [as 別名]
def live_by_subreddit(cls, sr):
if sr == Frontpage:
sr_id = ''
else:
sr_id = sr._id
r = LiveAdWeights.get([sr_id])
return [i.link for i in r[sr_id]]
示例2: get_live_promotions
# 需要導入模塊: from r2.models import LiveAdWeights [as 別名]
# 或者: from r2.models.LiveAdWeights import get [as 別名]
def get_live_promotions(srids):
timer = g.stats.get_timer("promote.get_live")
timer.start()
weights = LiveAdWeights.get(srids)
timer.stop()
return weights