本文整理汇总了Python中r2.models.Message._by_fullname方法的典型用法代码示例。如果您正苦于以下问题:Python Message._by_fullname方法的具体用法?Python Message._by_fullname怎么用?Python Message._by_fullname使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类r2.models.Message
的用法示例。
在下文中一共展示了Message._by_fullname方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _load_messages
# 需要导入模块: from r2.models import Message [as 别名]
# 或者: from r2.models.Message import _by_fullname [as 别名]
def _load_messages(mlist):
from r2.models import Message
m = {}
ids = [x for x in mlist if not isinstance(x, Message)]
if ids:
m = Message._by_fullname(ids, return_dict = True, data = True)
messages = [m.get(x, x) for x in mlist]
return messages
示例2: long
# 需要导入模块: from r2.models import Message [as 别名]
# 或者: from r2.models.Message import _by_fullname [as 别名]
return True
resume_id = long(sys.argv[1]) if len(sys.argv) > 1 else None
msg_accounts = Account._query(sort=desc("_date"), data=True)
if resume_id:
msg_accounts._filter(Account.c._id < resume_id)
for account in progress(fetch_things2(msg_accounts), estimate=resume_id):
current_inbox_count = account.inbox_count
unread_messages = list(queries.get_unread_inbox(account))
if account._id % 100000 == 0:
g.reset_caches()
if not len(unread_messages):
if current_inbox_count:
account._incr('inbox_count', -current_inbox_count)
else:
msgs = Message._by_fullname(
unread_messages,
data=True,
return_dict=False,
ignore_missing=True,
)
kept_msgs = sum(1 for msg in msgs if _keep(msg, account))
if kept_msgs or current_inbox_count:
account._incr('inbox_count', kept_msgs - current_inbox_count)