o 7]h@snddlmZmZddlmZmZddlmZdedefddZ Gd d d eZ Gd d d e Z Gd dde Z Gddde Z Gddde ZedkrddlmZeZedededededededededededed ed!ed"ed#ed$ed%ed&ed'd(Sd(S)))ABCabstractmethod)ListUnion)TextregexesreturncGs d|S)z{Combine a number of regexes in to a single regex. Returns: str: New regex with all regexes ORed together. |)join)rr >/usr/lib/python3/dist-packages/pip/_vendor/rich/highlighter.py_combine_regexs rc@s@eZdZdZdeeefdefddZededdfddZ dS) Highlighterz%Abstract base class for highlighters.textr cCsDt|tr t|}nt|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__NcCdS)zoApply highlighting in place to text. Args: text (~Text): A text object highlight. Nr rrr r r r(zHighlighter.highlight) __name__ __module__ __qualname____doc__rrrrrrr r r r rs rc@s"eZdZdZdeddfddZdS)NullHighlighterzeA highlighter object that doesn't highlight. May be used to disable highlighting entirely. rr NcCr)z Nothing to doNr rr r r r8rzNullHighlighter.highlight)rrrrrrr r r r r 1sr c@s@eZdZUdZgZeeed<dZeed<de ddfdd Z dS) RegexHighlighterz8Applies highlighting from a list of regular expressions. highlights base_stylerr NcCs$|j}|jD] }|||jdqdS)zHighlight :class:`rich.text.Text` using regular expressions. Args: text (~Text): Text to highlighted. ) style_prefixN)highlight_regexr"r$)rrr& re_highlightr r r rBs zRegexHighlighter.highlight) rrrrr"rr__annotations__r$rrr r r r r!<s  r!c@s:eZdZdZdZdddedddd d d d d dddd gZdS)ReprHighlighterzAHighlights the text typically produced from ``__repr__`` methods.zrepr.zS(?P\<)(?P[\w\-\.\:]*)(?P[\w\W]*?)(?P\>)z<(?P[\w_]{1,50})=(?P\"?[\w_]+\"?)?(?P[\{\[\(\)\]\}])z8(?P[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})z4(?P([A-Fa-f0-9]{1,4}::?){1,7}[A-Fa-f0-9]{1,4})z(?P(?:[0-9A-Fa-f]{1,2}-){7}[0-9A-Fa-f]{1,2}|(?:[0-9A-Fa-f]{1,2}:){7}[0-9A-Fa-f]{1,2}|(?:[0-9A-Fa-f]{4}\.){3}[0-9A-Fa-f]{4})z(?P(?:[0-9A-Fa-f]{1,2}-){5}[0-9A-Fa-f]{1,2}|(?:[0-9A-Fa-f]{1,2}:){5}[0-9A-Fa-f]{1,2}|(?:[0-9A-Fa-f]{4}\.){2}[0-9A-Fa-f]{4})z(?P[\w\.]*?)\(zD\b(?PTrue)\b|\b(?PFalse)\b|\b(?PNone)\bz(?P\.\.\.)E(?P(?\B(\/[\w\.\-\_\+]+)*\/)(?P[\w\.\-\_\+]*)?zg(?b?\'\'\'.*?(?[a-fA-F0-9]{8}\-[a-fA-F0-9]{4}\-[a-fA-F0-9]{4}\-[a-fA-F0-9]{4}\-[a-fA-F0-9]{12})zU(?P(file|https|http|ws|wss):\/\/[0-9a-zA-Z\$\-\_\+\!`\(\)\,\.\?\/\;\:\&\=\%\#]*)Nrrrrr$rr"r r r r r)Os*r)c@s&eZdZdZdZedddddgZdS) JSONHighlighterzHighlights JSONzjson.r*zD\b(?Ptrue)\b|\b(?Pfalse)\b|\b(?Pnull)\br+z$(?b?\".*?(?b?\".*?(?sD  !