403Webshell
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 :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : C:/cygwin64/lib/python3.9/site-packages/babel/messages/__pycache__/frontend.cpython-39.pyc
a

�4d��@sPdZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZddlm
Z
ddlmZddlmZddlmZmZddlmZdd	lmZdd
lmZmZddlmZmZmZm Z ddl!m"Z"dd
l#m$Z$m%Z%ddl&m'Z'e�(d�Z)zNddl*m+Z,e)Z-zddl.m/Z/m0Z0m1Z1Wn e2�yHe3Z0Z1Z/Yn0WnPe2�y�ddl4m)Z-ddl5m+Z,ddl6m7Z/ddl6m8Z0ddl6m9Z1Yn0d1dd�Z:Gdd�de,�Z+Gdd�de+�Z;dd�Z<Gdd�de+�Z=d d!�Z>Gd"d#�d#e+�Z?Gd$d%�d%e+�Z@Gd&d'�d'�ZAd(d)�ZBd2d*d+�ZCd3eeDd-�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)�DistutilsSetupErrorcCs�g}t|ttf�s|g}|D]N}|dur*qt|ttf�rL|�t||d��q|�dd�t|��|�D��qtdd�|D��s�J�|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��splitcss|]}|��VqdS�N��strip)�.0�s�r$�;/usr/lib/python3.9/site-packages/babel/messages/frontend.py�	<genexpr>`�z listify_value.<locals>.<genexpr>css|]}t|t�VqdSr)�
isinstance�str)r"�valr$r$r%r&ar')r(�list�tuple�extend�
listify_valuer)r�all)�argr�outr*r$r$r%r.;s r.c@s.eZdZdZdZdZiZiZeZ	ddd�Z
dS)rNr$cCs0||_|��d|_d|_d|_d|_d|_dS)NFr)�distribution�initialize_optionsZ_dry_run�verbose�force�helpZ	finalized)�self�distr$r$r%�__init__�szCommand.__init__)N)�__name__�
__module__�__qualname__�as_args�multiple_value_options�boolean_options�option_aliases�option_choices�
distutils_logrr9r$r$r$r%resrc@sDeZdZdZdZgd�ZddgZdd�Zdd	�Zd
d�Z	dd
�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 translationsrOrQcCs.d|_d|_d|_d|_d|_d|_d|_dS�N�messagesF)�domain�	directory�
input_file�output_file�locale�	use_fuzzyrQ�r7r$r$r%r3�sz"compile_catalog.initialize_optionscCs8t|j�|_|js |js td��|js4|js4td��dS)Nz<you must specify either the input file or the base directoryz=you must specify either the output file or the base directory)r.rTrVrUrrWrZr$r$r%�finalize_options�s
z compile_catalog.finalize_optionscCsNd}|jD]$}|�|���D]}|t|�7}qq
|rB|j�d|�|rJdSdS)Nrz%d errors encountered.�)rT�_run_domain�values�lenr�error)r7Zn_errorsrT�errorsr$r$r%�run�s
zcompile_catalog.runc
Cs�g}g}|js�|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|jf�|j	r�|�|j	�n"|�tj�|j|jd|�d���|�st
d��i}t|�D�]h\}\}}||}t|d��}	t
|	|�}
Wd�n1�sl0Y|j�r�d}t|
�dd�D]}|j�r�|d7}�q�d}
t|
��r�|dt|
�}
|j�d	|t|
�|
|�|
j�r|j�s|j�d
|��q*t|
���||
<}|D]*\}}|D]}|j�d||j|��q&�q|j�d||�t|d
�� }t||
|jd�Wd�n1�s�0Y�q*|S)N�LC_MESSAGES�.poz.mo�no message catalogs found�rbrr\�dz)%d of %d messages (%d%%) translated in %sz'catalog %s is marked as fuzzy, skippingzerror: %s:%d: %szcompiling catalog %s to %s�wb)rY)rVrX�append�os�path�joinrU�listdir�existsrWr�	enumerate�openrrQr+�stringr_r�info�fuzzyrY�checkr`�linenor)r7rT�po_filesZmo_filesrX�po_fileZcatalogs_and_errors�idxZmo_file�infile�catalogZ
translated�messageZ
percentageZcatalog_errorsrar`�outfiler$r$r%r]�s~���
��
�*
�
�4zcompile_catalog._run_domainN)r:r;r<�__doc__�description�user_optionsr?r3r[rbr]r$r$r$r%rC�s		rCcs�fdd�}|S)zO
    Build a directory_filter function based on a list of ignore patterns.
    cs$tj�|��t�fdd��D��S)Nc3s|]}t��|�VqdSr)�fnmatch)r"Zignore_pattern��basenamer$r%r&s�zG_make_directory_filter.<locals>.cli_directory_filter.<locals>.<genexpr>)rjrkr��any)�dirname��ignore_patternsr�r%�cli_directory_filters�z4_make_directory_filter.<locals>.cli_directory_filterr$)r�r�r$r�r%�_make_directory_filtersr�c@speZdZdZdZgd�Zgd�ZdZdZddd	d
d�Z	dd
iZ
dd�Zdd�Ze
d�dd�Zdd�Zdd�ZdS)�extract_messagesa�Message extraction 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 extract_messages

        setup(
            ...
            cmdclass = {'extract_messages': extract_messages}
        )
    z1extract localizable strings from the project code))zcharset=Nz3charset to use in the output file (default "utf-8"))z	keywords=�kzispace-separated list of keywords to look for in addition to the defaults (may be repeated multiple times))�no-default-keywordsNz#do not include the default keywords)z
mapping-file=�Fz&path to the mapping configuration file)�no-locationNz>do not include location comments with filename and line number)z
add-location=Nz�location lines format. If it is not given or "full", it generates the lines with both file name and line number. If it is "file", the line number part is omitted. If it is "never", it completely suppresses the lines (same as --no-location).)�omit-headerNz'do not include msgid "" entry in header)rJrKzname of the output file�zwidth=�wz"set output line width (default 76)��no-wrapNzVdo not break long message lines, longer than the output line width, into several lines)�sort-outputNz&generate sorted output (default False))�sort-by-fileNz,sort output by file location (default False))zmsgid-bugs-address=Nzset report address for msgid)zcopyright-holder=Nzset copyright holder in output)zproject=Nzset project name in output)zversion=Nzset project version in output)z
add-comments=�czuplace comment block with TAG (or those preceding keyword lines) in output file. Separate multiple TAGs with commas(,))�strip-commentsr#z)strip the comment TAGs from the comments.)zinput-paths=Nzofiles or directories that should be scanned for messages. Separate multiple files or directories with commas(,))zinput-dirs=Nz@alias for input-paths (does allow files as well as directories).)zignore-dirs=NzwPatterns for directories to ignore when scanning for messages. Separate multiple patterns with spaces (default ".* ._"))zheader-comment=Nzheader comment for the catalog)r�r�r�r�r�r�r�zinput-paths)zadd-comments�keywordszignore-dirs)z	--keyword)z	--mapping)z--output)z--strip-comment-tags)r�zmapping-filezoutput-filer�zadd-location)Zfull�file�nevercCs�d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_	d|_
d|_d|_d|_
d|_d|_d|_d|_d|_d|_d|_d|_d|_dS)Nzutf-8FT)�charsetr��no_default_keywords�mapping_file�no_location�add_location�omit_headerrW�
input_dirs�input_paths�width�no_wrap�sort_output�sort_by_file�msgid_bugs_address�copyright_holder�project�version�add_comments�strip_comments�include_lineno�ignore_dirs�header_commentrZr$r$r%r3}s.z#extract_messages.initialize_optionscCs�|jr|js|j|_ntd��|jr(int��}|�tt|j	���||_	|j	sXtd��|j
sftd��|jrz|jrztd��|js�|js�d|_n|jdur�t
|j�|_|jr�|jr�td��|jr�t|jt�r�t�d|j�|_n6|jdu�rt�dd	�|jjp�d
D����|_ng|_|j�s"td��|jD]$}tj�|��s(td|�d
����q(t|j�pZd
d�|_|j�r�|j�s~|j��|_|j�s�|j� �|_|j!dk�r�d|_"n|j!dk�r�d|_#t|j$�}|�r�t%|j$�|_&nd|_&dS)Nz1input-dirs and input-paths are mutually exclusivez=you must specify new keywords if you disable the default oneszno output file specified�0'--no-wrap' and '--width' are mutually exclusive�Lz;'--sort-output' and '--sort-by-file' are mutually exclusivez,\s*cSsg|]}|�dd�d�qS)�.r\rr)r"r�r$r$r%�
<listcomp>�s�z5extract_messages.finalize_options.<locals>.<listcomp>r$z'no input files or directories specifiedzInput path: z does not exist�,r�Tr�F)'r�r�rr�r�copy�update�parse_keywordsr.r�rWr�r��intr�r�r(r)�rerr2�dict�fromkeysZpackages�keysrjrkrnr�r�Zget_namer�Zget_versionr�r�r�r�r��directory_filter)r7r�rkr�r$r$r%r[�sl
���
�

�

z!extract_messages.finalize_options)rkcstttd���fdd�}|S)N)�filename�method�optionscst|dkrdStj���r�}ntj�tj��|��}d}|r`d�dd�|��D��}d|�d�}�j�d||�dS)	N�ignore�z, css"|]\}}|�d|�d�VqdS)z="�"Nr$)r"r��vr$r$r%r&�r'zEextract_messages._build_callback.<locals>.callback.<locals>.<genexpr>z (�)zextracting messages from %s%s)rjrk�isfile�normpathrl�itemsrrr)r�r�r��filepathZoptstrZ
opt_values�rkr7r$r%�callback�sz2extract_messages._build_callback.<locals>.callback)r)r�)r7rkr�r$r�r%�_build_callback�sz extract_messages._build_callbackcCsV|��}t|jd���*}t|j|j|j|j|j|j	p6t
d�}|D]�\}}}|�|�}tj
�|�r�t��}t|||||j|j|j|�}	n t||||j|j||j|jd�}	|	D]P\}
}}}
}tj
�|�r�|
}ntj
�tj
�||
��}|j|d||fg|
|d�q�q@|j�d|j�t|||j|j|j|j|j |j!d�Wd�n1�sH0YdS)Nrh)r�r�r�r�r�r�)r�Zcomment_tagsr�Zstrip_comment_tagsr�)Z
auto_comments�contextzwriting PO template file to %s)r�r�r�r�r�r�)"�
_get_mappingsrprWrr�r�r�r�r�r�r
r�rjrkr��getcwdrr�r�r�rr�r�rl�addrrrrr�r�r�r�r�r�)r7�mappingsr|rzrk�
method_map�options_mapr�Zcurrent_dirZ	extractedr�rur{Zcommentsr�r�r$r$r%rb�sR�

���

�zextract_messages.runcCsg}|jr^t|j��}t|�\}}Wd�n1s60Y|jD]}|�|||f�qFn�t|jdd�r�|jj}|��D]h\}}t	|t
�r�tt|��\}}n4gi}}|D]$\}}	}
|�||	f�|
p�i||<q�|�|||f�q|n|jD]}|�|tif�q�|S)N�message_extractors)
r�rp�
parse_mappingr�ri�getattrr2r�r�r(r)rr
)r7r��fileobjr�r�rkr��mapping�patternr�r�r$r$r%r�!s&*



zextract_messages._get_mappingsN)r:r;r<r}r~rr?r=r>r@rAr3r[r)r�rbr�r$r$r$r%r�#s$6��I-r�cCs"|dksJ�t|t�std��dS)agValidate the ``message_extractors`` keyword argument to ``setup()``.

    :param dist: the distutils/setuptools ``Distribution`` object
    :param name: the name of the keyword argument (should always be
                 "message_extractors")
    :param value: the value of the keyword argument
    :raise `DistutilsSetupError`: if the value is not valid
    r�zDthe value of the "message_extractors" parameter must be a dictionaryN)r(r�r)r8�name�valuer$r$r%�check_message_extractors=s
	
�r�c@s:eZdZdZdZgd�ZdgZdd�Zdd�Zd	d
�Z	dS)�init_cataloga�New catalog initialization 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 init_catalog

        setup(
            ...
            cmdclass = {'init_catalog': init_catalog}
        )
    z(create a new catalog based on a POT file)�rDrEz&domain of PO file (default 'messages')rH)�output-dir=rFzpath to output directory�rJrKzQname of the output file (default '<output_dir>/<locale>/LC_MESSAGES/<domain>.po'))rMrNz$locale for the new localized catalogr�r�r�cCs.d|_d|_d|_d|_d|_d|_d|_dSrR)�
output_dirrWrVrXrTr�r�rZr$r$r%r3rszinit_catalog.initialize_optionsc
Cs|jstd��|jstd��zt�|j�|_Wn.ty\}zt|�|�WYd}~n
d}~00|jsr|jsrtd��|js�t	j
�|j|jd|j�d��|_t	j
�
t	j
�|j��s�t	�t	j
�|j��|jr�|jr�td��|js�|js�d|_n|jdu�rt|j�|_dS)N�you must specify the input filez-you must provide a locale for the new catalogz%you must specify the output directoryrcrdr�r�)rVrrXr�parse�_localer	rWr�rjrkrlrTrnr��makedirsr�r�r��r7�er$r$r%r[{s, �zinit_catalog.finalize_optionscCs�|j�d|j|j�t|jd��}t||jd�}Wd�n1sD0Y|j|_tj�	t
�|_d|_t|jd�� }t
|||jd�Wd�n1s�0YdS)N�creating catalog %s based on %srf�rXFrh)r�)rrrrWrVrprrXr��datetime�nowr�
revision_datersrr�)r7ryrzr|r$r$r%rb�s
�,zinit_catalog.runN�
r:r;r<r}r~rr?r3r[rbr$r$r$r%r�Ns	r�c@s<eZdZdZdZgd�Zgd�Zdd�Zdd�Zd	d
�Z	dS)�update_cataloga�Catalog merging 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 update_catalog

        setup(
            ...
            cmdclass = {'update_catalog': update_catalog}
        )

    .. versionadded:: 0.9
    z'update message catalogs from a POT file)r�rH)r�rFrGr�)r�Nz%do not include msgid  entry in headerrLr�r�)zignore-obsolete=Nz1whether to omit obsolete messages from the output)z
init-missing=Nz6if any output files are missing, initialize them first)�no-fuzzy-matching�Nzdo not use fuzzy matching)�update-header-commentNzupdate target header comment)�previousNz+keep previous msgids of translated messages)zcheck=Nz�don't update the catalog, just return the status. Return code 0 means nothing would change. Return code 1 means that the catalog would be updated)r�r�zignore-obsoletezinit-missingr�r�r�rtcCsXd|_d|_d|_d|_d|_d|_d|_d|_d|_d|_	d|_
d|_d|_d|_
dSrR)rTrVr�rWr�rXr�r��ignore_obsolete�init_missing�no_fuzzy_matching�update_header_commentr�rtrZr$r$r%r3�sz!update_catalog.initialize_optionsc
Cs�|jstd��|js"|js"td��|jr6|js6td��|jr�|jsJtd��zt�|j�|_Wq�t	y�}zt|�|�WYd}~q�d}~00nd|_|j
r�|jr�td��|j
s�|js�d|_n|jdur�t|j�|_|j
r�|jr�d|_dS)Nr�z-you must specify the output file or directoryzyou must specify the localez?you must specify the locale for the init-missing option to workr�r�F)rVrrWr�rXr�rr�r�r	r�r�r�r�r�r�r$r$r%r[�s0�"
zupdate_catalog.finalize_optionsc
Csi}g}|js�|jr@|�|jtj�|j|jd|j�d��f�q�t�|j�D]:}tj�|j|d|j�d��}tj�	|�rL|�||f�qLn|�|j|jf�|s�t
d��|j}|s�tj�tj�|j
��d}t|j
d��}t|�}Wd�n1s�0Y|D�]�\}}|j�r�tj�	|��s�|j�r8d||<�q|j�d||j
�t|j
d��}t||jd�}	Wd�n1�s|0Y|j|	_tj�t�|	_d|	_t|d	��}
t|
|	�Wd�n1�s�0Y|j�d
||j
�t|d��}t|||d�}	Wd�n1�s0Y|	j||j|jd�tj�tj�|�t� �tj�|��}zLt|d	��,}t||	|j!|j"|j#|j$d
�Wd�n1�s�0YWn t%�y�t�&|��Yn0|j�r`t|d��}
t|
�}Wd�n1�s�0Yt|d��}t|�}Wd�n1�s20Y|j|_|�'|�||<t�&|��qzt�(||�Wn4t)�y�t�&|�t*�+||�t�&|�Yn0�q|j�r|�,�D].\}}|�r�|j�d|�n|j�-d|��q�t.|�/���st0d��n|j�d�dSdS)NrcrdrerrfFr�r�rhzupdating catalog %s based on %s)rXrT)r�)r�r�Zinclude_previousr�zCatalog %s is up to date.zCatalog %s is out of date.zSome catalogs are out of date.z All the catalogs are up-to-date.)1rWrXrirjrkrlr�rTrmrnr�splitextr�rVrprr�rtrrrr�r�r�rr�rsrr�r�r�r��tempfileZ
gettempprefixr�r�r�r��	Exception�removeZis_identical�rename�OSError�shutilr�r�Zwarningr/r^r)r7Zcheck_statusrvrXrwrTry�templater�rzr|ZtmpnameZtmpfileZorigfileZoriginal_catalogZnewfileZupdated_catalogZ
up_to_dater$r$r%rbs�
��
�&�.*.�
���*
((


zupdate_catalog.runNr�r$r$r$r%r��s"r�c@s`eZdZdZdZde��Zddddd�Zee	e
ed�Zd	Z
dd
d�Zdd
�Zdd�Zdd�Zd	S)�CommandLineInterfacez�Command-line interface.

    This class provides a simple command-line interface to the message
    extraction and PO file generation functionality.
    z%%prog %s [options] %sz%prog z$compile message catalogs to MO filesz:extract messages from source files and generate a POT filez+create new message catalogs from a POT filez0update existing message catalogs from a POT file)�compile�extract�initr�Nc
Csl|durtj}tj|jd|jd�|_|j��|j|j_	|jj
ddddd�|jj
d	d
ddtjd
d�|jj
ddddtj
dd�|jjdtjd�|j�|dd��\}}|�|j�|j�rt��}tdd�|D��d}t|�D]*}t�|�}t|d|���d|j���q�dS|�s(|j�d�|d}||jv�rP|j�d|�d��|�||dd��}	|	��S)z{Main entry point of the command-line interface.

        :param argv: list of arguments passed on the command-line
        N)�commandz[args])�usager�z--list-locales�list_locales�
store_truez print all known locales and exit)�dest�actionr6z-vz	--verbose�store_const�loglevelzprint as much as possible)rr�constr6z-qz--quietzprint as little as possibleF)rr	r\css|]}t|�VqdSr�r_)r"�
identifierr$r$r%r&�r'z+CommandLineInterface.run.<locals>.<genexpr>�<� rzQno valid command or option passed. Try the -h/--help option for more information.zunknown command "r�) �sys�argv�optparse�OptionParserrr��parserZdisable_interspersed_args�_help�
print_help�
add_option�logging�DEBUGZERROR�set_defaults�INFO�
parse_args�_configure_loggingr	rrZlocale_identifiers�max�sortedrr��printZenglish_namer`�commands�_configure_commandrb)
r7rr��argsZidentifiersZid_widthrrX�cmdname�cmdinstr$r$r%rb�sH�


���
zCommandLineInterface.runcCs^t|_|j�|�|jjr(|jjd}nt��}|j�|�|�|�t�d�}|�|�dS)Nrz%(message)s)rZsetLevel�handlersrZ
StreamHandlerZ
addHandlerZ	FormatterZsetFormatter)r7r	Zhandler�	formatterr$r$r%r�s

z'CommandLineInterface._configure_loggingcCslt|j���td�tdtdd�|jD��d�}t|j���D]$\}}td|d|���d|���qBdS)	Nz	commands:�css|]}t|�VqdSrr)r"rr$r$r%r&�r'z-CommandLineInterface._help.<locals>.<genexpr>r\z  r
r)rr�format_helprr rr�)r7Z	cmd_widthr�r~r$r$r%r�s
zCommandLineInterface._helpc
Cs�|j|}|�}|jr|j|_t|t�s,J�|��tj|j|df|j|d�}t	|dd�}|j
D]�\}}}	|�d�}
t	||
�dd��}d|
��g}|r�|�
d|���|�|j�|
d��|j�|
d	�}
|
|kr�|jd
|
�d�7_qd|
|jv�r|j|d|	d
��qd|
|jv�r.|j|d|	|
d��qd|j||	||
d��qd|�|�\}}|�rlt||�dd�|�t|���D]\}}t|||��qxz|��Wn4t�y�}z|�t|��WYd	}~n
d	}~00|S)zB
        :type cmdname: str
        :type argv: list[str]
        r�)rr~r=r$�=�-�_z--Nr
�>r)rr6ri)rr6�choices)r6�defaultr-)�command_classesrr(rr3rrrr r�rr!�replacerir-r@�getrAr?rr>r�setattr�varsr�Zensure_finalizedrr`r))r7r#rZcmdclassr$rr=ZlongZshortr6r�r.Zstrsr-r�r"�keyr��errr$r$r%r!�sH
�
$z'CommandLineInterface._configure_command)N)r:r;r<r}r�VERSIONr�r rCr�r�r�r/rrbrrr!r$r$r$r%r�{s$
��
.r�cCst��tj�Sr)r�rbrrr$r$r$r%�main	sr7c
Cs�i}g}i}t�}t|j�|_|�||�|��D]V}|dkrNt|�|��}q2dd�|�dd�D�\}}|�||f�t|�|��||<q2|r�t	|�D](\}	\}}||vr�||}||f||	<q�||fS)aParse an extraction method mapping from a file-like object.

    >>> buf = StringIO('''
    ... [extractors]
    ... custom = mypackage.module:myfunc
    ...
    ... # Python source files
    ... [python: **.py]
    ...
    ... # Genshi templates
    ... [genshi: **/templates/**.html]
    ... include_attrs =
    ... [genshi: **/templates/**.txt]
    ... template_class = genshi.template:TextTemplate
    ... encoding = latin-1
    ...
    ... # Some custom extractor
    ... [custom: **/custom/*.*]
    ... ''')

    >>> method_map, options_map = parse_mapping(buf)
    >>> len(method_map)
    4

    >>> method_map[0]
    ('**.py', 'python')
    >>> options_map['**.py']
    {}
    >>> method_map[1]
    ('**/templates/**.html', 'genshi')
    >>> options_map['**/templates/**.html']['include_attrs']
    ''
    >>> method_map[2]
    ('**/templates/**.txt', 'genshi')
    >>> options_map['**/templates/**.txt']['template_class']
    'genshi.template:TextTemplate'
    >>> options_map['**/templates/**.txt']['encoding']
    'latin-1'

    >>> method_map[3]
    ('**/custom/*.*', 'mypackage.module:myfunc')
    >>> options_map['**/custom/*.*']
    {}

    :param fileobj: a readable file-like object containing the configuration
                    text to parse
    :see: `extract_from_directory`
    �
extractorscss|]}|��VqdSrr )r"�partr$r$r%r&Jr'z parse_mapping.<locals>.<genexpr>�:r\)
rrZ	_sectionsZ	read_fileZsectionsr�r�rriro)
r�r�r8r�r�r�sectionr�r�rxr$r$r%r�
s$1r�r$)�stringscCs�i}|D]�}d|vr$|�d�\}}n
|d}}||vr|r�g}|�d�D]:}|ddkrt|�t|dd��df�qH|�t|��qHt|�}|||<q|S)aQParse keywords specifications from the given list of strings.

    >>> kw = sorted(parse_keywords(['_', 'dgettext:2', 'dngettext:2,3', 'pgettext:1c,2']).items())
    >>> for keyword, indices in kw:
    ...     print((keyword, indices))
    ('_', None)
    ('dgettext', (2,))
    ('dngettext', (2, 3))
    ('pgettext', ((1, 'c'), 2))
    r:Nr����r�)rrir�r,)r<r�rq�funcname�indicesZinds�xr$r$r%r�Ws

r��__main__)N)N)r$)Gr}r�r�rrrjr�r�rr��collectionsrZconfigparserr�ior�typingrrrrrr6Z
babel.corer	Zbabel.messages.catalogr
rZbabel.messages.extractrr
rrZbabel.messages.mofilerZbabel.messages.pofilerrZ
babel.utilrZ	getLoggerrZ
setuptoolsrZ_CommandrBZsetuptools.errorsrrr�ImportErrorr��	distutilsZ
distutils.cmdZdistutils.errorsrrrr.rCr�r�r�r�r�r�r7r�r)r�r:r$r$r$r%�<module>sl


*)YU
J


Youez - 2016 - github.com/yon3zu
LinuXploit