aggregates.py 文件源码

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

项目:python-gnocchiclient 作者: gnocchixyz 项目源码 文件源码
def _convert_dates(cls, data):
        # NOTE(sileht): browse to aggregates measures dict tree and convert
        # date when we found timeseries, dict can looks like
        # {"aggregated": ...}, {"metric_id": {"agg": ...}} or
        # {"resource_id": {"metric_name": {"agg": ...}}}
        for key in data:
            if isinstance(data[key], list):
                data[key] = [(iso8601.parse_date(ts), g, value)
                             for ts, g, value in data[key]]
            elif isinstance(data[key], dict):
                cls._convert_dates(data[key])
            else:
                raise RuntimeError("Unexpected aggregates API output %s" %
                                   data[key])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号