%PDF- %PDF-
| Direktori : /proc/self/root/proc/self/root/usr/lib/python2.7/site-packages/salt/output/ |
| Current File : //proc/self/root/proc/self/root/usr/lib/python2.7/site-packages/salt/output/table_out.pyc |
�
���^c @@ s� d Z d d l m Z m Z m Z d d l Z d d l m Z d d l Z d d l
Z d d l Z d d l m
Z
d d l m Z m Z d Z d � Z d e f d
� � YZ d � Z d S( u�
Display output in a table format
=================================
.. versionadded:: 2017.7.0
This outputter displays a sequence of rows as table.
Example output::
edge01.bjm01:
----------
comment:
----------
out:
----------
______________________________________________________________________________
| Active | Interface | Last Move | Mac | Moves | Static | Vlan |
______________________________________________________________________________
| True | ae1.900 | 0.0 | 40:A6:77:5A:50:01 | 0 | False | 111 |
______________________________________________________________________________
| True | ae1.111 | 0.0 | 64:16:8D:32:26:58 | 0 | False | 111 |
______________________________________________________________________________
| True | ae1.111 | 0.0 | 8C:60:4F:73:2D:57 | 0 | False | 111 |
______________________________________________________________________________
| True | ae1.111 | 0.0 | 8C:60:4F:73:2D:7C | 0 | False | 111 |
______________________________________________________________________________
| True | ae1.222 | 0.0 | 8C:60:4F:73:2D:57 | 0 | False | 222 |
______________________________________________________________________________
| True | ae1.222 | 0.0 | F4:0F:1B:76:9D:97 | 0 | False | 222 |
______________________________________________________________________________
result:
----------
i ( t absolute_importt print_functiont unicode_literalsN( t reduce( t six( t mapt zipu tablec C@ s t S( N( t __virtualname__( ( ( s9 /usr/lib/python2.7/site-packages/salt/output/table_out.pyt __virtual__7 s t TableDisplayc
B@ s� e Z d Z i e j j d 6e j j d 6e j j d 6Z e d d d e d d d d d � Z d
d
d d � Z d � Z
d
� Z d � Z d d d � Z RS( u+
Manage the table display content.
u centeru rightu leftu -u | u | u |i2 c
C@ s� | j j t j j j t j d � t j d � � � t j d t � | _ | | _
| | _ | | _ | | _
| | _ | | _ | | _ | | _ | o� t | � s� | j | _ n | | _ d S( Nu coloru color_themeu strip_colors( t __dict__t updatet saltt utilst colort
get_colorst __opts__t gett Truet strip_colorst
has_headert
row_delimitert delimt justifyt
separate_rowst prefixt suffixt widtht callablet wrap_onspacet wrapfunc(
t selfR R R R R R R R R ( ( s9 /usr/lib/python2.7/site-packages/salt/output/table_out.pyt __init__F s
u c C@ s� | d k r | j } n | d 9} d } y | j | | | | | | � SWn9 t k
r� | j | | | t j j j | � | | � SXd S( u) Build the unicode string to be displayed.u u {0}{1}{2}{3}{4}{5}N( t Nonet ENDCt formatt UnicodeDecodeErrorR R
t datat decode( R t indentR t msgR R t endct fmt( ( s9 /usr/lib/python2.7/site-packages/salt/output/table_out.pyt ustringf s
c @ s% � f d � } t | | j d � � S( uu
When the text inside the column is longer then the width, will split by space and continue on the next line.c
@ sZ d j d | d d t | | j d � d � t | j d d � d � � j k d | � S( Nu {line}{part}{word}t linet partu
u
i i t word( R# t lent rfindt splitR ( R, R. ( R ( s9 /usr/lib/python2.7/site-packages/salt/output/table_out.pyt _truncate~ s Du ( R R1 ( R t textR2 ( ( R s9 /usr/lib/python2.7/site-packages/salt/output/table_out.pyR y s c @ s� g } � f d � } g | D] } | | � ^ q } t d � t t j | � � } g | D]4 } t g | D] }
t t j |
� � ^ qi � ^ qY } � j t � j � t � j
� t | � t � j � t | � d } � j
� j j � }
� j r| j � j | � j | � � n x� | D]� } x� | D]y } � j � j j g t | | � D]$ \ }
} |
t j |
� | � ^ qU� � j
} | j � j | � j | � � q0W� j s�| r#| j � j | � j | � � t } q#q#W| S( u% Prepare rows content to be displayed.c @ s� g | D] } � j | � j d � ^ q } g } xh t d � | � D]T } t | t t f � r� | j g | D] } | p{ d ^ ql � qD | j | g � qD W| S( Nu
c W@ s | S( N( ( t args( ( s9 /usr/lib/python2.7/site-packages/salt/output/table_out.pyt <lambda>� s u ( R R1 R t
isinstancet tuplet listt append( t rowt itemt new_rowst rowst substr( R ( s9 /usr/lib/python2.7/site-packages/salt/output/table_out.pyt row_wrapper� s ()c W@ s | S( N( ( R4 ( ( s9 /usr/lib/python2.7/site-packages/salt/output/table_out.pyR5 � s i ( R R t operatort addt maxR/ R t text_typeR R R t sumR t _JUSTIFY_MAPR t lowerR R9 R+ t
LIGHT_GRAYt joinR t WHITEt False( R R= R'