/usr/lib/python3.9/site-packages/dnf/cli/__pycache__
NameSizeModeActions
aliases.cpython-39.opt-1.pyc54920644editdlrm
aliases.cpython-39.pyc54920644editdlrm
cli.cpython-39.opt-1.pyc331390644editdlrm
cli.cpython-39.pyc332010644editdlrm
completion_helper.cpython-39.opt-1.pyc84320644editdlrm
completion_helper.cpython-39.pyc84320644editdlrm
demand.cpython-39.opt-1.pyc15970644editdlrm
demand.cpython-39.pyc15970644editdlrm
format.cpython-39.opt-1.pyc23610644editdlrm
format.cpython-39.pyc23610644editdlrm
main.cpython-39.opt-1.pyc54430644editdlrm
main.cpython-39.pyc54430644editdlrm
option_parser.cpython-39.opt-1.pyc175290644editdlrm
option_parser.cpython-39.pyc175290644editdlrm
output.cpython-39.opt-1.pyc572830644editdlrm
output.cpython-39.pyc573530644editdlrm
progress.cpython-39.opt-1.pyc46690644editdlrm
progress.cpython-39.pyc46690644editdlrm
term.cpython-39.opt-1.pyc118010644editdlrm
term.cpython-39.pyc118220644editdlrm
utils.cpython-39.opt-1.pyc32500644editdlrm
utils.cpython-39.pyc32500644editdlrm
__init__.cpython-39.opt-1.pyc5270644editdlrm
__init__.cpython-39.pyc5270644editdlrm
Edit: /usr/lib/python3.9/site-packages/dnf/cli/__pycache__/term.cpython-39.pyc (11822B)
a ©!cZ9ã@sxddlmZddlmZddlZddlZddlZddlZddlZddl Z ddl Z d dd„Z d dd„Z Gd d „d e ƒZdS) é)Úabsolute_import)Úunicode_literalsNécCsDz*d}t |tj|¡}t d|¡d}|WSty>YdS0dS)z Get the real terminal width ZabcdefghshhhhrN)ÚfcntlZioctlÚtermiosZ TIOCGWINSZÚstructÚunpackÚIOError)ÚfdÚbufÚret©r ú0/usr/lib/python3.9/site-packages/dnf/cli/term.pyÚ_real_term_widths rcCs&tdd�}|sdS|dkrdS|SdS)z@ Compute terminal width falling to default 80 in case of troubler©r éPéN©r)r Ztwr r rÚ _term_width)s  rc @seZdZdZdZedd„ƒZedd„ƒZdddd œZd d d d dddddœZ d d d d dddddœZ dddddddœZ dddddd d!d"dœZ d#d$d%d&d'd(d)d*dœZ d+d,„ZdFd/d0„ZdGd1d2„Zd3d4„Zd5d6„Zd7d8„ZdHd:d;„Zdd?„Zd@dA„ZdBdC„ZdDdE„Zd-S)IÚTermz>A class to provide some terminal "UI" helpers based on curses.TcCstƒS©Nr©Úselfr r rÚ@óz Term.cCstƒSr)rrr r rrArZsmulZrevZsgr0)Ú underlineÚreverseÚnormalrréééééé©ÚblackÚblueÚgreenÚcyanÚredÚmagentaÚyellowÚwhite)r%r)r'r+r&r*r(r,zzÚzzz(B©ÚboldZblinkZdimrrrzzzzzzzzzzzzzzzzcCs|j|_|j|_|j|_dSr)Ú_Term__ansi_forced_MODEÚMODEÚ_Term__ansi_forced_FG_COLORÚFG_COLORÚ_Term__ansi_forced_BG_COLORÚBG_COLORrr r rZ __forced_initzszTerm.__forced_initNÚautoc CsDd|_d|_|dkr | ¡dSdddddddœ|_dddddddddœ|_dddddddddœ|_|dkrvd |_dS|d ks‚J‚|sŒtj}| ¡sžd |_dSzt j |  ¡d �Wnt yÌd |_YdS0t j |_t  d ¡|_|jD].}|}||jv�r|j|}| |¡|j|<qè| d ¡ d¡}|�r`|j ¡D]&\}}t  ||¡ ¡�pTd|j|<�q8| d¡ d¡}|�r¬|j ¡D]*\}}t  ||¡ ¡�pœd}||j|<�q€| d¡ d¡} | �rô|j ¡D]&\}}t  | |¡ ¡�pèd|j|<�qÌ| d¡ d¡} | �r@|j ¡D]*\}}t  | |¡ ¡�p0d} | |j|<�qdS)a Reinitializes the :class:`Term`. :param term_stream: the terminal stream that the :class:`Term` 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. TéÚalwaysNr-r.r$ÚneverFr6rÚlinesZsetfzutf-8ZsetafZsetbZsetab)Ú_Term__enabledr:Ú_Term__forced_initr1r3r5ÚsysÚstdoutÚisattyÚcursesZ setuptermÚfilenoÚ ExceptionZtigetstrÚ _ctigetstrZtigetnumÚ_Term__cap_namesÚ _tigetstrÚencodeÚ _Term__colorsÚitemsZtparmÚdecodeÚ_Term__ansi_colors) rÚ term_streamÚcolorÚcap_nameÚmodeZset_fgÚvalZ set_fg_ansiZfg_colorZset_bgZ set_bg_ansiZbg_colorr r rÚreinitsŠ ú ø ø         z Term.reinitcCs| ||¡dSr)rP)rrKrLr r rÚ__init__åsz Term.__init__cCs0| |¡p d}tj |¡r"| ¡}t dd|¡S)Nr-z \$<\d+>[/*]?)rCÚdnfZpycompZ is_py3bytesrIÚreÚsub)rrMZcapr r rrEès zTerm._tigetstrcCs|j|t|ƒ|jdS)zColorize string with colorr)r1Ústr)rrLÚsr r rrLñsz Term.colorcCs | d|¡S)zMake string bold.r/)rL)rrVr r rr/õsz Term.boldFc sX|js |S|stj}‡‡fdd„}|D],}||ƒ} |r>> yt = Term() >>> 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ˆ| ¡ˆSr)Úgroup)Úmatch©ÚbegÚendr rrrzTerm.sub..r)Úflags)r;rSÚescapeÚIrT) rÚhaystackrZr[Úneedlesr]Z ignore_caseZrenderZneedleÚpatr\r rYrrTùs zTerm.subcKs|j|||jd|fi|¤ŽS)aOSearch 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* r)rTr1)rr_rZr`Úkwdsr r rÚsub_norm&sz Term.sub_normcKs|j||j||fi|¤ŽS)aTSearch 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* )rcr1)rr_rNr`rbr r rÚsub_mode9sz Term.sub_modecKs|j|d|fi|¤ŽS)aÚ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/)rd)rr_r`rbr r rÚsub_boldMsz Term.sub_boldcKs|j||j||fi|¤ŽS)acSearch 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* )rcr3©rr_rLr`rbr r rÚsub_fg_sz Term.sub_fgcKs|j||j||fi|¤ŽS)a…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* )rcr5rfr r rÚsub_bgssz Term.sub_bg)Nr6)Nr6)NF)Ú__name__Ú __module__Ú __qualname__Ú__doc__r;ÚpropertyZ real_columnsÚcolumnsrDrGrJr0r2r4r<rPrQrErLr/rTrcrdrergrhr r r rr4s~   ýø ø ú ø ø  f   -r)r)r)Z __future__rrr@Z dnf.pycomprRrrSrr=rrrÚobjectrr r r rÚs