cache.py 文件源码

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

项目:RPiNWR 作者: ke4roh 项目源码 文件源码
def get_active_messages(self, when=None, event_pattern=None, here=True):
        """
        :param when: the time for which to check effectiveness of the messages, default = the present time
        :param event_pattern: a regular expression to match the desired event codes.  default = all.
        :param here: True to retrieve local messages, False to retrieve those for other locales
        """
        if when is None:
            when = time.time()
        if event_pattern is None:
            event_pattern = re.compile(".*")
        elif not hasattr(event_pattern, 'match'):
            event_pattern = re.compile(event_pattern)

        l = list(filter(lambda m: m.is_effective(self.latlon, self.county_fips, here, when) and event_pattern.match(
            m.get_event_type()), self.__messages.values()))
        l.sort(key=functools.cmp_to_key(self.sorter))
        return l
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号