3 ��X|. � @ s� d Z ddlZddlZejd�ZejdejejB ejB �Zejdej ej B ejB ejB �Zejdej�Z G dd� de�ZG d d � d e�Zd8dd �Zd9dd�Zd:dd�Zd;dd�Zdd� Zdd� Zdd� Zdd� Zdd� Zi Zdd� Zd d!� Zd"d#� Zd<d$d%�Zf fd&d'�Z G d(d)� d)e!�Z"d*d+� Z#d,d-� Z$d.d/� Z%ej&d=k �r~e'Z'e(Z(e)e*fZ+e*Z,d1Z-e.j/Z/e.j0Z0ddl1Z1ddl2Z2e1j1Z1e2j1Z3nFe4Z'e5Z(e)fZ+e)Z,d2Z-e.j6Z/e.j7Z0dd3l8m1Z1m3Z3m9Z9 G d4d5� d5e9�Z:d6d7� Z;dS )>z� pygments.util ~~~~~~~~~~~~~ Utility functions. :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. � Nz[/\\ ]z� (<\?.*?\?>)?\s* <!DOCTYPE\s+( [a-zA-Z_][a-zA-Z0-9]* (?: \s+ # optional in HTML5 [a-zA-Z_][a-zA-Z0-9]*\s+ "[^"]*")? ) [^>]*> z<(.+?)(\s.*?)?>.*?</.+?>z\s*<\?xml[^>]*\?>c @ s e Zd ZdZdS )� ClassNotFoundzCRaised if one of the lookup functions didn't find a matching class.N)�__name__� __module__�__qualname__�__doc__� r r �/usr/lib/python3.6/util.pyr s r c @ s e Zd ZdS )�OptionErrorN)r r r r r r r r $ s r Fc C s@ | j ||�}|r|j� }||kr<td|djtt|��f ��|S )Nz%Value for option %s must be one of %sz, )�get�lowerr �join�map�str)�options�optnameZallowed�default�normcase�stringr r r �get_choice_opt( s r c C s| | j ||�}t|t�r|S t|t�r,t|�S t|t�sHtd||f ��n0|j� d krXdS |j� dkrhdS td||f ��d S )NzBInvalid type %r for option %s; use 1/0, yes/no, true/false, on/off�1�yes�true�onT�0�no�false�offFzCInvalid value %r for option %s; use 1/0, yes/no, true/false, on/off)r r r r )r r r r )r � isinstance�bool�int�string_typesr r )r r r r r r r �get_bool_opt2 s r! c C s` | j ||�}yt|�S tk r8 td||f ��Y n$ tk rZ td||f ��Y nX d S )Nz=Invalid type %r for option %s; you must give an integer valuez>Invalid value %r for option %s; you must give an integer value)r r � TypeErrorr � ValueError)r r r r r r r �get_int_optF s r$ c C sH | j ||�}t|t�r|j� S t|ttf�r4t|�S td||f ��d S )Nz9Invalid type %r for option %s; you must give a list value)r r r �split�list�tupler )r r r �valr r r �get_list_optT s r) c C sR | j s dS g }x4| j j� j� D ]"}|j� r>|jd|j� � qP qW dj|�j� S )N� � )r �strip� splitlines�appendr �lstrip)�obj�res�liner r r �docstring_headline` s r3 c s � fdd�}� j |_ t|�S )zAReturn a static text analyser function that returns float values.c s\ y� | �}W n t k r dS X |s*dS ytdtdt|���S ttfk rV dS X d S )Ng g �?)� Exception�min�max�floatr# r"