| 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/messages/__pycache__/ |
Upload File : |
a
�4d� � @ sP d Z ddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl
mZ ddlm
Z
ddlmZ ddlmZ ddlmZmZ ddlmZ dd lmZ dd
lmZmZ ddlmZmZmZm Z ddl!m"Z" dd
l#m$Z$m%Z% ddl&m'Z' e�(d�Z)zNddl*m+Z, e)Z-zddl.m/Z/m0Z0m1Z1 W n e2�yH e3 Z0 Z1Z/Y n0 W nP e2�y� ddl4m)Z- ddl5m+Z, ddl6m7Z/ ddl6m8Z0 ddl6m9Z1 Y n0 d1dd�Z:G dd� de,�Z+G dd� de+�Z;dd� Z<G dd� de+�Z=d d!� Z>G d"d#� d#e+�Z?G d$d%� d%e+�Z@G d&d'� d'�ZAd(d)� ZBd2d*d+�ZCd3eeD d-�d.d/�ZEeFd0k�rLeB� dS )4z�
babel.messages.frontend
~~~~~~~~~~~~~~~~~~~~~~~
Frontends for the message extraction functionality.
:copyright: (c) 2013-2023 by the Babel Team.
:license: BSD, see LICENSE for more details.
� N)�OrderedDict)�RawConfigParser)�StringIO)�Iterable)�Locale�
localedata)�__version__)�UnknownLocaleError)�DEFAULT_HEADER�Catalog)�DEFAULT_KEYWORDS�DEFAULT_MAPPING�check_and_call_extract_file�extract_from_dir)�write_mo)�read_po�write_po)�LOCALTZ�babel)�Command)� BaseError�OptionError�
SetupError)�log)�DistutilsError)�DistutilsOptionError)�DistutilsSetupErrorc C sp g }t | ttf�s| g} | D ]N}|du r*qt |ttf�rL|�t||d�� q|�dd� t|��|�D �� q|S )a
Make a list out of an argument.
Values from `distutils` argument parsing are always single strings;
values from `optparse` parsing may be lists of strings that may need
to be further split.
No matter the input, this function returns a flat list of whitespace-trimmed
strings, with `None` values filtered out.
>>> listify_value("foo bar")
['foo', 'bar']
>>> listify_value(["foo bar"])
['foo', 'bar']
>>> listify_value([["foo"], "bar"])
['foo', 'bar']
>>> listify_value([["foo"], ["bar", None, "foo"]])
['foo', 'bar', 'foo']
>>> listify_value("foo, bar, quux", ",")
['foo', 'bar', 'quux']
:param arg: A string or a list of strings
:param split: The argument to pass to `str.split()`.
:return:
N��splitc s s | ]}|� � V qd S �N��strip)�.0�s� r$ �;/usr/lib/python3.9/site-packages/babel/messages/frontend.py� <genexpr>` � z listify_value.<locals>.<genexpr>)�
isinstance�list�tuple�extend�
listify_value�strr )�argr �out�valr$ r$ r% r, ; s r, c @ s. e Zd ZdZdZdZi Zi ZeZ ddd�Z
dS )r Nr$ c C s0 || _ | �� d | _d| _d | _d| _d| _d S )NFr )�distribution�initialize_optionsZ_dry_run�verbose�force�helpZ finalized)�self�distr$ r$ r% �__init__� s zCommand.__init__)N)�__name__�
__module__�__qualname__�as_args�multiple_value_options�boolean_options�option_aliases�option_choices�
distutils_logr r8 r$ r$ r$ r% r e s r c @ sD e Zd ZdZdZg d�ZddgZdd� Zdd � Zd
d� Z dd
� Z
dS )�compile_cataloga� Catalog compilation command for use in ``setup.py`` scripts.
If correctly installed, this command is available to Setuptools-using
setup scripts automatically. For projects using plain old ``distutils``,
the command needs to be registered explicitly in ``setup.py``::
from babel.messages.frontend import compile_catalog
setup(
...
cmdclass = {'compile_catalog': compile_catalog}
)
.. versionadded:: 0.9
z+compile message catalogs to binary MO files))�domain=�Dz>domains of PO files (space separated list, default 'messages'))z
directory=�d�.path to base directory containing the catalogs�zinput-file=�izname of the input file)�output-file=�ozQname of the output file (default '<output_dir>/<locale>/LC_MESSAGES/<domain>.mo')��locale=�lz locale of the catalog to compile)� use-fuzzy�fzalso include fuzzy translations)�
statisticsNz#print statistics about translationsrN rP c C s. d| _ d | _d | _d | _d | _d| _d| _d S �N�messagesF)�domain� directory�
input_file�output_file�locale� use_fuzzyrP �r6 r$ r$ r% r2 � s z"compile_catalog.initialize_optionsc C s8 t | j�| _| js | js td��| js4| js4td��d S )Nz<you must specify either the input file or the base directoryz=you must specify either the output file or the base directory)r, rS rU rT r rV rY r$ r$ r% �finalize_options� s
z compile_catalog.finalize_optionsc C sN d}| j D ]$}| �|��� D ]}|t|�7 }qq
|rB| j�d|� |rJdS dS )Nr z%d errors encountered.� )rS �_run_domain�values�lenr �error)r6 Zn_errorsrS �errorsr$ r$ r% �run� s
zcompile_catalog.runc
C s� g }g }| j s�| jr`|�| jtj�| j| jd|� d��f� |�tj�| j| jd|� d��� nft�| j�D ]X}tj�| j|d|� d��}tj�|�rl|�||f� |�tj�| j|d|� d��� qlnH|�| j| j f� | j r�|�| j � n"|�tj�| j| jd|� d��� |�st
d��i }t|�D �]h\}\}}|| }t|d��} t
| |�}
W d � n1 �sl0 Y | j�r�d}t|
�dd � D ]}|j�r�|d7 }�q�d}
t|
��r�|d t|
� }
| j�d |t|
�|
|� |
j�r| j�s| j�d
|� �q*t|
�� � ||
<