本文整理汇总了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
示例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