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


Python Histogram.name方法代码示例

本文整理汇总了Python中histogram.Histogram.name方法的典型用法代码示例。如果您正苦于以下问题:Python Histogram.name方法的具体用法?Python Histogram.name怎么用?Python Histogram.name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在histogram.Histogram的用法示例。


在下文中一共展示了Histogram.name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _get_ping_property

# 需要导入模块: from histogram import Histogram [as 别名]
# 或者: from histogram.Histogram import name [as 别名]
def _get_ping_property(cursor, path, histograms_url, additional_histograms):
    is_histogram = False
    is_keyed_histogram = False

    if path[0] == "histograms":
        is_histogram = True
    elif path[0] == "keyedHistograms":
        # Deal with histogram names that contain a slash...
        path = path[:2] + (["/".join(path[2:])] if len(path) > 2 else [])
        is_keyed_histogram = True

    try:
        for field in path:
            cursor = cursor[field]
    except:
        return None

    if cursor is None:
        return None
    if is_histogram:
        return Histogram(path[-1], cursor, histograms_url=histograms_url,
                         additional_histograms=additional_histograms)
    elif is_keyed_histogram:
        histogram = Histogram(path[-2], cursor, histograms_url=histograms_url,
                              additional_histograms=additional_histograms)
        histogram.name = "/".join(path[-2:])
        return histogram
    else:
        return cursor
开发者ID:andymckay,项目名称:python_moztelemetry,代码行数:31,代码来源:spark.py

示例2: _get_ping_property

# 需要导入模块: from histogram import Histogram [as 别名]
# 或者: from histogram.Histogram import name [as 别名]
def _get_ping_property(cursor, path):
    is_histogram = False
    is_keyed_histogram = False

    if path[0] == "histograms":
        is_histogram = True
    elif path[0] == "keyedHistograms":
        # Deal with histogram names that contain a slash...
        path = path[:2] + (["/".join(path[2:])] if len(path) > 2 else [])
        is_keyed_histogram = True

    for partial in path:
        cursor = cursor.get(partial, None)

        if cursor is None:
            break

    if cursor is None:
        return None
    if is_histogram:
        return Histogram(path[-1], cursor)
    elif is_keyed_histogram:
        histogram = Histogram(path[-2], cursor)
        histogram.name = "/".join(path[1:])
        return histogram
    else:
        return cursor
开发者ID:SamPenrose,项目名称:python_moztelemetry,代码行数:29,代码来源:spark.py


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