File manager - Edit - /home/newsbmcs.com/public_html/static/img/logo/formatters.zip
Back
PK J�Z['*�� � other.pynu �[��� """ pygments.formatters.other ~~~~~~~~~~~~~~~~~~~~~~~~~ Other formatters: NullFormatter, RawTokenFormatter. :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from pip._vendor.pygments.formatter import Formatter from pip._vendor.pygments.util import get_choice_opt from pip._vendor.pygments.token import Token from pip._vendor.pygments.console import colorize __all__ = ['NullFormatter', 'RawTokenFormatter', 'TestcaseFormatter'] class NullFormatter(Formatter): """ Output the text unchanged without any formatting. """ name = 'Text only' aliases = ['text', 'null'] filenames = ['*.txt'] def format(self, tokensource, outfile): enc = self.encoding for ttype, value in tokensource: if enc: outfile.write(value.encode(enc)) else: outfile.write(value) class RawTokenFormatter(Formatter): r""" Format tokens as a raw representation for storing token streams. The format is ``tokentype<TAB>repr(tokenstring)\n``. The output can later be converted to a token stream with the `RawTokenLexer`, described in the :doc:`lexer list <lexers>`. Only two options are accepted: `compress` If set to ``'gz'`` or ``'bz2'``, compress the output with the given compression algorithm after encoding (default: ``''``). `error_color` If set to a color name, highlight error tokens using that color. If set but with no value, defaults to ``'red'``. .. versionadded:: 0.11 """ name = 'Raw tokens' aliases = ['raw', 'tokens'] filenames = ['*.raw'] unicodeoutput = False def __init__(self, **options): Formatter.__init__(self, **options) # We ignore self.encoding if it is set, since it gets set for lexer # and formatter if given with -Oencoding on the command line. # The RawTokenFormatter outputs only ASCII. Override here. self.encoding = 'ascii' # let pygments.format() do the right thing self.compress = get_choice_opt(options, 'compress', ['', 'none', 'gz', 'bz2'], '') self.error_color = options.get('error_color', None) if self.error_color is True: self.error_color = 'red' if self.error_color is not None: try: colorize(self.error_color, '') except KeyError: raise ValueError("Invalid color %r specified" % self.error_color) def format(self, tokensource, outfile): try: outfile.write(b'') except TypeError: raise TypeError('The raw tokens formatter needs a binary ' 'output file') if self.compress == 'gz': import gzip outfile = gzip.GzipFile('', 'wb', 9, outfile) write = outfile.write flush = outfile.close elif self.compress == 'bz2': import bz2 compressor = bz2.BZ2Compressor(9) def write(text): outfile.write(compressor.compress(text)) def flush(): outfile.write(compressor.flush()) outfile.flush() else: write = outfile.write flush = outfile.flush if self.error_color: for ttype, value in tokensource: line = b"%r\t%r\n" % (ttype, value) if ttype is Token.Error: write(colorize(self.error_color, line)) else: write(line) else: for ttype, value in tokensource: write(b"%r\t%r\n" % (ttype, value)) flush() TESTCASE_BEFORE = '''\ def testNeedsName(lexer): fragment = %r tokens = [ ''' TESTCASE_AFTER = '''\ ] assert list(lexer.get_tokens(fragment)) == tokens ''' class TestcaseFormatter(Formatter): """ Format tokens as appropriate for a new testcase. .. versionadded:: 2.0 """ name = 'Testcase' aliases = ['testcase'] def __init__(self, **options): Formatter.__init__(self, **options) if self.encoding is not None and self.encoding != 'utf-8': raise ValueError("Only None and utf-8 are allowed encodings.") def format(self, tokensource, outfile): indentation = ' ' * 12 rawbuf = [] outbuf = [] for ttype, value in tokensource: rawbuf.append(value) outbuf.append('%s(%s, %r),\n' % (indentation, ttype, value)) before = TESTCASE_BEFORE % (''.join(rawbuf),) during = ''.join(outbuf) after = TESTCASE_AFTER if self.encoding is None: outfile.write(before + during + after) else: outfile.write(before.encode('utf-8')) outfile.write(during.encode('utf-8')) outfile.write(after.encode('utf-8')) outfile.flush() PK J�ZH��{ { $ __pycache__/_mapping.cpython-310.pycnu �[��� o �7]ht � @ sN d Z i dd�dd�dd�dd�d d �dd�d d�dd�dd�dd�dd�dd�dd�dd�dd�dd �d!d"�d#d$i�Zed%k�r%d&d'lZd&d'lZg Zg Zej�d&ej� ej� e�d(d(�� d&d)lm Z e�d*�D ]T\ZZZeD ]LZe�d+�r�e�d,�s�d-ed.d'� �d/d*�ed'd0� f Zee� eed'd'd1g�ZejD ]Zeee�Ze�d2eeeje ej!�e ej"�e e�ff � q�qoqhe�#� e$e��Z%e%�&� Z'e'�d3d4�Z'W d' � n1 s�w Y e'd'e'�(d5�� Z)e'e'�(d6�d'� Z*e$ed7��Z%e%�+e)� e%�+d8d9� e� � e%�+e*� W d' � n 1 �sw Y ed:e,e� � d'S d'S );a� pygments.formatters._mapping ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Formatter mapping definitions. This file is generated by itself. Everytime you change something on a builtin formatter definition, run this script from the formatters folder to update it. Do not alter the FORMATTERS dictionary by hand. :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. �BBCodeFormatter)zpygments.formatters.bbcode�BBCode)�bbcode�bb� z�Format tokens with BBcodes. These formatting codes are used by many bulletin boards, so you can highlight your sourcecode with pygments before posting it there.�BmpImageFormatter)�pygments.formatters.img�img_bmp)�bmp�bitmap)z*.bmpzwCreate a bitmap image from source code. This uses the Python Imaging Library to generate a pixmap from the source code.�GifImageFormatter)r �img_gif)�gif)z*.gifztCreate a GIF image from source code. This uses the Python Imaging Library to generate a pixmap from the source code.�GroffFormatter)zpygments.formatters.groff�groff)r �troff�roffr zFFormat tokens with groff escapes to change their color and font style.� HtmlFormatter)zpygments.formatters.html�HTML)�html)z*.htmlz*.htmz�Format tokens as HTML 4 ``<span>`` tags within a ``<pre>`` tag, wrapped in a ``<div>`` tag. The ``<div>``'s CSS class can be set by the `cssclass` option.�IRCFormatter)zpygments.formatters.irc�IRC)�ircr r z&Format tokens with IRC color sequences�ImageFormatter)r �img)r �IMG�png)z*.pngztCreate a PNG image from source code. This uses the Python Imaging Library to generate a pixmap from the source code.�JpgImageFormatter)r �img_jpg)�jpg�jpeg)z*.jpgzuCreate a JPEG image from source code. This uses the Python Imaging Library to generate a pixmap from the source code.�LatexFormatter)zpygments.formatters.latex�LaTeX)�latex�tex)z*.texzUFormat tokens as LaTeX code. This needs the `fancyvrb` and `color` standard packages.� NullFormatter)�pygments.formatters.otherz Text only)�text�null)z*.txtz1Output the text unchanged without any formatting.�PangoMarkupFormatter)zpygments.formatters.pangomarkupzPango Markup)�pango�pangomarkupr zFFormat tokens as Pango Markup code. It can then be rendered to an SVG.�RawTokenFormatter)r% z Raw tokens)�raw�tokens)z*.rawz@Format tokens as a raw representation for storing token streams.�RtfFormatter)zpygments.formatters.rtf�RTF)�rtf)z*.rtfz�Format tokens as RTF markup. This formatter automatically outputs full RTF documents with color information and other useful stuff. Perfect for Copy and Paste into Microsoft(R) Word(R) documents.�SvgFormatter)zpygments.formatters.svg�SVG)�svg)z*.svgz�Format tokens as an SVG graphics file. This formatter is still experimental. Each line of code is a ``<text>`` element with explicit ``x`` and ``y`` coordinates containing ``<tspan>`` elements with the individual token styles.�Terminal256Formatter)�pygments.formatters.terminal256�Terminal256)�terminal256� console256�256r z�Format tokens with ANSI color sequences, for output in a 256-color terminal or console. Like in `TerminalFormatter` color sequences are terminated at newlines, so that paging the output works correctly.�TerminalFormatter)zpygments.formatters.terminal�Terminal)�terminal�consoler z�Format tokens with ANSI color sequences, for output in a text console. Color sequences are terminated at newlines, so that paging the output works correctly.�TerminalTrueColorFormatter)r5 �TerminalTrueColor)�terminal16m� console16m�16mr z�Format tokens with ANSI color sequences, for output in a true-color terminal or console. Like in `TerminalFormatter` color sequences are terminated at newlines, so that paging the output works correctly.�TestcaseFormatter)r% �Testcase)�testcaser z0Format tokens as appropriate for a new testcase.�__main__� Nz..)�docstring_headline�.z.py�_zpygments.formatters%s.%s� �/���� z%r: %rz � zFORMATTERS = {zif __name__ == '__main__':�wzFORMATTERS = { %s } z, z=== %d formatters processed.)-�__doc__� FORMATTERS�__name__�sys�os�found_formatters�imports�path�insert�join�dirname�__file__�pip._vendor.pygments.utilrH �walk�root�dirs�files�filename�endswith� startswith�replace�module_name�print� __import__�module�__all__�formatter_name�getattr� formatter�append�name�tuple�aliases� filenames�sort�open�fp�read�content�find�header�footer�write�lenr r r �J/usr/lib/python3/dist-packages/pip/_vendor/pygments/formatters/_mapping.py�<module> s� �������� � ��� ������ "� ����� � ��PK J�Z�pb� � ! __pycache__/other.cpython-310.pycnu �[��� o �7]h� � @ sx d Z ddlmZ ddlmZ ddlmZ ddlmZ g d�Z G dd� de�Z G d d � d e�ZdZdZ G d d� de�ZdS )z� pygments.formatters.other ~~~~~~~~~~~~~~~~~~~~~~~~~ Other formatters: NullFormatter, RawTokenFormatter. :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. � )� Formatter)�get_choice_opt)�Token)�colorize)� NullFormatter�RawTokenFormatter�TestcaseFormatterc @ s* e Zd ZdZdZddgZdgZdd� ZdS ) r z; Output the text unchanged without any formatting. z Text only�text�nullz*.txtc C s8 | j }|D ]\}}|r|�|�|�� q|�|� qd S �N)�encoding�write�encode)�self�tokensource�outfile�enc�ttype�value� r �G/usr/lib/python3/dist-packages/pip/_vendor/pygments/formatters/other.py�format s �zNullFormatter.formatN)�__name__� __module__�__qualname__�__doc__�name�aliases� filenamesr r r r r r s r c @ s6 e Zd ZdZdZddgZdgZdZdd� Zd d � Z dS )r a} Format tokens as a raw representation for storing token streams. The format is ``tokentype<TAB>repr(tokenstring)\n``. The output can later be converted to a token stream with the `RawTokenLexer`, described in the :doc:`lexer list <lexers>`. Only two options are accepted: `compress` If set to ``'gz'`` or ``'bz2'``, compress the output with the given compression algorithm after encoding (default: ``''``). `error_color` If set to a color name, highlight error tokens using that color. If set but with no value, defaults to ``'red'``. .. versionadded:: 0.11 z Raw tokens�raw�tokensz*.rawFc K s� t j| fi |�� d| _t|dg d�d�| _|�dd �| _| jdu r%d| _| jd urBz t| jd� W d S tyA t d| j ��w d S ) N�ascii�compress)� �none�gz�bz2r# �error_colorT�redzInvalid color %r specified) r �__init__r r r"