Current File : //usr/lib/python2.7/site-packages/vdo/statistics/LabeledValue.pyc |
�
.�t_c @ s6 d Z d e f d � � YZ d e f d � � YZ d S( s�
LabeledValue - A sampled statistic with a label. Used for formatting stats
output.
$Id: //eng/vdo-releases/magnesium/src/python/vdo/statistics/LabeledValue.py#1 $
t LabeledValuec B sY e Z d Z e d � � Z d � Z d � Z d � Z d � Z d � Z d d d � Z RS( sl
An object which represents a labeled statistic value or a labeled collection
of other LabeledValues.
c C s) t | t � r t | | � St | | � S( s
Create a new labeled value.
:param label: The label
:param value: The value
:return: The new labeled value. If the supplied value is a list, the
returned object will be a LabeledValueList, otherwise it
will be a LabeledValue.
( t
isinstancet listt LabeledValueListR ( t labelt value( ( s? /usr/lib/python2.7/site-packages/vdo/statistics/LabeledValue.pyt make! s
c C s | | _ | | _ d S( s^
Create a new labeled value.
:param label: The label
:param value: The value
N( R R ( t selfR R ( ( s? /usr/lib/python2.7/site-packages/vdo/statistics/LabeledValue.pyt __init__1 s c C s t S( st
Check whether this is a collection or a single value.
:return: True if this is a collection of values
( t False( R ( ( s? /usr/lib/python2.7/site-packages/vdo/statistics/LabeledValue.pyt
isMultiValued; s c C s
t | j � S( sY
Get the width of the label for this value.
:return: The width of the label
( t lenR ( R ( ( s? /usr/lib/python2.7/site-packages/vdo/statistics/LabeledValue.pyt widthC s c C s
| j � S( sX
Get the maximum width of the labels of this value and/or all of
its sub-values.
:param hierarchical: Whether the format mode is hierarchical or not
:return: The width of this value or its immediate sub-values if
hierarchical, otherwise, the width of this value or its full tree
of sub-values.
( R ( R t hierarchical( ( s? /usr/lib/python2.7/site-packages/vdo/statistics/LabeledValue.pyt subWidthK s c C s t S( s�
Check whether this value has a subvalue for the given index.
:param index: The index into the subvalue list to check
:return: True if the indexed subvalue exists
( R ( R t index( ( s? /usr/lib/python2.7/site-packages/vdo/statistics/LabeledValue.pyt hasSubValueX s c C s
t | j � S( s�
Format this value and any of its children.
:param displaySpec: The display specification
:param joiner: The string for joining subvalues
( t strR ( R t displaySpect joiner( ( s? /usr/lib/python2.7/site-packages/vdo/statistics/LabeledValue.pyt formatb s N( t __name__t
__module__t __doc__t staticmethodR R R
R R R t NoneR ( ( ( s? /usr/lib/python2.7/site-packages/vdo/statistics/LabeledValue.pyR s
R c B s2 e Z d Z d � Z d � Z d � Z d � Z RS( sD
An object representing a labeled collection of labeled values.
c C s4 | r t d � | j D� � St d � | j D� � S( s
:inherit:
c s s | ] } | j � Vq d S( N( R ( t .0t v( ( s? /usr/lib/python2.7/site-packages/vdo/statistics/LabeledValue.pys <genexpr>t s c s s | ] } | j t � Vq d S( N( R R ( R R ( ( s? /usr/lib/python2.7/site-packages/vdo/statistics/LabeledValue.pys <genexpr>u s ( t maxR ( R R
( ( s? /usr/lib/python2.7/site-packages/vdo/statistics/LabeledValue.pyR o s c C s t S( s
:inherit:
( t True( R ( ( s? /usr/lib/python2.7/site-packages/vdo/statistics/LabeledValue.pyR
w s c C s4 y | j | j � d k SWn t k
r/ t SXd S( s
:inherit:
t N( R R t
IndexErrorR ( R R ( ( s? /usr/lib/python2.7/site-packages/vdo/statistics/LabeledValue.pyR } s
c C s5 | j t d g | j D] } | j | � ^ q � � S( s
:inherit:
N( t joint filterR R R ( R R R t lv( ( s? /usr/lib/python2.7/site-packages/vdo/statistics/LabeledValue.pyR � s ( R R R R R
R R ( ( ( s? /usr/lib/python2.7/site-packages/vdo/statistics/LabeledValue.pyR k s
N( R t objectR R ( ( ( s? /usr/lib/python2.7/site-packages/vdo/statistics/LabeledValue.pyt <module> s P