View file File name : filter.cpython-38.pyc Content :U `a�[� � @ s: d Z d dd�Zdd� ZG dd� de�ZG dd � d e�ZdS )z� pygments.filter ~~~~~~~~~~~~~~~ Module that implements the default filter. :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. Nc s$ � fdd�}|D ]}||| �} q| S )z� Use this method to apply an iterable of filters to a stream. If lexer is given it's forwarded to the filter, otherwise the filter receives `None`. c 3 s | � � |�D ] }|V qd S �N)�filter)�filter_�stream�token��lexer� �1/usr/lib/python3/dist-packages/pygments/filter.py�_apply s zapply_filters.<locals>._applyr )r �filtersr r r r r r � apply_filters s r c C s t | jtft| d�| j| d��S )z� Decorator that converts a function into a filter:: @simplefilter def lowercase(self, lexer, stream, options): for ttype, value in stream: yield ttype, value.lower() � __module__)r �__doc__�function)�type�__name__�FunctionFilter�getattrr )�fr r r �simplefilter s �r c @ s e Zd ZdZdd� Zdd� ZdS )�Filterzl Default filter. Subclass this class or use the `simplefilter` decorator to create own filters. c K s || _ d S r )�options��selfr r r r �__init__1 s zFilter.__init__c C s t � �d S r )�NotImplementedError)r r r r r r r 4 s z Filter.filterN)r r �__qualname__r r r r r r r r + s r c @ s$ e Zd ZdZdZdd� Zdd� ZdS )r z� Abstract class used by `simplefilter` to create simple function filters on the fly. The `simplefilter` decorator automatically creates subclasses of this class for functions passed to it. Nc K s, t | d�std| jj ��tj| f|� d S )Nr z%r used without bound function)�hasattr� TypeError� __class__r r r r r r r r A s �zFunctionFilter.__init__c c s( | � ||| j�D ]\}}||fV qd S r )r r )r r r Zttype�valuer r r r G s zFunctionFilter.filter)r r r r r r r r r r r r 8 s r )N)r r r �objectr r r r r r �<module> s