user_conversations.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:facebook-message-analysis 作者: szheng17 项目源码 文件源码
def filter_by_last_message_dt(self, start_dt=datetime.min, end_dt=datetime.max):
        """
        Returns a copy of self after filtering self.conversations by
        conversations whose last messages lie in a datetime interval.

        Args:
            start_dt: A datetime object satisfying start_dt <= end_dt.
            end_dt: A datetime object satisfying start_dt <= end_dt.

        Returns:
            A UserConversations object that is equal to self after filtering
                self.conversations such that the datetime of the last message
                in each conversation is in the closed interval
                [start_dt, end_dt].

        Raises:
            EmptyUserConversationsError: Filtering self.conversations results
                in an empty list.
        """
        if start_dt > end_dt:
            raise ValueError('Must have start_dt <= end_dt')
        conversation_filter = lambda x: x.messages[-1].timestamp >= start_dt and x.messages[-1].timestamp <= end_dt
        return self.filter_user_conversations(conversation_filter)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号