U cfq%@sddlZddlmZmZddlmZmZddlmZm Z e e dddZ Gd d d eZ Gd d d e Z Gd dde ZGdddeZGdddeZGdddeZedkrddlmZeZedededededededededed ed!ed"ed#ed$ed%ed&ed'ed(ed)ddlZejejd*dd+d,dd-dS).N)ABCabstractmethod)ListUnion)SpanText)regexesreturncGs d|S)z{Combine a number of regexes in to a single regex. Returns: str: New regex with all regexes ORed together. |)join)r r J/opt/hc_python/lib/python3.8/site-packages/pip/_vendor/rich/highlighter.py_combine_regexsrc@s<eZdZdZeeefedddZeeddddZ dS) Highlighterz%Abstract base class for highlighters.textr cCsDt|trt|}n"t|tr(|}ntd||||S)a Highlight a str or Text instance. Args: text (Union[str, ~Text]): Text to highlight. Raises: TypeError: If not called with text or str. Returns: Text: A test instance with highlighting applied. z#str or Text instance required, not ) isinstancestrrcopy TypeError highlight)selfrhighlight_textr r r__call__s     zHighlighter.__call__NcCsdS)zoApply highlighting in place to text. Args: text (~Text): A text object highlight. Nr rrr r rr)szHighlighter.highlight) __name__ __module__ __qualname____doc__rrrrrrr r r rrsrc@s eZdZdZeddddZdS)NullHighlighterzeA highlighter object that doesn't highlight. May be used to disable highlighting entirely. NrcCsdS)z Nothing to doNr rr r rr9szNullHighlighter.highlight)rrrrrrr r r rr 2sr c@s>eZdZUdZgZeeed<dZeed<e ddddZ dS) RegexHighlighterz8Applies highlighting from a list of regular expressions. highlights base_styleNrcCs$|j}|jD]}|||jdq dS)zHighlight :class:`rich.text.Text` using regular expressions. Args: text (~Text): Text to highlighted. ) style_prefixN)highlight_regexr"r$)rrr& re_highlightr r rrCs zRegexHighlighter.highlight) rrrrr"rr__annotations__r$rrr r r rr!=s  r!c@s<eZdZdZdZdddedddd d d d d ddddd gZdS)ReprHighlighterzAHighlights the text typically produced from ``__repr__`` methods.zrepr.zN(?P<)(?P[-\w.:|]*)(?P[\w\W]*)(?P>)z:(?P[\w_]{1,50})=(?P"?[\w_]+"?)?z(?P[][{}()])z8(?P[0-9]{1,3}\.[0-9]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