| Server IP : 127.0.0.1 / Your IP : 216.73.216.109 Web Server : Apache/2.4.54 (Win64) OpenSSL/1.1.1q PHP/8.1.10 System : Windows NT DESKTOP-E5T4RUN 10.0 build 19045 (Windows 10) AMD64 User : SERVERWEB ( 0) PHP Version : 8.1.10 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/cygwin64/lib/python3.9/site-packages/babel/__pycache__/ |
Upload File : |
a
�4d � @ s` d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl m
Z
mZ ddlm
Z
mZmZ ddlmZmZ e� Zed�Zdd d
�dd�Ze�d
ej�Zddd�dd�Ze�d�Zd,dddd�dd�Zdddd�dd�ZG dd� dej�Zd-ddddd"d#�d$d%�Zej Z!G d&d'� d'ej"�Z#ej$Z$ej%Z%ej&Z&ej'Z'ej(Z(ej)Z)ej*Z*d(d(d)�d*d+�Z+dS ).z�
babel.util
~~~~~~~~~~
Various utility classes and functions.
:copyright: (c) 2013-2023 by the Babel Team.
:license: BSD, see LICENSE for more details.
� )�annotationsN)� Generator�Iterable)�IO�Any�TypeVar)�dates� localtime�_TzIterable[_T]zGenerator[_T, None, None])�iterable�returnc c s0 t � }t| �D ]}||vr|V |�|� qdS )a� Yield all items in an iterable collection that are distinct.
Unlike when using sets for a similar effect, the original ordering of the
items in the collection is preserved by this function.
>>> print(list(distinct([1, 2, 1, 3, 4, 4])))
[1, 2, 3, 4]
>>> print(list(distinct('foobar')))
['f', 'o', 'b', 'a', 'r']
:param iterable: the iterable collection providing the data
N)�set�iter�add)r �seen�item� r �./usr/lib/python3.9/site-packages/babel/util.py�distinct s
r s( [ \t\f]* \# .* coding[=:][ \t]*([-\w.]+)z IO[bytes]�
str | None)�fpr c
C s$ | � � }| �d� � z�| �� }|�tj�}|r@|ttj�d� }t�|�}|s�zddl }|�
|�d�� W n tt
tfy� Y n0 | �� }t�|�}|r�|r�|�d��d�}|dkr�t
d|� d���W | �|� dS |r�|�d��d�W | �|� S W | �|� dS W | �|� n| �|� 0 dS )a/ Deduce the encoding of a source file from magic comment.
It does this in the same way as the `Python interpreter`__
.. __: https://docs.python.org/3.4/reference/lexical_analysis.html#encoding-declarations
The ``fp`` argument should be a seekable file object.
(From Jeff Dairiki)
r N�latin-1� zutf-8zencoding problem: z with BOM)�tell�seek�readline�
startswith�codecs�BOM_UTF8�len�PYTHON_MAGIC_COMMENT_re�match�ast�parse�decode�ImportError�SyntaxError�UnicodeEncodeError�group)r �posZline1Zhas_bom�mr"