Sindbad~EG File Manager

Current Path : /usr/lib/python3.6/site-packages/vdo/statistics/__pycache__/
Upload File :
Current File : //usr/lib/python3.6/site-packages/vdo/statistics/__pycache__/LabeledValue.cpython-36.pyc

3

x?ag"�@sXdZddlmZddlmZddlmZddlmZGdd�de�ZGdd	�d	e�Zd
S)z�
  LabeledValue - A sampled statistic with a label. Used for formatting stats
  output.

  $Id: //eng/vdo-releases/aluminum/src/python/vdo/statistics/LabeledValue.py#2 $
�)�absolute_import)�division)�print_function)�unicode_literalsc@sNeZdZdZedd��Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
ddd�ZdS)�LabeledValuezl
  An object which represents a labeled statistic value or a labeled collection
  of other LabeledValues.
  cCst|t�rt||�St||�S)a
    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.
    )�
isinstance�list�LabeledValueListr)�label�value�r�"/usr/lib/python3.6/LabeledValue.py�make%s

zLabeledValue.makecCs||_||_dS)z^
    Create a new labeled value.

    :param label: The label
    :param value: The value
    N)r
r)�selfr
rrrr
�__init__5szLabeledValue.__init__cCsdS)zt
    Check whether this is a collection or a single value.

    :return: True if this is a collection of values
    Fr)rrrr
�
isMultiValued?szLabeledValue.isMultiValuedcCs
t|j�S)zY
    Get the width of the label for this value.

    :return: The width of the label
    )�lenr
)rrrr
�widthGszLabeledValue.widthcCs|j�S)aX
    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�hierarchicalrrr
�subWidthOszLabeledValue.subWidthcCsdS)z�
    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
    Fr)r�indexrrr
�hasSubValue\szLabeledValue.hasSubValueNcCs"t|jt�r|jjd�St|j�S)z�
    Format this value and any of its children.

    :param displaySpec: The display specification
    :param joiner:      The string for joining subvalues
    �ASCII)rr�bytes�decode�str)r�displaySpec�joinerrrr
�formatfszLabeledValue.format)NN)�__name__�
__module__�__qualname__�__doc__�staticmethodrrrrrrrrrrr
rs


rc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)r	zD
  An object representing a labeled collection of labeled values.
  cCs,|rtdd�|jD��Stdd�|jD��S)z
    :inherit:
    css|]}|j�VqdS)N)r)�.0�vrrr
�	<genexpr>zsz,LabeledValueList.subWidth.<locals>.<genexpr>css|]}|jd�VqdS)FN)r)r$r%rrr
r&{s)�maxr)rrrrr
ruszLabeledValueList.subWidthcCsdS)z
    :inherit:
    Tr)rrrr
r}szLabeledValueList.isMultiValuedcCs,y|j|j�dkStk
r&dSXdS)z
    :inherit:
    �FN)rr�
IndexError)rrrrr
r�szLabeledValueList.hasSubValuecs |jtd�fdd�|jD���S)z
    :inherit:
    Ncsg|]}�j|��qSr)r)r$Zlv)rrr
�
<listcomp>�sz+LabeledValueList.format.<locals>.<listcomp>)�join�filterr)rrrr)rr
r�szLabeledValueList.formatN)rr r!r"rrrrrrrr
r	qs
	r	N)	r"Z
__future__rrrr�objectrr	rrrr
�<module>sR

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists