AnonSec Shell
Server IP : 85.193.89.191  /  Your IP : 3.133.156.208
Web Server : Apache
System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64
User : bitrix ( 600)
PHP Version : 8.1.27
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/share/yum-cli/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /usr/share/yum-cli/output.pyc
�
�v_c@s�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z	ddlmZm
Z
ddlZddlmZddlmZddlmZmZmZddlZddlmZmZdd	lTdd
lmZmZmZddlm Z ddl!m"Z"ddl#Zddl$Zdd
lm%Z%m&Z&m'Z'ddl(Z(ye)dd�dks�t*�Wnd�Z+d�Z)nXd�Z,defd��YZ-de
fd��YZ.dfd��YZ/dfd��YZ0dfd��YZ1dfd��YZ2e3d�Z4d e fd!��YZ5e3d"�Z6e7d#kr�e8ej9�d$ko�ej9d$d%krGd&GHd'GHd&GHe0�Z:x�d(d)d*d$d+d,d-d.d/d0d1d2d3d4dd5d6d7d8d-d9d-d:d-d;fD]8Z;e:j<e;�Z=d<e;e=d=d>e8e=�e=fGHqWne8ej9�d$kolej9d$d?krId&GHd@GHd&GHx4e>d(dA�D]#Z;e6e;d0dB�ej?d*�q�Wd&GHdCGHd&GHx<e>d(dA�D]+Z;e6e;d0dDdEdF�ej?d*�q�Wd&GHdGGHd&GHx1e>d(dA�D] Z;e6e;d0�ej?d*�q"Wne8ej9�d$kotej9d$d?dHfkrVe5�Z@eAe@_BdBe@jCdI<dJe@jCdK<d&GHdLGHd&GHx@e>d(dA�D]/Z;e@jDdMdIe;d0e;d0�ej?d*�q�Wd&GHdNGHd&GHxLe>d(dA�D];Z;e@jDdOdPdQdRdKe;d0e;d0�ej?d*�qWne8ej9�d$ko�ej9d$d?dSdHdTfkr�ejEjF�ne8ej9�d$ko�ej9d$d?dSfkrud&GHdUGHd&GHx:e>d(dA�D])Z;e6e;d0edV��ej?d*�q�Wd&GHd&GHdWGHd&GHxBe>d(dA�D]1Z;e6e;d0edVdFdR��ej?d*�q8Wd&GHne8ej9�d$ko�ej9d$d?dSdHdTfkr�e5�Z@eAe@_BedV�e@jCdI<e@jCdIdFdRe@jCdK<d&GHdXGHd&GHx@e>d(dA�D]/Z;e@jDdMdIe;d0e;d0�ej?d*�q	Wd&GHdYGHd&GHxLe>d(dA�D];Z;e@jDdOdPdQdRdKe;d0e;d0�ej?d*�q[Wd&GHnndS(Zs"Handle actual output from the cli.i����N(tproxy(t	TextMetertTextMultiFileMeter(tURLGrabError(tprco_tuple_to_string(tto_strtto_utf8t
to_unicode(tcheckSignalst
formatRequire(t*(t
logginglevelst_tP_(tRPMBaseCallback(tpackagesNewestByNameArch(t
utf8_widthtutf8_width_filltutf8_text_filliicGs*x#|D]}||kr|}qqW|S(N((txtargsty((s/usr/share/yum-cli/output.pytmin8s

cGs*x#|D]}||kr|}qqW|S(N((RRR((s/usr/share/yum-cli/output.pytmax<s

cCsIttjd�sdStjj�}|dkr5dS|dkrEdS|S(s= Simple terminal width, limit to 20 chars. and make 0 == 80. tterminal_width_cachediPii(thasattrt
urlgrabbertprogressR(tret((s/usr/share/yum-cli/output.pyt_term_widthAstYumTextMetercBseZdZdd�ZRS(s,A class to display text progress bar output.cCst�tj|||�dS(s Update the status of the text progress bar

        :param amount_read: the amount of data, in bytes, that has been read
        :param now: the current time in seconds since the epoch.  If
           *now* is not given, the output of :func:`time.time()` will
           be used.
        N(RRtupdate(tselftamount_readtnow((s/usr/share/yum-cli/output.pyRPsN(t__name__t
__module__t__doc__tNoneR(((s/usr/share/yum-cli/output.pyRMstYumTextMultiFileMetercBseZd�ZRS(cCst�tj|||�dS(N(RRtupdate_meter(R tmeterR"((s/usr/share/yum-cli/output.pyR(\s(R#R$R((((s/usr/share/yum-cli/output.pyR'[stYumTermcBs�eZdZeZeejd�r6ed��Z	nidd6dd6dd6Z
id	d
6dd6d
d6dd6dd6dd6dd6dd6Zid	d
6dd6d
d6dd6dd6dd6dd6dd6Zidd6dd6dd6dd6d d6d!d6Z
id"d
6d#d6d$d6d%d6d&d6d'd6d(d6d)d6Zid*d
6d+d6d,d6d-d6d.d6d/d6d0d6d1d6Zd2�Zd=d3d4�Zd=d3d5�Zd6�Zd=ed7�Zd8�Zd9�Zd:�Zd;�Zd<�ZRS(>s>A class to provide some terminal "UI" helpers based on curses.RcCst�S(N(R(R ((s/usr/share/yum-cli/output.pyt<lambda>mstsmult	underlinetrevtreversetsgr0tnormalitblackitblueitgreenitcyanitreditmagentaityellowitwhitestboldstblinkttdimsss(BsssssssssssssssscCs(|j|_|j|_|j|_dS(N(t_YumTerm__ansi_forced_MODEtMODEt_YumTerm__ansi_forced_FG_COLORtFG_COLORt_YumTerm__ansi_forced_BG_COLORtBG_COLOR(R ((s/usr/share/yum-cli/output.pyt
__forced_init�stautocCs�t|_ttjd�s'd|_nd|_|dkrJ|j�dSidd6dd6dd	6dd
6dd6dd6|_idd
6dd6dd6dd6dd6dd6dd6dd6|_	idd
6dd6dd6dd6dd6dd6dd6dd6|_
|dkrt|_dS|dks*t�yddl
}Wnt|_dSX|s`tj}n|j�syt|_dSy|jd|j��Wnt|_dSX|j|_ttjd�s�|jd�|_n|jd�|_xR|jD]G}|}||jkr!|j|}n|j|�p3d|j|<q�W|jd�}|r�x?|jj�D]+\}}|j||�p�d|j	|<qfWn|jd�}|r�x?|jj�D]+\}}|j||�p�d|j	|<q�Wn|jd�}	|	rFx?|jj�D]+\}}|j|	|�p5d|j
|<qWn|jd�}
|
r�x?|jj�D]+\}}|j|
|�p�d|j
|<qkWndS(sReinitializes the :class:`YumTerm`.

        :param term_stream:  the terminal stream that the
           :class:`YumTerm` should be initialized to use.  If
           *term_stream* is not given, :attr:`sys.stdout` is used.
        :param color: when to colorize output.  Valid values are
           'always', 'auto', and 'never'.  'always' will use ANSI codes
           to always colorize output, 'auto' will decide whether do
           colorize depending on the terminal, and 'never' will never
           colorize.
        RiPitalwaysNR<R:R;R=R/R-R1R2R3R4R5R6R7R8R9tneverREi����tfdtcolstlinestsetftsetaftsetbtsetab(tTruet_YumTerm__enabledRRRtcolumnsRJt_YumTerm__forced_initR?RARCtFalsetAssertionErrortcursestsyststdouttisattyt	setuptermtfilenottigetstrt
_ctigetstrttigetnumt_YumTerm__cap_namest	_tigetstrt_YumTerm__colorstitemsttparmt_YumTerm__ansi_colors(R tterm_streamtcolorRUtcap_nametmodetset_fgtvaltset_fg_ansitset_bgtset_bg_ansi((s/usr/share/yum-cli/output.pytreinit�s�		



				 &&&cCs|j||�dS(N(Rm(R RdRe((s/usr/share/yum-cli/output.pyt__init__scCs(|j|�pd}tjdd|�S(NR<s\$<\d+>[/*]?(R\tretsub(R Rftcap((s/usr/share/yum-cli/output.pyR_sc
s�|js
|S|stj}n��fd�}xM|D]E}||�}	|rhtj|	tj�}	ntj|	||�}q8W|S(s)Search the string *haystack* for all occurrences of any
        string in the list *needles*.  Prefix each occurrence with
        *beg*, and postfix each occurrence with *end*, then return the
        modified string.  For example::
           
           >>> yt = YumTerm()
           >>> yt.sub('spam and eggs', 'x', 'z', ['and'])
           'spam xandz eggs'

        This is particularly useful for emphasizing certain words
        in output: for example, calling :func:`sub` with *beg* =
        MODE['bold'] and *end* = MODE['normal'] will return a string
        that when printed to the terminal will appear to be *haystack*
        with each occurrence of the strings in *needles* in bold
        face.  Note, however, that the :func:`sub_mode`,
        :func:`sub_bold`, :func:`sub_fg`, and :func:`sub_bg` methods
        provide convenient ways to access this same emphasizing functionality. 

        :param haystack: the string to be modified
        :param beg: the string to be prefixed onto matches
        :param end: the string to be postfixed onto matches
        :param needles: a list of strings to add the prefixes and
           postfixes to
        :param escape: a function that accepts a string and returns
           the same string with problematic characters escaped.  By
           default, :func:`re.escape` is used.
        :param ignore_case: whether case should be ignored when
           searching for matches
        :return: *haystack* with *beg* prefixing, and *end*
          postfixing, occurrences of the strings in *needles*
        cs�|j��S(N(tgroup(tmatch(tbegtend(s/usr/share/yum-cli/output.pyR+Js(RPRotescapettemplatetIRp(
R thaystackRtRutneedlesRvtignore_casetrendertneedletpat((RtRus/usr/share/yum-cli/output.pyRp$s 	
cKs |j|||jd||�S(sOSearch the string *haystack* for all occurrences of any
        string in the list *needles*.  Prefix each occurrence with
        *beg*, and postfix each occurrence with self.MODE['normal'],
        then return the modified string.  If *beg* is an ANSI escape
        code, such as given by self.MODE['bold'], this method will
        return *haystack* with the formatting given by the code only
        applied to the strings in *needles*.

        :param haystack: the string to be modified
        :param beg: the string to be prefixed onto matches
        :param end: the string to be postfixed onto matches
        :param needles: a list of strings to add the prefixes and
           postfixes to
        :return: *haystack* with *beg* prefixing, and self.MODE['normal']
          postfixing, occurrences of the strings in *needles*
        R1(RpR?(R RyRtRztkwds((s/usr/share/yum-cli/output.pytsub_normQscKs|j||j|||�S(sTSearch the string *haystack* for all occurrences of any
        string in the list *needles*.  Prefix each occurrence with
        self.MODE[*mode*], and postfix each occurrence with
        self.MODE['normal'], then return the modified string.  This
        will return a string that when printed to the terminal will
        appear to be *haystack* with each occurrence of the strings in
        *needles* in the given *mode*.

        :param haystack: the string to be modified
        :param mode: the mode to set the matches to be in.  Valid
           values are given by self.MODE.keys().
        :param needles: a list of strings to add the prefixes and
           postfixes to
        :return: *haystack* with self.MODE[*mode*] prefixing, and
          self.MODE['normal'] postfixing, occurrences of the strings
          in *needles*
        (R�R?(R RyRgRzR((s/usr/share/yum-cli/output.pytsub_modedscKs|j|d||�S(s�Search the string *haystack* for all occurrences of any
        string in the list *needles*.  Prefix each occurrence with
        self.MODE['bold'], and postfix each occurrence with
        self.MODE['normal'], then return the modified string.  This
        will return a string that when printed to the terminal will
        appear to be *haystack* with each occurrence of the strings in
        *needles* in bold face.

        :param haystack: the string to be modified
        :param needles: a list of strings to add the prefixes and
           postfixes to
        :return: *haystack* with self.MODE['bold'] prefixing, and
          self.MODE['normal'] postfixing, occurrences of the strings
          in *needles*
        R:(R�(R RyRzR((s/usr/share/yum-cli/output.pytsub_boldxscKs|j||j|||�S(scSearch the string *haystack* for all occurrences of any
        string in the list *needles*.  Prefix each occurrence with
        self.FG_COLOR[*color*], and postfix each occurrence with
        self.MODE['normal'], then return the modified string.  This
        will return a string that when printed to the terminal will
        appear to be *haystack* with each occurrence of the strings in
        *needles* in the given color.

        :param haystack: the string to be modified
        :param color: the color to set the matches to be in.  Valid
           values are given by self.FG_COLOR.keys().
        :param needles: a list of strings to add the prefixes and
           postfixes to
        :return: *haystack* with self.FG_COLOR[*color*] prefixing, and
          self.MODE['normal'] postfixing, occurrences of the strings
          in *needles*
        (R�RA(R RyReRzR((s/usr/share/yum-cli/output.pytsub_fg�scKs|j||j|||�S(s�Search the string *haystack* for all occurrences of any
        string in the list *needles*.  Prefix each occurrence with
        self.BG_COLOR[*color*], and postfix each occurrence with
        self.MODE['normal'], then return the modified string.  This
        will return a string that when printed to the terminal will
        appear to be *haystack* with each occurrence of the strings in
        *needles* highlighted in the given background color.

        :param haystack: the string to be modified
        :param color: the background color to set the matches to be in.  Valid
           values are given by self.BG_COLOR.keys().
        :param needles: a list of strings to add the prefixes and
           postfixes to
        :return: *haystack* with self.BG_COLOR[*color*] prefixing, and
          self.MODE['normal'] postfixing, occurrences of the strings
          in *needles*
        (R�RC(R RyReRzR((s/usr/share/yum-cli/output.pytsub_bg�sN(R#R$R%RORPRRRtpropertyRQR^R`RcR>R@RBRRR&RmRnR_RSRpR�R�R�R�R�(((s/usr/share/yum-cli/output.pyR*`sz	





	o	-				t	YumOutputcBsLeZdZd�Zd�Zd�Zd�ZdMd�Zd�Z	d�Z
ed��ZdMd	dMd
d�Z
ed��Zd
�Zdded�Zed
edMd�Zed
edMd�Zd�Zdd�Zd�Zed�ZdMdMd�ZidMid�Zed�id�Zd�Zd�ZddMd�ZddMdMd�Z d �Z!d!�Z"d"�Z#d	d#d$�Z$ed	d%��Z%dMdMdMd&�Z&dMd'�Z'ed(�Z(d)�Z)d*�Z*d+�Z+d,�Z,d-�Z-d.�Z.d/�Z/d0�Z0d1�Z1dMd2�Z2ed3��Z3d4�Z4d5�Z5d6�Z6d7�Z7d8�Z8d9�Z9d:�Z:gd;�Z;ied<�d=6ed<�d<6ed>�d>6ed?�d?6ed@�d@6edA�dA6edB�dB6edC�dC6edD�dD6edE�dE6edF�dF6Z<gdG�Z=dH�Z>dI�Z?dJ�Z@dK�ZAedL��ZBRS(Ns+Main output class for the yum command line.cCs�tjd�|_tjd�|_ttd�rQtjd�jd�|_ndg|_t	�|_
d|_d�t
j�D�|_dS(Nsyum.clisyum.verbose.clitexpandMacros
%_i18ndomainst:sredhat-distcSsi|]\}}t|�qS((RS(t.0tktv((s/usr/share/yum-cli/output.pys
<dictcomp>�s	(tloggingt	getLoggertloggertverbose_loggerRtrpmR�tsplitti18ndomainsR*ttermR&t_last_interrupttERRORS_TO_KBASE_ARTICLESt	iteritemstreported_error_msgs(R ((s/usr/share/yum-cli/output.pyRn�s	c
Cs�td�td�td�td�td�td�td�td�td	�td
�td�td�g}tjtj��}|ttjd
|��dtjd|�}|S(s�Return a string representing the current time in the form::

           Mon dd hh:mm:ss

        :return: a string representing the current time
        tJantFebtMartAprtMaytJuntJultAugtSeptOcttNovtDecs%mis %d %T (Rttimet	localtimetinttstrftime(R tmonthsR"R((s/usr/share/yum-cli/output.pyt	printtime�s6<cCs�|jjd|j|j�t|d�r`|jr`|jjdkr`|jjtd��dS|jjtd��|j|�|j�dS(s�Perform failure output for failovers from urlgrabber

        :param errobj: :class:`urlgrabber.grabber.CallbackObject`
           containing information about the error
        :raises: *errobj*.exception
        s%s: %stretry_no_cacheis'Trying again, now avoiding proxy cache.NsTrying other mirror.(	R�terrorturlt	exceptionRR�terrnoRtsuggestKBaseArticle(R terrobj((s/usr/share/yum-cli/output.pyt
failureReport�s
cCs�d}t|jd�r9|jjtkr9|jj}n3t|jd�rl|jjtkrl|jj}n|svdS|j|s�|jjt|�t	|j|<ndS(NtcodeR�(
R&RR�R�R�R�R�R�R�RO(R R�terrcode((s/usr/share/yum-cli/output.pyR��s$$
cCst|||�dS(sEOutput the current status to the terminal using a simple
        status bar.

        :param current: a number representing the amount of work
           already done
        :param total: a number representing the total amount of work
           to be done
        :param name: a name to label the progress bar with
        N(tprogressbar(R tcurrentttotaltname((s/usr/share/yum-cli/output.pytsimpleProgressBar�s
cCs�d}d}|snQt|t�s1|dkrD|jjd}n"|dkrSnx|jdd�j�D]�}tr{ql|dkr�d}ql||jjkr�||jj|7}ql||jjkr�||jj|7}ql|jd�r"|d|jjkr"||jj|d7}ql|jd�rl|d|jj	krl||jj	|d7}qlqlW|r|jjd}n||fS(	NR<R:R1t,t sfg:isbg:(
t
isinstancet
basestringR�R?treplaceR�RSRAt
startswithRC(R t	highlightthibegthiendthigh((s/usr/share/yum-cli/output.pyt
_highlights4	cKs1|j|�\}}|jj|||||�S(N(R�R�Rp(R RyR�RzRR�R�((s/usr/share/yum-cli/output.pyt_sub_highlightscCsAd}x4|D],}||d|kr+Pn||d7}q
W|S(s; Spaces left on the current field will help how many pkgs? ii((R�t	data_tupstleftRttup((s/usr/share/yum-cli/output.pyt_calc_columns_spaces_helps"s
iR<cCs�|dkr|jj}nt|�}|}dg|}x1td|�D] }t||j��||<qJW|dkr�dg|d}|jd�n|t|�|dt	|�8}|ds�|d7}nx|dkr�d}	d}
x�t
d|�D]y}|j|||||�}|s.q�n|	rZ||dkrZ|d|	krZq�n||	krlq�n|}	|}
q�W|	r�||
jd�d||
}||
r�|
|dkr�|d8}n||
c|7<||8}q�nd}
x1t
d|�D] }||sq�n|
d7}
q�W|
rz||
}xDt
d|�D]0}||sYqCn||c|7<||8}qCWn|d8}||}x't
d|�D]}||c|7<q�W||c|||7<d}q�W|S(s�Dynamically calculate the widths of the columns that the
        fields in data should be placed into for output.
        
        :param data: a list of dictionaries that represent the data to
           be output.  Each dictionary in the list corresponds to a
           column of output. The keys of the dictionary are the
           lengths of the items to be output, and the value associated
           with a key is the number of items of that length.
        :param columns: a list containing the minimum amount of space
           that must be allocated for each row. This can be used to
           ensure that there is space available in a column if, for
           example, the actual lengths of the items being output
           cannot be given in *data*
        :param remainder_column: number of the column to receive a few
           extra spaces that may remain after other allocation has
           taken place
        :param total_width: the total width of the output.
           self.term.columns is used by default
        :param indent: string that will be prefixed to a line of
           output to create e.g. an indent
        :return: a list of the widths of the columns that the fields
           in data should be placed into for output
        iii����iN(
R&R�RQtlentrangetsortedRatappendtsumRtxrangeR�tpop(R tdataRQtremainder_columnttotal_widthtindentRItpdatatdthelpsRitthelpstdifftoverflowed_columnstnorm((s/usr/share/yum-cli/output.pytcalcColumns,sj

"

	&








cCs!|dkrd|fSd|fS(Niu-u((twidth((s/usr/share/yum-cli/output.pyt_fmt_column_align_width�scCs�t|�dks*t|�dks*t�t|�dkrU|\}}d}}nt|�dkr�|\}}}|j|�\}}n||||fS(NiiR<(R�RTR�(R tcol_dataRiR�R�R�R�((s/usr/share/yum-cli/output.pyt	_col_data�s*
uc	Cs�t|�}g}x|d D]}|j|�\}}	}
}|	sa|d7}|j|�qn|j|	�\}}	||�}
|
|	kr�|d7}|dkr�|j|
||d|	|
g�q|jd|	|
|
||g�n0|dd||	d7}|j|
||g�||	7}|d7}qW|j|d�\}}	}
}|j|	�\}}	t||	d|dkd	|
d
|�}|d|7}|j|�|t|�S(s�Return a row of data formatted into a string for output.
        Items can overflow their columns. 

        :param columns: a list of tuples containing the data to
           output.  Each tuple contains first the item to be output,
           then the amount of space allocated for the column, and then
           optionally a type of highlighting for the item
        :param msg: a string to begin the line of output with
        :param end: a string to end the line of output with
        :param text_width: a function to find the width of the items
           in the columns.  This defaults to utf8 but can be changed
           to len() if you know it'll be fine
        :return: a row of data formatted into a string for output
        i����u%su	%s%s%s%s u-R�u%s%s%s
iR�tprefixtsuffixu%%s%s(R�R�R�R�textendRttuple(R RQtmsgRut
text_widthR�R�R�RiR�R�R�talignt	val_width((s/usr/share/yum-cli/output.pyt
fmtColumns�s4


$$

c
Cs�|dkrd}n|j�}d||j|jf}|ddg}|j}	t|||	f||�}|j|dt�GHdS(	s�Print a package as a line.

        :param pkg: the package to be printed
        :param ui_overflow: unused
        :param indent: string to be prefixed onto the line to provide
           e.g. an indent
        :param highlight: highlighting options for the name of the
           package
        :param colums: tuple containing the space allocated for each
           column of output.  The columns are the package name, version,
           and repository
        i���i��i�s%s%s.%sR1R�N(i���i��i�(R&tprintVerR�tarchtui_from_repotzipR�R�(
R tpkgtui_overflowR�R�RQtvertnathi_colstrid((s/usr/share/yum-cli/output.pyt
simpleList�s		c	Css|dkrd}nd|t|�f}|ddg}|j}t||f||�}|j|dt�GHdS(s(Print a package as a line, with the package itself in envra
        format so it can be passed to list/install/etc. 

        :param pkg: the package to be printed
        :param ui_overflow: unused
        :param indent: string to be prefixed onto the line to provide
           e.g. an indent
        :param highlight: highlighting options for the name of the
           package
        :param colums: tuple containing the space allocated for each
           column of output.  The columns the are the package envra and
           repository
        i����i�s%s%sR1R�N(i����i�(R&tstrR�R�R�R�(	R R�R�R�R�RQtenvraR�R�((s/usr/share/yum-cli/output.pytsimpleEnvraList�s		c	Cs�t|�}t|�}|jj}d|dd}t|d|d|d|�}|jd�dkr�||d	kr�t|d|d|dd
�}n|S(s�Return a key value pair in the common two column output
        format.

        :param key: the key to be formatted
        :param val: the value associated with *key*
        :return: the key value pair formatted in two columns for output
        R�is: R�tinitial_indenttsubsequent_indents
iis
     ...: (RRR�RQRtcount(R tkeyRitkeylenRItnxtR((s/usr/share/yum-cli/output.pyt
fmtKeyValFill	s%t=cCs�t|�}|jjd}t|�}||dkrI|d}}n*|||d}|||t|�}d|||fS(s�Format and return a section header.  The format of the
        header is a line with *name* centred, and *fill* repeated on
        either side to fill an entire line on the terminal.

        :param name: the name of the section
        :param fill: the character to repeat on either side of *name*
          to fill an entire line.  *fill* must be a single character.
        :return: a string formatted to be a section header
        iis%s %s %s(RR�RQRR�(R R�tfillRItname_lenRtRu((s/usr/share/yum-cli/output.pyt
fmtSections
cCsgt|�}t|�dkr]x<|jD].}tj||�}||kr(|}Pq(q(Wnt|�S(s_Get the translated version from specspo and ensure that
        it's actually encoded in UTF-8.i(RR�R�tgettexttdgettextR(R tsR�tt((s/usr/share/yum-cli/output.pyt_enc3scCs|j|�\}}td�|t|j�|fGHtd�t|j�GH|jdkrxtd�t|j�GHntd�t|j�GHtd�t|j�GHtd�|jt	|j
��GHtd�t|jj�GH|j
d	kr d
|jkr td�t|jj�GHn|jjtj�r�td�t|j�GHtd
�tj|j�GHtd�tj|j�GHt|d�r�td�tj|j�GHn|j
d	kr�d}d|jkryt|jj�}Wqtk
rd}qXntd�|j|�GHd}d|jkrgyt|jj �}Wqgtk
rcd}qgXntd�|j|�GHq�n|j!td�|j"|j#��GH|j$r�td�t|j$�GHn|j!td�t|j%��GH|j!td�|j"|j&��GHdGHdS(s�Print information about the given package.

        :param pkg: the package to print information about 
        :param hightlight: highlighting options for the name of the
           package
        sName        : %s%s%ssArch        : %st0sEpoch       : %ssVersion     : %ssRelease     : %ssSize        : %ssRepo        : %st	installedt	from_reposFrom repo   : %ssCommitter   : %ssCommittime  : %ssBuildtime   : %stinstalltimesInstall time: %stinstalled_bysInstalled by: %st
changed_bysChanged by  : %ssSummary     : sURL         : %ssLicense     : sDescription : R<N('R�RRR�R�tepochtversiontreleaset
format_numbertfloattsizetrepotui_idtrepoidt
yumdb_infoR	R�tisEnabledForRtDEBUG_3t	committerR�tctimet
committimet	buildtimeRR
R&R�Rt
ValueErrort_pwd_ui_usernameRR�RtsummaryR�tlicensetdescription(R R�R�R�R�tuid((s/usr/share/yum-cli/output.pyt
infoOutput?sL!!



#	 #c
Cs�|\}}|r%|j|kr%dS|dk	r�|jj}|jjdkrj|j�rj|jj}n|j|d|d|�|j|d|dd
d|jj	�dS|j
�}d|j|jf}	|j}
d	||
||	fGHdS(s�Print a simple string that explains the relationship
        between the members of an update or obsoletes tuple.

        :param uotup: an update or obsoletes tuple.  The first member
           is the new package, and the second member is the old
           package
        :param changetype: a string indicating what the change between
           the packages is, e.g. 'updates' or 'obsoletes'
        :param columns: a tuple containing information about how to
           format the columns of output.  The absolute value of each
           number in the tuple indicates how much space has been
           allocated for the corresponding column.  If the number is
           negative, the text in the column will be left justified,
           and if it is positive, the text will be right justified.
           The columns of output are the package name, version, and repository
        :param repoid: a repoid that the new package should belong to
        NRRQR�R�R�is%s.%ss%-35.35s [%.12s] %.10s %-20.20ss    (
RR&tconftcolor_update_remoteRtidtverifyLocalPkgtcolor_update_localR�tcolor_update_installedtcompactPrintR�R�(R tuotupt
changetypeRQRt	changePkgtinstPkgtchit	c_compactt	i_compacttc_repo((s/usr/share/yum-cli/output.pytupdatesObsoletesListms
	c	Cs�tjj|j�}|dkr�d}t|�dkrqd}d|GHx&t|�D]}	|	j|	jf}
t}|	j	|kr�|j
dd�}n�|
|kr�|j
dd	�}nb|	j||
�r�|j
d
d	�}n:|	j||
�r|j
dd�}n|j
d
d	�}|dkrH|j
|	dtd|d|�qU|dkrU|j|	d|�qUqUWn|dkr�ddgfSdgfSdS(s�Prints information about the given list of packages.

        :param lst: a list of packages to print information about
        :param description: string describing what the list of
           packages contains, e.g. 'Available Packages'
        :param outputType: The type of information to be printed.
           Current options::
           
              'list' - simple pkg list
              'info' - similar to rpm -qi output
        :param highlight_na: a dictionary containing information about
              packages that should be highlighted in the output.  The
              dictionary keys are (name, arch) tuples for the package,
              and the associated values are the package objects
              themselves.
        :param columns: a tuple containing information about how to
           format the columns of output.  The absolute value of each
           number in the tuple indicates how much space has been
           allocated for the corresponding column.  If the number is
           negative, the text in the column will be left justified,
           and if it is positive, the text will be right justified.
           The columns of output are the package name, version, and
           repository
        :param highlight_modes: dictionary containing information
              about to highlight the packages in *highlight_na*.
              *highlight_modes* should contain the following keys::
                 
                 'not_in' - highlighting used for packages not in *highlight_na*
                 '=' - highlighting used when the package versions are equal
                 '<' - highlighting used when the package has a lower version number
                 '>' - highlighting used when the package has a higher version number
        :return: (exit_code, [errors])

        exit_code is::

            0 = we're done, exit
            1 = we've errored, exit with error string
        tlisttinfoiis%stkernsbold,underlinesnot inR1R�t>R:t<R�R�RQsNo Packages to listN(slistsinfo(tyumtmisctget_running_kernel_pkgtupttsR�R�R�R�RStpkgtuptgettverEQtverLTR�ROR#(R tlstR!t
outputTypethighlight_naRQthighlight_modestkern_pkgtuptthingslistedR�R�R�((s/usr/share/yum-cli/output.pytlistPkgs�s6(	
sIs this ok [y/N]: cCsPdttd��ttd��f}dttd��ttd��f}t||�}x|D]}|j||�qeWx�tryt|�}Wn3tk
r��n tk
r��n
d}nXt|�}|j�}t	|�dks||kr�Pq�q�W|sd	S||kr'dSx"|D]}|||kr.|Sq.Wd	S(
s�Get a yes or no from the user, and default to No, and maybe more.

        :param extra: a dict of ui responses to a list of their inputs.
        :return: the UI response or None for no. At it's simplest this is 'yes' or None
        uyRtyesuntntnoR<iN(RRtsetRROt	raw_inputtUnicodeEncodeErrortUnicodeDecodeErrortlowerR�R&(R tprompttextratyuitnuitauitxuitchoice((s/usr/share/yum-cli/output.pytuserconfirm�s4''
	



cCs
|j�S(N(RW(R tkeydict((s/usr/share/yum-cli/output.pyt_cli_confirm_gpg_key_importsc
CsD|jj|�}|jj|�}t|�}i}x*|D]"}d|f||j|jf<q=Wx�|D]�}|j|jf}||kr�|df||j|jf<qj|j||d�rj|||df||j|jf<qjqjWi}xH|j�D]:\}}	|p|	}|j	|jg�j
||	f�qW|S(s Convert pkg_names to installed pkgs or available pkgs, return
            value is a dict on pkg.name returning (apkg, ipkg). iN(trpmdbtsearchNamestpkgSackRR&R�R�tverGTt
itervaluest
setdefaultR�(
R t	pkg_namestipkgstapkgstpkgsR�R�Rtapkgtipkg((s/usr/share/yum-cli/output.pyt_group_names2aipkgss"
 
+&s   cCs�x�|D]�}||krqnx�||D]�\}}|p?|}	tt|	��t|�}
|rq|
d7}
nt|	j�}xNd|
fd|ffD]4\}}
||j|
d�|||
cd7<q�Wq*WqWdS(NiR�R�i(RR�R�R�R_(R R�R`tpkg_names2pkgsR�tigroup_datatitemRdReR�R�R�R�R�((s/usr/share/yum-cli/output.pyt_calcDataPkgColumns!s

%c
sG�fd�}|s_x+t|�D]6}|||�}	|	dkrIq"nd|	|fGHq"Wn�x�t|�D]�}|||�}	|	dkr�qln||kr�d|	|fGHqlnx�t||dd��D]m\}
}|r�|
r�|jj}n|
r
|jj}nt}|j|p|
dtd|	d|d|�q�WqlWdS(	Ncs��s
|S|�kst�|�ks8�|dkrE|d7}nn�|dkrb|d7}nQ�|dkr�tr|dS|d7}n*�|dks�t�tr�dS|d7}|S(	Nt	availablet+RR�sblacklisted-installedR�sblacklisted-availablet-(RTRSR&(RiR�(Rh(s/usr/share/yum-cli/output.pyt_get_igrp_data3s 



s%s%sR�cSs|dp|dS(Nii((R((s/usr/share/yum-cli/output.pyR+XsR�R�R�RQ(R�R&R$tcolor_list_installed_oldertcolor_list_available_installRSR�RO(
R R`tverboseRgR�RQRhRnRitpindentRdReR�((Rhs/usr/share/yum-cli/output.pyt_displayPkgsFromNames0s0c	Cstd�|jGH|jjtj�}trHtd�t|j�GHn|j	|�}t
�}x.|D]&}||dkrg|j|�qgqgW|j|j
�|j
t|�}d}|r�|j|�}nVi}xM|jj|�D]9}|j|krg||j<n||jj|�q�W|jrLtd�t|j�GHn|jrjtd�|jGHndtd�|jfdtd	�|jfd
td�|jfdtd�|jff}	d}
|rSiid
6id6}x0|	D](\}}
}|j|||d|�q�W|d
|dg}|j|�}
|
d|
df}
nx�|	D]~\}}
}|dkr~|}n!||jjkr�|}nd}t|�dkrZ|
GH|j |||d|
d|�qZqZW|rtd�GH|j |||d|
d|�ndS(s�Output information about the packages in a given group
        
        :param group: a Group object to output information about
        s

Group: %ss
 Group-Id: %sRs Description: %ss
 Language: %st	mandatorys Mandatory Packages:tdefaults Default Packages:toptionals Optional Packages:s Conditional Packages:R�R�RhiiRQs Installed Packages:N(!Rtui_nameR�RRRRORtcompsidt_groupInstalledDataRKtaddtdifference_updatetpackagesR4R&RfRZR[R�R�tui_descriptiontlangonlytmandatory_packagestdefault_packagestoptional_packagestconditional_packagesRjR�R$tgroup_package_typesR�Rs(R RrtverbRht	igrp_onlytpkg_nametall_pkgsRgRetsectionsRQR�tsection_typetsection_nameR`ttigroup_data((s/usr/share/yum-cli/output.pytdisplayPkgsInGroupscsp	
							c
s�td�|jGHtd�t|j�GH|j|��t�}x.�D]&}�|dkrI|j|�qIqIW|j|j�|jt	|�}|j
r�td�t|j
�GHn�fd�}td�|jftd�|jff}xu|D]m\}}t
|�dkr�|GHxGt|�D]6}||d	�}	|	d
krQq*nd
|	|fGHq*Wq�q�W|r�td�GHx$t|�D]}d
GdG|GHq�Wnd
S(s�Output information about the groups in a given evgroup

        :param group: an Environment object to output information about
        s
Environment Group: %ss Environment-Id: %sRs Description: %scs��s
|S|�kst�|�ks8�|dkrE|d7}nn�|dkrb|d7}nQ�|dkr�tr|dS|d7}n*�|dks�t�tr�dS|d7}|S(	NRkRlRR�sblacklisted-installedR�sblacklisted-availableRm(RTRSR&(RiR�(Rh(s/usr/share/yum-cli/output.pyRn�s 



s Mandatory Groups:s Optional Groups:is   s%s%ss Installed Groups:s  N(RRwRRxt_groupInstalledEnvDataRKRzR{t	allgroupsR4R}tgroupstoptionsR�R�R&(
R tevgroupR�tgrp_nametall_grpsRnR�R�t	grp_namesRr((Rhs/usr/share/yum-cli/output.pytdisplayGrpsInEnvironments�s4	
	c	Cs(|jjtj�}xt|�D]�}td�|j�GHt||�dkrdtd�GHq"nx�t||�D]�}|||}td�t|�GH|s�td�GHquni}x^t	t|��D]J}|j
|jf}|r�||kr�q�n|||<d|j�GHq�WquWq"WdS(s�Format and output a list of findDeps results

        :param results: a list of package dependency information as
           returned by findDeps
        spackage: %sis"  No dependencies for this packages  dependency: %ss   Unsatisfied dependencys   provider: %sN(R�RRRR�RR*R�RtreversedR�R�(	R tresultsR�R�treqtreqlisttseentpoR�((s/usr/share/yum-cli/output.pyt
depListOutput�s&
R�c
	Cs�ddddddddd	g	}|r0d
}nd}d}d
}t|�d}x0||kr�||kr�|d}||}qUWt|�td�ks�t|�td�kr�d}	n|dkr�d}	nd}	|	t|p�d
�|||fS(sReturn a human-readable metric-like string representation
        of a number.

        :param number: the number to be converted to a human-readable form
        :param SI: If is 0, this function will use the convention
           that 1 kilobyte = 1024 bytes, otherwise, the convention
           that 1 kilobyte = 1000 bytes will be used
        :param space: string that will be placed between the number
           and the SI prefix
        :return: a human-readable metric-like string representation of
           *number*
        R�R�tMtGtTtPtEtZtYg@�@g�@i�iils%i%s%sgfffff�#@s%.1f%s%ss%.0f%s%s(R�ttypeR(
R tnumbertSItspacetsymbolststeptthreshtdeptht	max_depthtformat((s/usr/share/yum-cli/output.pyRs0
		
0		cCstjj||�S(s�Return a human-readable string representation of a number
        of seconds.  The string will show seconds, minutes, and
        optionally hours.

        :param seconds: the number of seconds to convert to a
           human-readable form
        :param use_hours: If use_hours is 0, the representation will
           be in minutes and seconds. Otherwise, it will be in hours,
           minutes, and seconds
        :return: a human-readable string representation of *seconds*
        (RRtformat_time(tsecondst	use_hours((s/usr/share/yum-cli/output.pyR�1s
cCs>|jjdkr^|jjr^|jr^tjj|g|j�\}}}|sW|r^dSn|jjrwd|}	nd|j	|j
f}	|j|	|j|j
��}	|r�|dkr�|jj}n|j|	||dt�}	n|	GH|dkr|jjtj�}n|sdStd�|jGHt}
x�tjj|�D]�}t|�}t|j	�|ksHt|j
�|kr�qHn|
s�td�GHt}
nt}tr�n1t|j�|kr�td�}
|j|�}n�t|j�|krtd	�}
t}n�t|j�|kr:td
�}
t}n�|jd�rmtd�}
|j|�}t}nwg}x1|j D]&}|d
|kr}|j!|�q}q}W|r�td�}
tjj"t#|�d
�}ntd�}
|r|j|||dt�}n|r(|j|
t$|��GHqH|
|GHqHWdGHdS(s�Output search/provides type callback matches.

        :param po: the package object that matched the search
        :param values: the information associated with *po* that
           matched the search
        :param matchfor: a list of strings to be highlighted in the
           output
        :param verbose: whether to output extra verbose information
        :param highlight: highlighting options for the highlighted matches
        RNs%s : s%s.%s : R{sRepo        : %ss
Matched from:sDescription : sURL         : %ssLicense     : %st/sFilename    : %sisProvides    : sOther       : s

(%RR&R$tquery_install_excludestcmdline_excludesR9R|t
parsePackagestshowdupesfromreposR�R�R�RRR&tcolor_search_matchR�ROR�RRRRR�RSR:tuniqueRR!R�R R�tprovidesR�RR�R(R R�tvaluestmatchforRqR�tetmtuR�tdoneRitcan_overflowR�tprovstprov((s/usr/share/yum-cli/output.pyt
matchcallback@st$
*				
cCs|j|||dt�S(sqOutput search/provides type callback matches.  This will
        output more information than :func:`matchcallback`.

        :param po: the package object that matched the search
        :param values: the information associated with *po* that
           matched the search
        :param matchfor: a list of strings to be highlighted in the
           output
        Rq(R�RO(R R�R�R�((s/usr/share/yum-cli/output.pytmatchcallback_verbose�s
c
s\d}d}d}t}�fd�}x�|D]�}ywt|j�}	||	7}y|j�rl||	7}nWnnX|s�w.nyt|j�}	WnnX||	7}Wq.t}�jjtd��Pq.Xq.W|sX|r|td��j	|��n||kr0|td��j	||��n|rX|td��j	|��qXndS(s�Report the total download size for a set of packages
        
        :param packages: a list of package objects
        :param installonly: whether the transaction consists only of installations
        icsg�jjtjj�r1�jjtj|�n2�jjsJ�jjrc�j	j
tj|�ndS(N(R�RR9RtINFO_1tlogR$tassumenot	assumeyesR�twarn(R(R (s/usr/share/yum-cli/output.pyt	_call_log�ss2There was an error calculating total download sizesTotal size: %ssTotal download size: %ssInstalled size: %sN(
RSR�RR't
installedsizeROR�R�RR(
R R|tinstallonlyttotsizetlocsizetinsizeR�R�R�R((R s/usr/share/yum-cli/output.pytreportDownloadSize�sB

	cCs�d}t}xR|D]J}yt|j�}||7}Wqt}|jjtd��PqXqW|s�|jjt	j
j�r�|jjt
jtd�|j
|��q�|jjs�|jjr�|jjt
jtd�|j
|��q�ndS(smReport the total size of packages being removed.

        :param packages: a list of package objects
        is-There was an error calculating installed sizesInstalled size: %sN(RSR�RROR�R�RR�RR9RR�R�RR$R�R�R�(R R|R�R�R�R((s/usr/share/yum-cli/output.pytreportRemoveSize�s&
			c/s��jjtt�g}iid6id6id6}d}g�fd�}�jj}i}�jjdkr9|r9g}x��jjD]�}t|d�r�d|jf}||kr�g||<n||j|�q�t|d	�r%d
|j	f}||krg||<n||j|�q�|j|�q�Wnx�t
|dd��D]�\}	}
|	d
krvtd
�}ntd�}||
j}||	|
f}
g}x,|
D]$}|||||j
|j�}q�W|j||f�qOWx�td�|ftd��jjftd��jjftd��jjftd��jjftd��jjftd��jjftd��jjfgD]T\}}
g}x,|
D]$}|||||j
|j�}q�W|j||f�q�Wx�td��jftd��jj�ftd��jj�fgD]K\}}
g}x#|
D]}|||||�}qNW|j||f�q5W|ds�dS|di|d|dig}d|dddg}�j|ddd|d d!�}|\}}}}}|dkst�d"d#�jj�jtd$�|ftd%�|ftd&�|ftd'�|ftd(�|ffd)�d#�jjfg}x)|D]!\}}|r�d*|}nx�|D]�\}}}}}}}|||f||f||f||f||ff}�j|d)d+�}�j�jj �\}}xOt
|�D]A} td,�}!|!|| j!|| j"| j#�f;}!||!}qTW||}q�W|r�|j|�q�q�W|jtd-�d#�jj�td.�t$�jj�t$�jj�ftd/�t$�jj�t$�jj�ftd0�t$�jj�t$�jj�ftd1�t$�jj�dftd2�t$�jj�dftd�t$�j�dftd�t$�jj��dftd�t$�jj��dff}"d}#d}$d}%d}&x�|"D]�\}}'}(|'rA|(rAqnt%d$d3|'�})t&|�}*t&t'|'��}+t&|)�},|(r�t&t'|(��}-nd}-t(|*|#�}#t(|+|$�}$t(|,|%�}%t(|-|&�}&qWx�|"D]�\}}'}(t%d$d3|'�})|(r�t%d4d5|(�}.|'red6}|j|t)||#�|$|'t)|)|%�|&|(|.f�q�d7}|j|t)||#�|$d8t)d8|%�|&|(|.f�q�|'r�d9}|j|t)||#�|$|'|)f�q�q�Wd8j*|�S(:s]Return a string representation of the transaction in an
        easy-to-read format.
        RIR�tricsO|j\}}}}}	|j�}
|j}t|j�}�j|�}
|dkr`d}n|jjdkr��j	j
}n'|j�r��j	j}n�j	j
}|j|||
||
||f�xidt|�fdt|
�fdt|�ffD]4\}}||j|d�|||cd7<q�Wt|t|��}|S(NtnoarchRRIR�R�ii(R=R�R�RRRR&RR&R$R)R'R(R%R�R�R_R(RJR�ta_widR�t	obsoletesRItaR�R�R�tevrRtpkgsizeRthiR�(R (s/usr/share/yum-cli/output.pyt	_add_line�s$		"@tobjectst_igroup_membertit_ugroup_memberR�R�cSs|djS(Ni(Rw(R((s/usr/share/yum-cli/output.pyR+#ss!Installing for group upgrade "%s"s!Installing for group install "%s"t
InstallingtUpdatingtRemovingtReinstallingtDowngradingsInstalling for dependenciessUpdating for dependenciessRemoving for dependenciessSkipped (dependency problems)s
Not installeds
Not availableuiiR�s  RQR�iu

%s
%s
%s
R�tPackagetArchtVersiont
RepositorytSizeu u%s:
u
s     replacing  %s%s%s.%s %s
s
Transaction Summary
%s
tInstalltUpgradetRemovet	Reinstallt	DowngradetPackagessDependent packagesDependent packagess%s  %*d %s (+%*d %s)
s%s  %*s %s ( %*d %s)
R<s%s  %*d %s
(+ttsInfot	makelistsRORR$t
group_commandRR�R�R�R�RRwR�R�tupdatedtremovedtreinstalledt
downgradedtdepinstalledt
depupdatedt
depremovedtskipped_packagest_not_found_iR�t_not_found_aR�RTR�RQR�R�R)R�R�R�R�R
RR�RRtjoin(/R t
pkglist_linesR�R�R�t
ninstalledt
ginstalledttxmbrR�R�tgrpR�tactiontpkglistRJR�RQtn_widtv_widtr_widts_widtoutttotalmsgRIR�R�RRR�R�R�R�tobspotappendedtsummary_datatmax_msg_actiont
max_msg_counttmax_msg_pkgstmax_msg_depcountR�tdepcounttmsg_pkgstlen_msg_actiont
len_msg_counttlen_msg_pkgstlen_msg_depcounttmsg_deppkgs((R s/usr/share/yum-cli/output.pytlistTransaction�s

"

"%
"	(

!	& 
"#	!'		c
sd}�jj��fd�}x�td��jjftd��jjftd��jjftd��jjftd��jjftd��jjftd	��j	ftd
��jj
ftd��jjfg	D]$\}}g}t|�dkr�|d
|7}xL|D]D}|j
\}}}	}
}d|||	|
|f}|j|�qWx'dD]}
|||
�}|rkPqkqkW|s��jjdg}nxY|r|t|� }|d7}|�jt||�dd�7}|t|�}q�Wq�q�W|S(s�Returns a human-readable summary of the results of the
        transaction.
        
        :return: a string containing a human-readable summary of the
           results of the transaction
        R<cst|�|krgS�jj|dd}|dkr>gSdg|}d}x|D]w}t|�||kr�t|�||}||kr�gS||8}t|�||<n|d7}|t|�;}qXWx>tt|��D]*}||c||7<||cd9<q�W|S(sb Work out how many columns we can use to display stuff, in
                the post trans output. iiii����(R�R�RQR�(tmsgstnumR�tcol_lenstcolR�R�(R (s/usr/share/yum-cli/output.pyt
_fits_in_cols�s(



tRemovedsDependency Removedt	InstalledsDependency InstalledtUpdatedsDependency UpdatedsSkipped (dependency problems)tReplacedtFailedis
%s:
s%s.%s %s:%s-%siiiiiiis  Ruu
(iiiiiii(R�R�RR�R�RR�R�R�R�t	obsoletedtfailedR�R=R�R�RQR�R�(R RRRRRR�RIR�R�R�R�R�RRItcurrent_msgs((R s/usr/share/yum-cli/output.pytpostTransactionOutput�s>
%

	
"cCs1|jjdks"tjj�r7d}d}d}n-tdtj�}tdtj�}t�}|j	dif}|}|j
}t|d�r�||j_
||j_||j_||j_||j_
n?|jj||�||j_|jj|�|jj|�tt|��}||_dS(s`Set up the progress callbacks and various 
           output bars based on debug level.
        itfotprerepoconfN((R$t
debuglevelRVRWRXR&RR'tCacheProgressCallbackR�tinterrupt_callbackRR'R�tmulti_progressbartcallbacktfailure_callbacktrepostsetProgressBartsetFailureCallbacktsetInterruptCallbacktDepSolveProgressCallBacktweakreft
dsCallback(R R�R+R,tfreportR-R*tdscb((s/usr/share/yum-cli/output.pytsetupProgressCallbacks�s,"			cCs|j�dS(s;This function is for API purposes only to protect the typo.N(R7(R ((s/usr/share/yum-cli/output.pytsetupProgessCallbacksscCsy|j}|j}|j}t|d�rQ||j_||j_||j_n$||j_||j_||j_dS(s7Set up callbacks to import and confirm gpg public keys.R'N(	RYt
getKeyForRepotgetCAKeyForRepoRR'tconfirm_functgpg_import_functgpgca_import_funcR.(R R;R<R=((s/usr/share/yum-cli/output.pytsetupKeyImportCallbacks s			cCs�d}td�}tj�}|js|jjd}|jjd}td�|||||f}|jjtj|�n||j|kr�t	�n||_t
dtd���dS(	s Handle CTRL-C's during downloads.  If a CTRL-C occurs a
        URLGrabError will be raised to push the download onto the next
        mirror.  If two CTRL-C's occur in quick succession then yum
        will exit.

        :param cbobj: :class:`urlgrabber.grabber.CallbackObject`
        g@ttwoR:R1sZ
 Current download cancelled, %sinterrupt (ctrl-c) again%s within %s%s%s seconds
to exit.
isuser interruptN(RR�R�R�R?R�R�RtINFO_2tKeyboardInterruptR(R tcbobjtdelta_exit_chktdelta_exit_strR"R�R�R�((s/usr/share/yum-cli/output.pyR*/s			cCsGt|�dkrdSttjd�s,dStjjd�}|jjtjd|j	��t
j
�|}|dkr�d}n|jd|j|��}|jd	|j
||jd
k��}|jd�}|jd
|j||��}	dttd�|j	�|j	��|	|||f}
|jjtj|
�dS(slOutputs summary information about the download process.

        :param remote_pkgs: a list of package objects that were downloaded
        :param remote_size: the total amount of information that was
           downloaded, in bytes
        :param download_start_timestamp: the time when the download
           process started, in seconds since the epoch
        iNtTerminalLineiRmig{�G�z�?s | %5sBs  %siPR�is %5sB/ss
%s%s%s%s%stTotals     (R�RRRRER�R�RR@trestR�RzRR�t_llenRR(R tremote_pkgstremote_sizetdownload_start_timestampttltdl_timetui_sizetui_timetui_endtui_bsR�((s/usr/share/yum-cli/output.pytdownload_callback_total_cbPs 
 	( $cCsUt�}d}x||D]t}|j}|dkr:d}n|dkrOd}n|dkrdd}n|dkr|j|�|d7}qqWt|�dks�t�t|�dkr<itd
�d6td�d6td�d6td�d	6td�d
6td�d6}|djgt|�D]}||^q"�fS|djt|��fS(NisTrue-InstallR�sDep-Installt	Obsoletedt
ObsoletingtUpdatetEraseR�R�iiRxtOR�tRtDtUs, R<(sInstallRURVs	Reinstalls	DowngradeRT(	RKtstateRzR�RTRR�R�R4(R thpkgstactionsR�thpkgtsttlarge2smallR((s/usr/share/yum-cli/output.pyt_history_uiactionsls0	
					




0c	Csst|�tg�kr;g|D]}|j||�^qS|dksS|dkr�td�}td�d|}|dk	r�t|�|kr�|}nt|�Sd�}y�tj|�}||jdd�}d	||j	f}|dk	rCt|�|krCd
||�|j	f}t|�|krCd|j	}qCnt|�SWnt
k
rntt|��SXdS(
NI����i���s<unset>tSystemR�cWs!|j|�}|sdS|dS(sf Split gives us a [0] for everything _but_ '', this function
                returns '' in that case. R<i(R�(ttextRR((s/usr/share/yum-cli/output.pyt
_safe_split_0�st;is%s <%s>s%s ... <%s>s<%s>(I����i���(R�RR&RR�Rtpwdtgetpwuidtpw_gecostpw_nametKeyErrorR�(	R R"tlimitR�tloginidR�Rdtusertfullname((s/usr/share/yum-cli/output.pyR�s(#	
	
cs��fd�}d|krdS|jdd�\}}||�}|�jkrVdS|dkrfdS||�}|�jkr�dS|dks�|dkr�dS||kr�||}}n||fS(s3 Convert a user "TID" string of 2..4 into: (2, 4). cs�y�|dks|jd�rv�j}|jd�rrt|td��}|dkretd�n||8}n|St|�SWntk
r�dSXdS(Ntlastslast-itz(R�ttidR�R�RR&(RRqtoff(told(s/usr/share/yum-cli/output.pytstr2int�s	


s..iiN(R&R�Rq(RsRqRttbtidtetid((Rss/usr/share/yum-cli/output.pyt_historyRangeRTIDs�s"cCs�t�}d}x�t|�D]�}|d|kr`|jjtd|d|df��qn|d}x0t|d|dd�D]}|j|�q�WqW|S(su Convert a list of ranged tid typles into all the tids needed, Eg.
            [(2,4), (6,8)] == [2, 3, 4, 6, 7, 8]. i����is4Skipping merged transaction %d to %d, as it overlapsi(RKR�R�R�RR�Rz(R trtidsttidstlast_endtmtidR((s/usr/share/yum-cli/output.pyt_historyRangeTIDs�s	(
"c	CsZ|jj�}|dkr5|jjtd��dSt�}g}|d}t}|r�t}|ddkr�|j	d�q�nx�|D]y}yt
|�|j|�Wq�tk
r|j
||�}|r�|j|j|g��q�n|j|�q�Xq�W|r)|j|jj|��n|rP|rP|jjtd��dS||fS(NsNo transactionsiitalls)Bad transaction IDs, or package(s), given(NN(NN(thistoryRoR&R�tcriticalRRKRSROR�R�RzRRwRR|R�tsearch(	R textcmdsRsRytpatstusertidstprintallRqtrtid((s/usr/share/yum-cli/output.pyt_history_list_transactions�s8	




c
Cs|j|�\}}|d(krA|s4ddgfSddgfSd}|rVd(}n|jj|d|�}d}|jjdkr�ddg}n�|jjd	kr�dg}n�|jjd
ks�t�t�}d}x[|D]S}	|r�||kr�Pn|d7}|	jd(kr$|d7}n|j	|	j
�q�Wt|�dkrj||dkrj|j	d�nd}
t|�dkr�td
�}ntd�}|
t
td�dd�t
|dd�t
td�dd�t
td�dd�t
td�dd�fGHddGHd}
d}x�|D]�}	|rB||krBPn|d7}t|�dkrp|	jpjd}n|j|	j
d�}tjdtj|	j��}|j|	j�\}
}t
|dd�}t
|dd�}d}}|	jd(krd}}nX|	jrd}}nB|	jr1d }}n,|	jrGd!}}n|	jr]d"}}n|	jrod#}n|	jr�d$}n|
|	j||||
fGd%||fGHq%W|jj�}|d(kr�|jd&t�n5|jj d't!�d}|j"|kr|j�nd(S()s)Output a list of information about the history of yum
        transactions.

        :param extcmds: list of extra command line arguments
        :return: (exit_code, [errors])

        exit_code is::

            0 = we're done, exit
            1 = we've errored, exit with error string
        isNo accessible history to listisFailed history listiRktusersitcommandsssingle-user-commandstblahs%s | %s | %s | %s | %ssCommand lines
Login usertIDiis
Date and timeis	Action(s)itAlterediRmiOs%6u | %s | %-16.16s | %s | %4uR<s%Y-%m-%d %H:%MR�R
t#R�R�RR8R7s%s%sR�t	main_onlyN(#R�R&R~RsR$thistory_list_viewRTRKtcmdlineRztloginuidR�RRRR�R�R�t
beg_timestampRat
trans_datatreturn_codetoutputtrpmdb_problemst
trans_skiptaltered_lt_rpmdbtaltered_gt_rpmdbRqRot_rpmdb_warn_checksRSRZt
simpleVersionROtend_rpmdbversion(R R�RyR�Rktold_tidsR�tuidstblanksRstfmtR�ttmRtuiactstrmarktlmarktlastdbvtrpmdbv((s/usr/share/yum-cli/output.pythistoryListCmd�s�

		


"	

	

	
	
	
	
				-c	Cs�t|�dkr,|jjtd��dSg}d}x8|dD],}y�|dksg|jd�r|dkr�t}|jjd|�}|dkr�t	d�q�n|j
}|jd�r�t	|td��}|dkr�t	d�n||8}n|jt|��wCnt	|�dkr6t	d�n|j|�WqCt
k
rn|jjtd	��dSXqCW|jj|�}|s�|jjtd
��dS|S(NisNo transaction ID giveniRoslast-tcomplete_transactions_onlyRpisBad transaction ID givensNot found given transaction ID(R�R�RRR&R�RSR~RoR�RqR�R�RRs(	R R�RyRotextcmdtctoRqRrRs((s/usr/share/yum-cli/output.pyt_history_get_transactions_s@	



	cCsR|j|�}|dkrdSt|�dkrJ|jjtd��n|dS(Nis#Found more than one transaction ID!i(R�R&R�R�RR(R R�Rs((s/usr/share/yum-cli/output.pyt_history_get_transaction�scCs�d�}t�}t�}g}|jj�}|d
kr_|jjtd��ddgfSx{|dD]o}|j||�r�|j|j||��qjn+||�d
k	r�|j||��qjn|j	|�qjW|r�|j
|jj|��n|j�}|r6t
|�}|j
|j|��n|r�t|�dkr�|jjdt�}|d
k	r�|j|j�|j|j�q�n|s�|jjtd��ddgfS|jj�}	|	d
k	r�|	j}
|	j}	nt}d\}}
d
}|r%|jd	�\}}
nx�|jj|�D]o}|	d
k	r�|j|
kr�|jjd
t�d	}|	|kr�t|_q�nd
}	|j|kr�|j|
kr�|d
kr�tjj|�}qm|j|�n�|d
k	rm|rddGHnt}|j|�d
}|rm|jd	�\}}
|j|krj|j|
krjtjj|�}qjqmn|j|kr8|r�ddGHnt}|j||�q8q8W|d
k	r�|r�ddGHn|j|�nd
S(sOutput information about a transaction in history

        :param extcmds: list of extra command line arguments
        :return: (exit_code, [errors])

        exit_code is::

            0 = we're done, exit
            1 = we've errored, exit with error string
        cSs'yt|�SWntk
r"dSXdS(N(R�RR&(R((s/usr/share/yum-cli/output.pyRt�s
sNo transactionsisFailed history infoiR�s$No transaction ID, or package, giveni����iR�RmiON(i����i����(RKR~RoR&R�RRRwRzR�RR�tcopyR�R|R�RSRqR�R�RsRZR�ROR�R9tYumMergedHistoryTransactiontmerget_historyInfoCmd(R R�RtRytmtidsR�RsRqtutidsR�tlasttidR�tbmtidtemtidtmobjR�((s/usr/share/yum-cli/output.pythistoryInfoCmd�s�			

	
cCspd|jkr|jS|jj|j�}|se|jj|j�}|sPdSdt|dj�S|djS(sn Given a pkg, find the ipkg.ui_from_repo ... if none, then
            get an apkg. ... and put a ? in there. R	t?s@?i(RR�RZtsearchPkgTupleR=R\R�R(R R^RaRb((s/usr/share/yum-cli/output.pyt_hpkg2from_repo�scs��j|j�}itd�d6td�d6td�d6td�d6�itd�d6td	�d6td
�d6td�d6�tg�j��j�D]}t|�^q��}|�d<|�d<ttd
t����fd�}t|j	�tg�kr8td�Gd|j	d
|j	dfGHntd�G|j	GHt
j|j�}td�G|GH|j
dk	r�|jr�td�G|j
GdGHq�td�G|j
GHn|jdk	rt
j|j�}|j�}	|j|	d
�r{|j�}
d
}x`tt|	��D]L}|t|
�kr2Pn|
||	|krJPn|t|
|�d7}qWd|||}n|j|j}
|
d=kr�td�|
}
nZ|
d?kr�td�|
d}
n7|
dBkr�td�|
dC}
ntd�|
dE}
td�G|G|
GHn|jdk	r`|jrKtd�G|jGdGHq`td�G|jGHnt|�tg�kr�x/|D]}td �G|GHqWntd �G|GHt|j�tg�kr6|j}|d
dkrtd!�GdGtd"�GdGH|d}n|r�td!�Gtd#�Gd$j|�GHq�nl|jdkretd!�GdGtd"�GdGHn=|jr�td!�Gtd%�G|jGHntd!�Gtd&�GH|jdk	rt|j�tg�kr�x5|jD]}td'�G|GHq�Wqtd'�G|jGHnt|j	�tg�kr��jj|j	�}td(d)d*g�}t|�j|�}t|�d
kr�td+t|��GHq�n|jr�td,�GHtd-�|jD��}nx*|jD]�|�d.d/td0|�q�Wtd1�GH�j||�|jr6td2�GHtd3�|jD��}nx*|jD]�|�d.d0|d4t�q@W|j rztd5�GHnx�|j D]�}d6dF|j!f}�j"||j#�GH|j$r�td7�|j$D��}nx3|j$D](�|�d8d/td9�j%d0|�q�Wq�W|j&rXtd:�GHd
}x+|j&D]}|d7}d;|G|GHq4Wn|j'r�td<�GHd
}x+|j'D]}|d7}d;|G|GHq|WndS(GNRR�tErasedR�Rtot
DowngradedRIs
Not installedtOldertNewertmaxlenic
sLd|}|r�}n�}|d}�jj�jg�}	|	j�|	s^|d}nh�jd�|	D�krznL|	d�kr�|d}n/|	d�kr�|d}nts�td	��|r��jd
�\}
}n�jd�\}
}t||d�}d
}|r*�j	��}nd||
|||�|fGHdS(NR�R�R�css|]}|jVqdS(N(R=(R�Re((s/usr/share/yum-cli/output.pys	<genexpr>	si����R�iRIs-Impossible, installed not newer and not olderR:R1R�R<s%s%s%s%s %-*s %s(
RZR[R�tsortR=RSRTR�RR�(
R�t
prefix_lent
was_installedR�tpkg_max_lent	show_repoR�t_pkg_statesR[RaR�R�tui_repo(t_pkg_states_availablet_pkg_states_installedR^R (s/usr/share/yum-cli/output.pyt_simple_pkg		s2
	




sTransaction ID :s%u..%ui����sBegin time     :sBegin rpmdb    :s**iR�ii<s(%u seconds)s(%u minutes)is
(%u hours)s	(%u days)sEnd time       :sEnd rpmdb      :sUser           :sReturn-Code    :tAborteds	Failures:s, sFailure:tSuccesssCommand Line   :sconfig-mainsconfig-repostsaved_txs-Additional non-default information stored: %dsTransaction performed with:css!|]}tt|��VqdS(N(R�R�(R�R^((s/usr/share/yum-cli/output.pys	<genexpr>v	siR�R�sPackages Altered:sPackages Skipped:css!|]}tt|��VqdS(N(R�R�(R�R^((s/usr/share/yum-cli/output.pys	<genexpr>~	sR�sRpmdb Problems:s%s%s: css!|]}tt|��VqdS(N(R�R�(R�R^((s/usr/share/yum-cli/output.pys	<genexpr>�	siR�sScriptlet output:s%4dsErrors:i,i,iPFi,iPFi��iii�Qs    ((RR�RRR�R�RSROR�RqR�RR�tbeg_rpmdbversionR&R�t
end_timestampR�R�R�R�R�R�R�R�R~treturn_addon_dataRKt
differencet
trans_withthistoryInfoCmdPkgsAlteredR�R�tproblemR�RcR|tmainR�terrors(R RsR�R�RR�R�tbegtmtendtmtendtmstbegtmstsofarR�R�tcodesR�t
addon_infotdefault_addonstnon_defaultR�tprobR�Rtline((R�R�R^R s/usr/share/yum-cli/output.pyR��s�&

*		
	
( 						
	
R�sTrue-InstallsDep-InstallRSRTRVR�R�R�RURcCsed
}|j}d}d}xw|jD]l}|j|j|j�}|t|�krdt|�}n|tt|��kr%tt|��}q%q%Wx�|jD]�}d}	|js�d}	nd}
|rtj	j
|g|�\}}}
|s�|rd}
qn|j|
�\}}|j}|j|j|j�}t
||�}trPn�|d
k	r�|jdkr�|j|jkr�|jdkr�t|j�d	}d|||}n�|d
k	r|jd
kr|j|jkr|jdkrt|j�d	}d|||}nd
}|jdkr6|}nd|	||||||j|�fGHq�Wd
S(s/Print information about how packages are altered in a transaction.

        :param old: the :class:`history.YumHistoryTransaction` to
           print information about
        :param pats: a list of patterns.  Packages that match a patten
           in *pats* will be highlighted in the output
        iR�is ** R1R:RRUiR�R�s%s%s%s%s %-*s %sNs    (sUpdateds	Downgrade(R&t_history_state2uistateR�R>R[R�R�R�R9R|R�R�tui_nevraRRSR�R�(R RsR�Rotall_uistatesR�R�R^tuistateR�R�RR�R�R�R�tcntln((s/usr/share/yum-cli/output.pyR��	sR			!	!!	c
Cs8|j|�\}}|d$kr.ddgfSd}|ttd�dd�ttd�dd�ttd�d	d	�ttd
�dd�fGHdd
GHd}iid6id6id6id6id6id6id6}x|jj|�D]�}|j|jd�}d}tj�}	t	r n�|j
|	d&kr<d}n�|j
|	d)krXd}np|j
|	d,krtd}nT|j
|	d0kr�d}n8|j
|	d4kr�d}n|j
|	d7kr�d}n||j|g�j|�q�Witd�d6td�d6td�d6td�d6td �d6td!�d6td"�d6}
d#}x�d8D]�}||smqWnx�t
||�D]�}|r�|dkr�Pn|d7}g}x&|||D]}|j|j�q�W|j|�\}
}|
|}|t|dd�t|dd�t|d	d	�|
fGHq~WqWWd$S(9srPrint a summary of transactions in history.

        :param extcmds: list of extra command line arguments
        isFailed history infos%s | %s | %s | %ss
Login useritTimeis	Action(s)iR�iRmiOs%s | %s | %s | %8utdaytweekt	fortnighttquarterthalftyearR}ii<iii
imsLast days	Last weeksLast 2 weekss
Last 3 monthss
Last 6 monthss	Last yearsOver a year agoiNi�i�Qi�i�Qi�:	i�i�Qiui�i�Qi�:	i��wi�i�Qi�:	i��i�i�Qi�3�(R�R�R�R�R�R�sall(R�R&RRR~RsRR�R�RSR�R_R�R�R�R�Ra(R R�RyR�R�R�RsR�tperiodR"t_period2userR�R\R�R�tuperiod((s/usr/share/yum-cli/output.pythistorySummaryCmd�	sp
							!








cCsEd}t|�dkr:|d}|dkr:d}q:n|dk	r�yt|�Wq�tk
r�|jjtd��ddgfSXn|dk	r�|jjd|g�}nK|jj	dt
�g}|ddkr�|jjtd��ddgfS|s*|jjtd	�|�ddgfS|d}|jj|j�}t|�d
kr�td�G|jGHtd�GHx&|jj|j�D]}d
|GHq�WdGHddgfSx�|d
D]}||kr|j
jtjd|�|jj|j|�G|j
jtjd�ntd�|GH|j
jtjd�q�WdS(s|Print addon information about transaction in history.

        :param extcmds: list of extra command line arguments
        iRosBad transaction ID givensFailed history addon-infoRyR�is$No transaction ID, or package, givensNo Transaction %s foundisTransaction ID:s)Available additional history information:s  %sR<shistory addon-infos%s:s)%s: No additional data found by this nameN(R&R�R�RR�RRR~RsRoRSR�RqR�R�RR@(R R�RqRst	hist_dataR�titemnameRi((s/usr/share/yum-cli/output.pythistoryAddonInfoCmd$
sH






cCs�|jj|�}d }|rH|rH|jjtd��ddgfS|sWd}n|j}d}|ttd�dd�ttd�d	d	�ttd
�dd�fGHdd
GHd}d}x�|jj|d|�D]�}|d k	r|r|t	|j
�|krPnd }d}	}
|jd kr=d}	}
nX|jrSd}	}
nB|jrid}	}
n,|j
rd}	}
n|jr�d}	}
n|jr�d}	n|jr�d}
nx�|j
D]�}|d kr
tjj|g|�\}}
}|r
|
r
q�q
n|j|j|j�}t|d	�}|j}trFn�|d k	r�|jdkr�|j|jkr�|jdkr�t	|j�d}d|||}n�|d k	r|jdkr|j|jkr|jdkrt	|j�d}d|||}nd }|jd!kr,|}n|d7}||j||fGd|
|	fGHq�Wq�W|jj�}|d kr�|jdt�n5|jjdt�d}|j|kr�|j�nd S("s�Print a list of information about transactions from history
        that involve the given package or packages.

        :param extcmds: list of extra command line arguments
        s)Bad transaction IDs, or package(s), givenisFailed history packages-listis%s | %s | %sR�is	Action(s)iR�i5RmiOs%6u | %s | %-50siRkR�R
R�R�R�RR8R7RRUR�R�s%s%sR�R�N(sUpdateds	Downgrade( R~R�R&R�RRR�RRsR�R�R�R�R�R�R�R�R9R|R�R>R[R�RSR�RqRoR�RZR�ROR�(R R�RyRkR�R�RRsRoR�R�R^RR�R�R�R�R�R�R�((s/usr/share/yum-cli/output.pythistoryPackageListCmdU
s�

			+

	
	
	
	
				!		!!	
+c
Cs�|jj|�}d}|rH|rH|jjtd��ddgfS|sWd}n|j}d}x�|jj|d|�D]�}|dk	r�|r�|t|j	�|kr�Pnx�|j	D]�}|dkrt
jj|g|�\}}	}
|r|	rq�qn|j
|j|j�}|r.dGHntd�G|jGHtj|j�}td	�G|GHtd
�G|jGHtd�G|GH|jdk	r�t|j�}td�Gtjd
|t�GHn|jdk	r�td�G|jGHn|jdk	rtjt|j��}td�G|GHn|jdk	rBtd�G|jGHn|jdk	rftd�G|jGHn|jdk	r�td�G|jGHn|jdk	r�td�G|jGHn|jdk	r�td�G|jGHn|j dk	rtjt|j ��}td�G|GHn|j!dk	r/td�G|j!GHn|j"j#dk	rYtd�G|j"j#GHn|j"j$dk	r�td�G|j"j$GHn|j"j%dk	r�td�G|j"j%GHn|j"j&dk	r�t|j"j&�}
|j'|
�}td�G|GHn|j"j(dk	r7t|j"j(�}
|j'|
�}td�G|GHn|d7}q�WqW|jj)�}|dkrw|j*dt+�n5|j,j-dt�d}|j.|kr�|j*�ndS(s�Print information about packages in history transactions.

        :param extcmds: list of extra command line arguments
        s)Bad transaction IDs, or package(s), givenisFailed history packages-infoiiRkR<sTransaction ID :sBegin time     :sPackage        :sState          :sSize           :s%dsBuild host     :sBuild time     :sPackager       :sVendor         :sLicense        :sURL            :sSource RPM     :sCommit Time    :sCommitter      :sReason         :sCommand Line   :sFrom repo      :sInstalled by   :sChanged by     :R�R�N(/R~R�R&R�RRR�RsR�R�R9R|R�R>R[RqR�RR�R�RR�tlocaleR�ROt	buildhostRtpackagertvendorR R�t	sourcerpmRRRtreasontcommand_lineR	RRRRoR�RSRZR�R�(R R�RyRkR�RRsR^RR�R�R�R�R"R�R�R�((s/usr/share/yum-cli/output.pythistoryPackageInfoCmd�
s�

		+!	!ccsPxI|D]A}td�}dt|�d}||jdd|�fVqWdS(Ns	Error: %sR�is
(RRR�(trestringR�R�t	prefix2nd((s/usr/share/yum-cli/output.pytpretty_output_restrings
N(CR#R$R%RnR�R�R�R&R�R�R�tstaticmethodR�R�R�R�RR�RSR�R�R�RRR#R3RGRRWRYRfRjRsR�R�R�RR�R�R�R�R�RR%R7R8R>R*RRRaRRwR|R�R�R�R�R�R�R�R�R�R�R�R�R�R(((s/usr/share/yum-cli/output.pyR��s�						
m	
1			.&G)		2	I	9	0P4		�	F	(			!		!%		 	a	$		d	�








<	@	1	[	UR2cBs�eZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zd�ZRS(sQA class to provide text output callback functions for Dependency Solver callback.cCs(tjd�|_d|_||_dS(s8requires yum-cli log and errorlog functions as argumentssyum.verbose.cliiN(R�R�R�tloopstayum(R R((s/usr/share/yum-cli/output.pyRns	c
	Cs�itd�d6td�d6td�d6td�d6td	�d
6td�d6td
�d6td�d6}|\}}}}}||}	|jjtjtd�||||||	�dS(s�Print information about a package being added to the
        transaction set.

        :param pkgtup: tuple containing the package name, arch,
           version, and repository
        :param mode: a short string indicating why the package is
           being added to the transaction set.

        Valid current values for *mode* are::
        
           i = the package will be installed
           u = the package will be an update
           e = the package will be erased
           r = the package will be reinstalled
           d = the package will be a downgrade
           o = the package will be obsoleting another package
           ud = the package will be updated
           od = the package will be obsoleted
        RR�s	an updateR�terasedR�R�R�sa downgradeR�t
obsoletingR�R�tudR"tods&---> Package %s.%s %s:%s-%s will be %sN(RR�R�RR@(
R R=RgtmodedictRIR�R�R�R�tmodeterm((s/usr/share/yum-cli/output.pytpkgAddeds






cCs|jd7_dS(sRPerform setup at the beginning of the dependency solving
        process.
        iN(R(R ((s/usr/share/yum-cli/output.pytstart8scCs |jjtjtd��dS(s?Output a message stating that a transaction check is beginning.s--> Running transaction checkN(R�R�RR@R(R ((s/usr/share/yum-cli/output.pyttscheck>scCsE|jd7_|jjtjtd��|jjd|j�dS(sBOutput a message stating that dependency resolution is restarting.is6--> Restarting Dependency Resolution with new changes.s---> Loop Number: %dN(RR�R�RR@Rtdebug(R ((s/usr/share/yum-cli/output.pytrestartLoopBs
cCs |jjtjtd��dS(sAOutput a message stating that dependency resolution has finished.s"--> Finished Dependency ResolutionN(R�R�RR@R(R ((s/usr/share/yum-cli/output.pyRuIscCs&|jjtjtd�||�dS(scOutput a message stating that the package *formatted_req*
        is being processed as a dependency for the package *name*.

        :param name: the name of the package that *formatted_req* is a
           dependency of
        :param formatted_req: a string representing the package that
           is being processed as a dependency of *name*
        s---> Processing Dependency: %s for package: %sN(R�R�RR@R(R R�t
formatted_req((s/usr/share/yum-cli/output.pytprocReqOs	cCs&|jjtjtd�||�dS(sXOutput a message stating that the package *formatted_req*
        is being processed as a dependency for the package *po*.

        :param po: the package object that *formatted_req* is a
           dependency of
        :param formatted_req: a string representing the package that
           is being processed as a dependency of *po*
        s---> Processing Dependency: %s for package: %sN(R�R�RR@R(R R�R((s/usr/share/yum-cli/output.pyt	procReqPo\s	cCs&|jjtjtd�||�dS(stOutput a message stating that the given package will not be
        removed. This method is used during leaf-only group remove, leaf-only
        repo-pkg remove and normal remove commands to indicate that the
        package will be kept.

        :param po: the :class:`yum.packages.PackageObject` that will
           not be removed
        :param hits: unused
        s"---> Keeping package: %s due to %sN(R�R�RR@R(R R�tdeppothits((s/usr/share/yum-cli/output.pyt	removeReqis
cCs#|jjtjtd�|�dS(s�Output a message stating that there is an unresolved
        dependency.

        :param msg: string giving information about the unresolved
        dependency
        s--> Unresolved Dependency: %sN(R�R�RR@R(R R�((s/usr/share/yum-cli/output.pyt
unresolvedvsc
s�|\�}}|j�d||jf}td�|f}t�||�}|td�|f7}�sq|Sd�������fd�}�����fd�}	d�t��x/t�jj���D]}
||
|�}q�Wt�}xQt�j	j���D]7}
|	|
|�\}�}|r|j
|
j�qqWd�x/t�jj|��D]}
||
|�}qmWd�x8t�j	j|��D]}
|	|
|�\}�}q�W|S(s>Return an error message stating that a package required to
        fulfill a dependency is missing.

        :param reqPo: the package object that has a dependency that
           cannot be fulfilled
        :param reqTup: the name, flags, and version of the package
           needed to fulfil the dependency
        s%s (%s)sPackage: %ss
    Requires: %sc	Ss&td�|||jf}|dd	f}t}x@|jd|�D],}t}|td�tjj|�7}qDW|s	|j	dd�}||kr	xk|j
D]]}|d}|j	dd�}||kr�t}tjj|�}|td�|7}q�q�Wq	n|s"|td�7}n|S(
s? Add a package to the message, including any provides matches. s
    %s: %s (%s)R�s
        %st
0123456789is
       ~%ss
        Not foundN(NNN(RR�R&RSt
matchingPrcosROR9R:Rt	translateR�(	RR�tneednameR�tneedtupR�R=t	nneednameR�((s/usr/share/yum-cli/output.pyt_msg_pkg�s&$
!c		s^|j|j|j|jf}|�ksK|j��rO|j�jkrO|S�j|�td�}�jj	|j
t�}|r�td�}n|�||��7}itd�d6td�d6td�d6}x|D]w}xn|jD]c\}}||kr
q�n|j|j|j|jf}�j|�|�|||��7}q�Wq�W|S(	NRR�s
Updated Byt	updatedbys
Downgraded BytdowngradedbysObsoleted Bytobsoletedby(
R�R
RRR?R�RzRR�tgetMembersWithStateR=tTS_REMOVE_STATESt	relatedto(	R�R�tnevrRtrmedtrelmapR�trpkgtrtype(RRoRt	seen_pkgstyb(s/usr/share/yum-cli/output.pyt
_run_inst_pkg�s(-



"cs�|j|j|j|jf}|�ksK|j��rX|j�jkrXt�|fS�j|�td�}�j	j
|jt�r�td�}n|�||��7}t
||fS(Nt	AvailableR�(R�R
RRR?R�RSRzRR�R R=tTS_INSTALL_STATESRO(R�R�R#R(RRoRR(R)(s/usr/share/yum-cli/output.pyt_run_avail_pkg�s-

N(
RR�RR	R&RKR�RZtgetProvidesR\RzR�R[(
R treqPotreqTupt	needflagstneedversiontprob_pkgR�tui_reqR*R-R�tavailable_namesttst((RRoRR(R)s/usr/share/yum-cli/output.pytformat_missing_requires�s6			
		cCs&|jjtjtd�||�dS(sPrint a message stating that two packages in the
        transaction conflict.

        :param name: the name of the first package involved in the
           conflict 
        :param confname: the name of the second package involved in
           the conflict
        s(--> Processing Conflict: %s conflicts %sN(R�R�RR@R(R R�tconfname((s/usr/share/yum-cli/output.pytprocConflict�s		cCs&|jjtjtd�||�dS(sPrint a message stating that two packages in the
        transaction conflict.

        :param name: the first package object involved in the
           conflict 
        :param confname: the second package object involved in
           the conflict
        s(--> Processing Conflict: %s conflicts %sN(R�R�RR@R(R R�R8((s/usr/share/yum-cli/output.pytprocConflictPo�s		cCs |jjtjtd��dS(sEOutput a message stating that the transaction set is being populated.sC--> Populating transaction set with selected packages. Please wait.N(R�R�RR@R(R ((s/usr/share/yum-cli/output.pyttransactionPopulationscCs#|jjtjtd�|�dS(s�Output a message stating that the header for the given
        package is being downloaded.

        :param name: the name of the package
        s<---> Downloading header for %s to pack into transaction set.N(R�R�RR@R(R R�((s/usr/share/yum-cli/output.pytdownloadHeadersN(R#R$R%R&RnR
RRRRuRRRRR7R9R:R;R<(((s/usr/share/yum-cli/output.pyR2
s 	"					
	
	
	
	h	
	
	R)cBs>eZdZd�Zd�Zd�Zd�Zdd�ZRS(sFA class to handle text output callbacks during metadata cache updates.cCs:tjd�|_tjd�|_tjd�|_dS(Nsyum.clisyum.verbose.clisyum.filelogging.cli(R�R�R�R�tfile_logger(R ((s/usr/share/yum-cli/output.pyRnscCs|jj||�dS(s{Output a log message.

        :param level: the logging level for the message
        :param message: the message
        N(R�R�(R tleveltmessage((s/usr/share/yum-cli/output.pyR�scCs|jj||�dS(s�Output an errorlog message.

        :param level: the logging level for the message
        :param message: the message
        N(R�R�(R R>R?((s/usr/share/yum-cli/output.pyterrorlog"scCs|jj||�dS(s�Output a file log message.

        :param level: the logging level for the message
        :param message: the message
        N(R=R�(R R>R?((s/usr/share/yum-cli/output.pytfilelog*scCs�d}t}||}|dkr+t}n=|dkr@t}n(||krUt}n||sht}n|r�t|||�ndS(sGOutput the current status to the terminal using a progress
        status bar.

        :param current: a number representing the amount of work
           already done
        :param total: a number representing the total amount of work
           to be done
        :param name: a name to label the progress bar with
        i�iN(RSROR�(R R�R�R�tnum_outputsR�topc((s/usr/share/yum-cli/output.pyR�2s
			
	N(	R#R$R%RnR�R@RAR&R�(((s/usr/share/yum-cli/output.pyR)s				c	se|dkr|S|dkr%d}ng��fd�}x?|jjd	|�D](}|j|krkqPn||j�qPW�s�|S�jd
�}�s�t|�St}t}xA�D]9}|j|�s�t	}n|j
|j
kr�t	}q�q�W|rG|jdkr$d|j|j
|jfSd
|j|j|j
|jfSn|rad|j|j
fS|S(s� Get more information on a simple pkgname, if we can. We need to search
        packages that we are dealing with atm. and installed packages (if the
        transaction isn't complete). R�R�R�R�R�RRcsD�r3�dj|jkr3�dj|�r3dS�j|�dS(Ni(R�R?R�(R�(tmatches(s/usr/share/yum-cli/output.pyt	_cond_add[s/R�iRs%s-%s-%ss%s:%s-%s-%ss%s.%sN(R�R�R�R�R�sodsud(R&R�t
matchNaevrtts_stateR�R�R�ROR?RSR�R
R�RR(	Rtpkgnamet	ts_statesRER�tfmatchtshow_vert	show_archRs((RDs/usr/share/yum-cli/output.pyt_pkgname_uiNs<	

	
tYumCliRPMCallBackcBsteZdZed��Zdd�Zdd�Zd�Zd�Z	d	�Z
d
�Zeddd�Z
d
�ZRS(s1A Yum specific callback class for RPM operations.cCst�S(N(R(R((s/usr/share/yum-cli/output.pyR+�scCsbtj|�td�|_d|_tjd�jt	j
�|_d|_d|_
||_dS(NR<syum.verbose.cliR�i(RRnRtlastmsgR&tlastpackageR�R�RRR@R�tmarktmarksR(R R((s/usr/share/yum-cli/output.pyRn�s
			R�RRcCst|j||�S(s�Return more information on a simple pkgname, if possible.

        :param pkgname: the name of the package to find information about
        :param ts_states: a tuple containing the states where the
           package might be found
        (RMR(R RHRI((s/usr/share/yum-cli/output.pyt
pkgname_ui�sc	Cs�|j|}|j�}t|�tjkr=t|�}	n|j|�}	||_|dkrjd}
n|d|}
|j|||||
||	|�dS(s�Output information about an rpm operation.  This may
        include a text progress bar.

        :param package: the package involved in the event
        :param action: the type of action that is taking place.  Valid
           values are given by
           :func:`rpmtrans.RPMBaseCallback.action.keys()`
        :param te_current: a number representing the amount of work
           already done in the current transaction
        :param te_total: a number representing the total amount of work
           to be done in the current transaction
        :param ts_current: the number of the current transaction in
           transaction set
        :param ts_total: the total number of transactions in the
           transaction set
        ildN(	Rt_max_action_widthR�ttypestStringTypesR�RSRPt
_out_event(R tpackageRt
te_currenttte_totalt
ts_currenttts_totaltprocesstwid1RHtpercent((s/usr/share/yum-cli/output.pytevent�s
		cCsit|d�s\d}x8|jj�D]'}t|�}||kr%|}q%q%W||_n|j}|S(Nt_max_action_wid_cachei(RRR�RRa(R R^Ritwid_val((s/usr/share/yum-cli/output.pyRT�s
	c	Cs�|jr�tjj�s$||kr�|j|||dtjj�d|d|�\}	}}
|	t|||�t||
|
�f}||jkr�tjjt|��tjj	�||_n||kr�dGHq�ndS(NRRHR^R�(
R�RVRWRXt_makefmtRROtwriteRtflush(R RYRZR[R\R_R]RHR^R�twid2R�((s/usr/share/yum-cli/output.pyRW�s$
cCs0|r,tjjt|��tjj�ndS(s�Print messages originating from a package script.

        :param package: unused
        :param msgs: the messages coming from the script
        N(RVRWRdRRe(R RXR((s/usr/share/yum-cli/output.pyt	scriptout�sicCs�tt|��}d||f}d|d|d}	|	||f}
|dkr]d}nt|�}d|d}|d|d7}|d7}|d7}|d7}|j}
|
|kr�|}
n|
|8}
||
dkr�|
d}n|j||}d||f}
d|
d	}||d}|rN|d
krNd|
}|}n�|r�||jt||d�f}d
|d|
}|}nK|d
kr�d|
}|}n,||j|f}d|d|
}|}|||fS(Ns%s.%st%ss/%Riiis[%-ss]ids
  %s: %s   gY@s

  %s: %s R�s  %s: %s   s	  %s: %s (R�R�R&RR�RQR�(R R_R[R\RRHR^tlRtfmt_doneR�tpnltoverheadR�RRtfmt_bartfull_pnlR�Rftbar((s/usr/share/yum-cli/output.pyRc�sH	


		


	"	
	c
	Csw|}t|j�}d}td�}t|j�}tt|�|j��}	|jdd||||||	�dS(sC Callback for post transaction when we are in verifyTransaction(). idt	VerifyingN(	R�R�RR�R�RRRTRW(
R tbaseR�R�RYRZR_R]RHR^((s/usr/share/yum-cli/output.pytverify_txmbr
sN(R�sodsudN(R#R$R%R�R�R&RnRSR`RTRWRgRORcRr(((s/usr/share/yum-cli/output.pyRNs
		"			
/c
Csd}tjj�sdS|dkr.d}n%|dkrMt|�|}nd}t�}|dkr}||kr}d}nd||f}|t|�d8}|dkr�d}n|dkr|d8}|dkr�d}n|t||�}d|||f}n�||kr6d	t|||�|f}n�|d
8}|dkrUd}n|d}	|	t	|�kr�t	|�}	n||	8}|t||�}dt||	|	�|||f}||kr�tjj
|�n||kr�tjj
d�ntjj�dS(
sIOutput the current status to the terminal using a simple
    text progress bar consisting of 50 # marks.

    :param current: a number representing the amount of work
       already done
    :param total: a number representing the total amount of work
       to be done
    :param name: a name to label the progress bar with
    R�NiRms %d/%diis	
[%-*s]%ss
%s%sis

%s: [%-*s]%ss
(RVRWRXRRR&R�R�RRRdRe(
R�R�R�RQR_R�RuthashbarR�tnwid((s/usr/share/yum-cli/output.pyR�
sL				
	
	


t__main__iRR<s5 Doing format_number tests, right column should alignigg�������?g�?g�������?i
ig333333&@idgfffff�[@i�iWii'ig+i��i?Biii#s%36s <%s> %s <%5s>R�iRs Doing progress, small nameietabcds Doing progress, big names_%s_s
123456789 is Doing progress, no namesrpm-progresstfoos_12345678_.endRos! Doing CB, small proc / small pkgtspkgs Doing CB, big proc / big pkgtlpkgs-=is.ends
i18n-progresssi18n-rpm-progresss! Doing progress, i18n: small names正在安装s Doing progress, i18n: big names' Doing CB, i18n: small proc / small pkgs# Doing CB, i18n: big proc / big pkg(GR%RVR�R�RURRfR�RoR3Rturlgrabber.progressRRRturlgrabber.grabberRtyum.miscRtyum.i18nRRRR9trpmUtils.miscutilsRR	t
yum.constantsRRR
tyum.rpmtransRtyum.packageSackRtyum.packagestyum.historyRRRR�RRTRRRR'R*R�R2R)R&RMRNR�R#R�targvRR�RRR�tsleeptcbROR�RR`R:tsetup_locale(((s/usr/share/yum-cli/output.pyt<module>s
	
	�U���������b�<1�>(	$*(
.		

(%.%		(

Anon7 - 2022
AnonSec Team