o ‡ÎÖaM ã@sDdZddlZddlmZddlmZdgZdd„ZGdd„dƒZdS) z¾ pygments.formatter ~~~~~~~~~~~~~~~~~~ Base formatter class. :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. éN)Ú get_bool_opt)Úget_style_by_nameÚ FormattercCst|tƒr t|ƒS|S)N)Ú isinstanceÚstrr)Ústyle©rú4/usr/lib/python3/dist-packages/pygments/formatter.pyÚ _lookup_styles r c@s:eZdZdZdZgZgZdZdd„Zd dd„Z d d „Z dS) raŒ Converts a token stream to text. Options accepted: ``style`` The style to use, can be a string or a Style subclass (default: "default"). Not used by e.g. the TerminalFormatter. ``full`` Tells the formatter to output a "full" document, i.e. a complete self-contained document. This doesn't have any effect for some formatters (default: false). ``title`` If ``full`` is true, the title that should be used to caption the document (default: ''). ``encoding`` If given, must be an encoding name. This will be used to convert the Unicode token strings to byte strings in the output. If it is "" or None, Unicode strings will be written to the output file, which most file-like objects do not support (default: None). ``outencoding`` Overrides ``encoding`` if given. NTcKslt| dd¡ƒ|_t|ddƒ|_| dd¡|_| dd¡pd|_|jdvr(d |_| d ¡p/|j|_||_dS) NrÚdefaultÚfullFÚtitleÚÚencoding)ÚguessÚchardetzutf-8Ú outencoding)r Úgetrrr r rÚoptions)Úselfrrrr Ú__init__As  zFormatter.__init__rcCsdS)a Return the style definitions for the current style as a string. ``arg`` is an additional argument whose meaning depends on the formatter used. Note that ``arg`` can also be a list or tuple for some formatters like the html formatter. rr)rÚargrrr Úget_style_defsLszFormatter.get_style_defscCs&|jr t |j¡d|ƒ}| ||¡S)zƒ Format ``tokensource``, an iterable of ``(tokentype, tokenstring)`` tuples and write it into ``outfile``. é)rÚcodecsÚlookupÚformat_unencoded)rÚ tokensourceÚoutfilerrr ÚformatVs zFormatter.format)r) Ú__name__Ú __module__Ú __qualname__Ú__doc__ÚnameÚaliasesÚ filenamesÚ unicodeoutputrrrrrrr rs ) r#rÚ pygments.utilrÚpygments.stylesrÚ__all__r rrrrr Ús