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


Python Message._by_fullname方法代码示例

本文整理汇总了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
开发者ID:Omosofe,项目名称:reddit,代码行数:10,代码来源:comment_tree.py

示例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)
开发者ID:0xcd03,项目名称:reddit,代码行数:32,代码来源:msgtime_to_inbox_count.py


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