Your IP : 216.73.216.85


Current Path : /opt/alt/python35/lib/python3.5/site-packages/joblib/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib/python3.5/site-packages/joblib/__pycache__/_memory_helpers.cpython-35.pyc



��X�@s�yddlmZWn}ek
r�ddlmZmZddlZddlm	Z	mZej
d�Zdd�Zdd	�Z
d
d�ZYnXdS)�)�open)�lookup�BOM_UTF8N)�
TextIOWrapperrzcoding[:=]\s*([-\w.]+)cCsd|dd�j�jdd�}|dks=|jd�rAdS|d
ks\|jd�r`dS|S)z(Imitates get_normal_name in tokenizer.c.N��_�-zutf-8zutf-8-�latin-1�
iso-8859-1�iso-latin-1�latin-1-�iso-8859-1-�iso-latin-1-)r	r
r)rr
r)�lower�replace�
startswith)�orig_enc�enc�r�G/opt/alt/python35/lib/python3.5/site-packages/joblib/_memory_helpers.py�_get_normal_names"rcs�d�d}d}�fdd�}�fdd�}|�}|jt�rjd�|d	d�}d
}|sz|gfS||�}|r�||gfS|�}|s�||gfS||�}|r�|||gfS|||gfS)aF
        The detect_encoding() function is used to detect the encoding that
        should be used to decode a Python source file.  It requires one
        argment, readline, in the same way as the tokenize() generator.

        It will call readline a maximum of twice, and return the encoding used
        (as a string) and a list of any lines (left as bytes) it has read in.

        It detects the encoding from the presence of a utf-8 bom or an encoding
        cookie as specified in pep-0263.  If both a bom and a cookie are
        present, but disagree, a SyntaxError will be raised.  If the encoding
        cookie is an invalid charset, raise a SyntaxError.  Note that if a
        utf-8 bom is found, 'utf-8-sig' is returned.

        If no encoding is specified, then the default of 'utf-8' will be
        returned.
        FNzutf-8cs(y��SWntk
r#dSYnXdS)N�)�
StopIterationr)�readlinerr�read_or_stop-s
z&_detect_encoding.<locals>.read_or_stopcs�y|jd�}Wntk
r+dSYnXtj|�}|sEdSt|d�}yt|�}Wn"tk
r�td|��YnX�r�|jdkr�td��|d7}|S)N�asciirzunknown encoding: zutf-8zencoding problem: utf-8z-sig)	�decode�UnicodeDecodeError�	cookie_re�findallrr�LookupError�SyntaxError�name)�line�line_string�matches�encoding�codec)�	bom_foundrr�find_cookie3s"
	

z%_detect_encoding.<locals>.find_cookieT�z	utf-8-sig)rr)rr&�defaultrr)�first�secondr)r(rr�_detect_encodings,	

	
r.cCsSt|d�}t|j�\}}|jd�t||dd�}d|_|S)z`Open a file in read only mode using the encoding detected by
        detect_encoding().
        �rbr�line_bufferingT�r)rr.r�seekr�mode)�filename�bufferr&�lines�textrrr�open_py_source`s
	r8)�tokenizerr8�ImportError�codecsrr�re�ior�compilerrr.rrrr�<module>s
I