- GRAYBYTE UNDETECTABLE CODES -

403Webshell
Server IP : 184.154.167.98  /  Your IP : 18.226.214.1
Web Server : Apache
System : Linux pink.dnsnetservice.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
User : puertode ( 1767)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3.6/site-packages/vdo/statistics/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3.6/site-packages/vdo/statistics/__pycache__/StatFormatter.cpython-36.pyc
3

x?ag#�@s�dZddlmZddlmZddlmZddlmZddlZyedd�ZWne	k
rhd	d�ZYnXGd
d�de
�ZGdd
�d
e
�ZdS)zb
  DisplaySpec

  $Id: //eng/vdo-releases/aluminum/src/python/vdo/statistics/StatFormatter.py#2 $
�)�absolute_import)�division)�print_function)�unicode_literalsNcCs
t|t�S)N)�
isinstance�
basestring)�s�r	�#/usr/lib/python3.6/StatFormatter.py�isstr&srcCs
t|t�S)N)r�str)rr	r	r
r)sc@s*eZdZdZd
dd�Zdd�Zdd�Zd	S)�
StatFormattera�
  An object which formats labeled values. Formatters are able to
  represent all of the verbose formatting for vdoStats (the df-style formatting
  is done by hand).

  A formatter is specified by supplying a description of the format for each
  level of the hierarchy of labeled values. If the values have more levels than
  the formatter has specified, the final level specification will be applied
  to all remaining value levels.

  A level specification is specified as a hash with any of the following keys:

    displayFilter: A function which takes a LabeledValue and return True if
                   that value (and its children) should be displayed. Defaults
                   to a tautology.
    indent:        The additional indentation to apply from this level down.
                   Defaults to no additional indentation.
    joiner:        The string to use for joining label-value pairs at the
                   current level. In YAML mode, defaults to a newline,
                   otherwise defaults to a space.
    namer:         The way of naming the current level. Can be any of these:
                   None:   Don't name this level
                   list:   A list of indexes into the value list at this
                           level, the name of the level will be the
                           concatenation of the values at those indexes.
                           If the first element of the list is a string, it
                           will be used as a prefix for the name.
                   '=':    Use the label of the value at this level as the
                           name, use an equals sign to connect the name to the
                           values
                   '+':    Use the label of the value at this level as the
                           name, regardless of the formatter's mode
                   string: Any other string will be used as the name
                   True:   Any other true value will use the label as the name
                           if the mode indicates that the level should be named
                           and otherwise won't name the level
                           (non-hierarchical, multivalued levels don't get
                           named).
  TcCsn||_||_d|_|j�x|D]}t||j|�|_q W|j}d}x&|j|�}|jdkr`||_P|j}qDWdS)a

    Create a new formatter.

    :param displayLevels: An array of hashes describing how to format each
                          level of the labled values to be formatted.
    :param hierarchical:  If True, indentation will be increased at each level
                          otherwise, indentation will only be modified at
                          levels which specify the 'indent' parameter. Defaults
                          to True.
    :param yaml:          Whether to output as YAML or not. Defaults to True.
    N�)�hierarchical�yaml�spec�reverse�DisplaySpec�setIndentation�child)�selfZ
displayLevelsrr�levelr�indentr	r	r
�__init__Ts


zStatFormatter.__init__cCs|jj|�S)zn
    Format labeled values.

    :param lv: The values to format

    :return: The formatted value string
    )r�format)r�lvr	r	r
rtszStatFormatter.formatcCs6yt|j|��tjj�Wntk
r0YnXdS)zZ
    Format labeled values and print the result.

    :param lv: The values to format
    N)�printr�sys�stdout�flush�IOError)rrr	r	r
�output~s
zStatFormatter.outputN)TT)�__name__�
__module__�__qualname__�__doc__rrr!r	r	r	r
r
,s'
 
r
c@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)rz?
  An object which formats a single level of labeled values.
  cCs�||_d|_||_|jddd��|_|jdd�|_|jd|jrBdnd	�|_|jd
|jrZdnd	�|_|j	|jd��|_
d|_d|_|r�||_dS)
aG
    Create a new display specification.

    :param formatter  : The formatter which owns this specification.
    :param child      : The formatter for the next level down.
    :param parameters : A dict which defines the format at this level. Valid
                        keys are documented in the header of this file.
    N�
displayFiltercSsdS)NTr	)rr	r	r
�<lambda>�sz&DisplaySpec.__init__.<locals>.<lambda>rr�joiner�
� �
nameJoinerz: �namer)
�	formatter�parentr�getr&rrr(r+�	_setNamerr,�width�subWidth)rr-rZ
parametersr	r	r
r�s	zDisplaySpec.__init__cs��sdd�St�t�rLt�d�r8�d�dd�g�nd�g��fdd�St��r��dkrjd|_d	d�S�d
krzdd�S�fdd�S|jjr�d
d�Sdd�S)z�
    Set up the namer for this level from the specification.

    :param nameType: The type of namer to use

    :return: The specified namer function
    cSsdS)Nr	)rr	r	r
r'�sz'DisplaySpec._setNamer.<locals>.<lambda>r�Nrcs$�ddj�fdd��dD��S)Nrr*c3s|]}t�j|j�VqdS)N)r�value)�.0�n)rr	r
�	<genexpr>�sz:DisplaySpec._setNamer.<locals>.<lambda>.<locals>.<genexpr>r3)�join)r)�name)rr
r'�s�=cSs|j�rdS|jS)N)�
isMultiValued�label)rr	r	r
r'�s�+cSs|jS)N)r<)rr	r	r
r'�scs�S)Nr	)r)�nameTyper	r
r'�scSs|jS)N)r<)rr	r	r
r'�scSs|j�rdS|jS)N)r;r<)rr	r	r
r'�s)r�listrr+r-r)rr>r	)r9r>r
r0�s"
zDisplaySpec._setNamercCs`|j|�}|sdS|jjrPt|jt|��d}dj|j|||j|j	�rJdnd�S|j||jS)z�
    Get the name for a labeled value.

    :param lv: The value to name

    :return: The name for the value or None if the value should not be named
    Nr3z{0}{1:<{2}}{3}{4}r)r)
r,r-r�maxr1�lenrrr+r;)rrr9Z	nameWidthr	r	r
�getName�s
zDisplaySpec.getNamecCs||j|_|jS)zm
    Set the indentation for this level.

    :param parentIndent: The indentation of the level above us
    )r)rZparentIndentr	r	r
r�szDisplaySpec.setIndentationcCsn|jr
dS|jjr:|jr |jjn|j�|_|jd�|_dS|jrT|jj|_|_dS|j�|_|jd�|_dS)z^
    Set the width of the labels at this level.

    :param lv: The value being formatted
    NTF)r1r-rr.r2)rrr	r	r
�setWidth�s
zDisplaySpec.setWidthcCsB|j|�sdS|j|�|j|�}|j|j|j�}|r>||S|S)zz
    Recursively format a labeled value.

    :param lv: The value to format

    :return: The formatted value string
    N)r&rCrBrrr()rrr9r4r	r	r
r�s


zDisplaySpec.formatN)
r"r#r$r%rr0rBrrCrr	r	r	r
r�s"	r)
r%Z
__future__rrrrrrr�	NameError�objectr
rr	r	r	r
�<module>s_

Youez - 2016 - github.com/yon3zu
LinuXploit