HEX
Server: LiteSpeed
System: Linux standart9.isimtescil.net 3.10.0-962.3.2.lve1.5.26.7.el7.x86_64 #1 SMP Wed Oct 2 07:53:12 EDT 2019 x86_64
User: karalev (5310)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: //opt/alt/python37/lib/python3.7/site-packages/babel/messages/__pycache__/frontend.cpython-37.pyc
B

�`I��@sdZddlmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZddlmZddl
mZddlmZddlmZmZdd	lmZmZmZmZdd
lmZddlmZddlmZmZm Z m!Z!dd
l"m#Z#ddl$m%Z%m&Z&ddl'm(Z(ddl)m*Z+ddl,m-Z.ddl/m0Z0m1Z1yddl2m3Z3Wn"e4k
�rRddl5m3Z3YnXe�r^dndZ6d-dd�Z7Gdd�de.�Z-Gdd�de-�Z8Gdd�de-�Z9dd�Z:Gd d!�d!e-�Z;Gd"d#�d#e-�Z<Gd$d%�d%e=�Z>d&d'�Z?d.d(d)�Z@gfd*d+�ZAeBd,k�re?�dS)/z�
    babel.messages.frontend
    ~~~~~~~~~~~~~~~~~~~~~~~

    Frontends for the message extraction functionality.

    :copyright: (c) 2013-2021 by the Babel Team.
    :license: BSD, see LICENSE for more details.
�)�print_functionN)�OrderedDict)�datetime)�getpreferredencoding)�__version__)�Locale�
localedata)�StringIO�string_types�	text_type�PY2)�UnknownLocaleError)�Catalog)�DEFAULT_KEYWORDS�DEFAULT_MAPPING�check_and_call_extract_file�extract_from_dir)�write_mo)�read_po�write_po)�LOCALTZ)�log)�Command)�DistutilsOptionError�DistutilsSetupError)�RawConfigParserZrU�rcCs�g}t|ttf�s|g}xV|D]N}|dkr,qt|ttf�rN|�t||d��q|�dd�t|��|�D��qWtdd�|D��s�t�|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!�H/opt/alt/python37/lib/python3.7/site-packages/babel/messages/frontend.py�	<genexpr>Ssz listify_value.<locals>.<genexpr>css|]}t|t�VqdS)N)�
isinstancer
)r�valr!r!r"r#Ts)	r$�list�tuple�extend�
listify_valuerr�all�AssertionError)�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__vszCommand.__init__)N)�__name__�
__module__�__qualname__�as_args�multiple_value_options�boolean_options�option_aliases�option_choices�
distutils_logrr5r!r!r!r"rXsrc@sNeZdZdZdZddddddd	gZd
dgZdd
�Zdd�Zdd�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)zdomain=�Dz>domains of PO files (space separated list, default 'messages'))z
directory=�dz.path to base directory containing the catalogs)zinput-file=�izname of the input file)zoutput-file=�ozQname of the output file (default '<output_dir>/<locale>/LC_MESSAGES/<domain>.mo'))zlocale=�lz locale of the catalog to compile)z	use-fuzzy�fzalso include fuzzy translations)�
statisticsNz#print statistics about translationsz	use-fuzzyrFcCs.d|_d|_d|_d|_d|_d|_d|_dS)N�messagesF)�domain�	directory�
input_file�output_file�locale�	use_fuzzyrF)r3r!r!r"r/�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)rHrJrIrrK)r3r!r!r"�finalize_options�s
z compile_catalog.finalize_optionscCs\d}x6|jD],}x&|�|���D]\}}|t|�7}q WqW|rP|j�d|�|rXdSdS)Nrz%d errors encountered.�)rH�_run_domain�items�lenr�error)r3Zn_errorsrH�catalog�errorsr!r!r"�run�szcompile_catalog.runc
Cszg}g}|js�|jr\|�|jtj�|j|jd|d�f�|�tj�|j|jd|d��nfx�t�|j�D]T}tj�|j|d|d�}tj�|�rj|�||f�|�tj�|j|d|d��qjWnF|�|j|jf�|j	r�|�|j	�n |�tj�|j|jd|d��|�st
d��i}�xVt|�D�]H\}\}}||}t|d��}	t
|	|�}
WdQRX|j�r�d}x*t|
�dd�D]}|j�r||d7}�q|Wd}
t|
��r�|dt|
�}
|j�d	|t|
�|
|�|
j�r�|j�s�|j�d
|��q(t|
���||
<}x6|D].\}}x"|D]}|j�d||j|��qW�qW|j�d||�t|d
��}t||
|jd�WdQRX�q(W|S)N�LC_MESSAGESz.poz.mozno message catalogs found�rbrrO�dz)%d of %d messages (%d%%) translated in %sz'catalog %s is marked as fuzzy, skippingzerror: %s:%d: %szcompiling catalog %s to %s�wb)rM)rJrL�append�os�path�joinrI�listdir�existsrKr�	enumerate�openrrFr&�stringrRr�info�fuzzyrMZcheckrS�linenor)r3rH�po_filesZmo_filesrL�po_fileZcatalogs_and_errors�idxZmo_file�infilerTZ
translated�messageZ
percentageZcatalog_errorsrUrS�outfiler!r!r"rP�sn

 zcompile_catalog._run_domainN)r6r7r8�__doc__�description�user_optionsr;r/rNrVrPr!r!r!r"r?�s			r?c@s�eZdZdZdZddddddd	d
ddd
dddddddddgZdddddddgZdZdZd d!d"d#d$�Z	d%d&iZ
d'd(�Zd)d*�Zd+d,�Z
d-d.�Zd/S)0�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))zno-default-keywordsNz#do not include the default keywords)z
mapping-file=�Fz&path to the mapping configuration file)zno-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).)zomit-headerNz'do not include msgid "" entry in header)zoutput-file=rCzname of the output file)zwidth=�wz"set output line width (default 76))zno-wrapNzVdo not break long message lines, longer than the output line width, into several lines)zsort-outputNz&generate sorted output (default False))z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(,))zstrip-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).zno-default-keywordszno-locationzomit-headerzno-wrapzsort-outputzsort-by-filezstrip-commentszinput-paths)zadd-comments�keywords)z	--keyword)z	--mapping)z--output)z--strip-comment-tags)ruzmapping-filezoutput-filezstrip-commentsz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|_dS)Nzutf-8FT)�charsetru�no_default_keywords�mapping_file�no_location�add_location�omit_headerrK�
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)r3r!r!r"r/[s*z#extract_messages.initialize_optionscCs�|jr|js|j|_ntd��|jr*i}nt��}|�tt|j	���||_	|j	sZtd��|j
shtd��|jr||jr|td��|js�|js�d|_n|jdk	r�t
|j�|_|jr�|jr�td��|jr�t|jt�r�t�d|j�|_n6|jdk	�rt�dd	�|jjp�d
D����|_ng|_|j�s$td��x*|jD] }tj�|��s,td|���q,Wt|j�p\d
d
�|_|j�r�|j�s�|j��|_|j�s�|j� �|_|j!dk�r�d|_"n|j!dk�r�d|_#dS)Nz1input-dirs and input-paths are mutually exclusivez=you must specify new keywords if you disable the default oneszno output file specifiedz0'--no-wrap' and '--width' are mutually exclusive�Lz;'--sort-output' and '--sort-by-file' are mutually exclusivez,\s*cSsg|]}|�dd�d�qS)�.rOr)r)rrqr!r!r"�
<listcomp>�sz5extract_messages.finalize_options.<locals>.<listcomp>r!z'no input files or directories specifiedzInput path: %s does not exist�,rwTrvF)$r~rrryr�copy�update�parse_keywordsr)rurKr�r��intr�r�r$r
�rerr.�dict�fromkeysZpackages�keysr\r]r`r�r�Zget_namer�Zget_versionr|r{r�)r3rur]r!r!r"rNrsZ

z!extract_messages.finalize_optionscs@���}t�jd��� }t�j�j�j�j�jd�}x�|D]�\�}}��fdd�}t	j
���r�t	��}t
�|||�j�j�j|�}nt�||�j�j|�jd�}xX|D]P\}	}
}}}
t	j
���r�|	}nt	j
�t	j
��|	��}|j|d||
fg||
d�q�Wq:W�j�d�j�t||�j�j�j�j�j�jd�WdQRXdS)	NrZ)r�r�r�r�rxcsl|dkrdStj���r�}ntj�tj��|��}d}|rXdd�dd�|��D��}�j�d||�dS)N�ignore�z (%s)z, cSsg|]\}}d||f�qS)z%s="%s"r!)rrq�vr!r!r"r��sz:extract_messages.run.<locals>.callback.<locals>.<listcomp>zextracting messages from %s%s)r\r]�isfile�normpathr^rQrrd)�filename�method�options�filepathZoptstr)r]r3r!r"�callback�sz&extract_messages.run.<locals>.callback)ruZcomment_tagsr�Zstrip_comment_tags)Z
auto_comments�contextzwriting PO template file to %s)r�r{r}r�r�r�)�
_get_mappingsrbrKrr�r�r�r�rxr\r]r��getcwdrrur�r�rr�r^�addrrdrr�r{r}r�r�r�)r3�mappingsrlrT�
method_map�options_mapr�Zcurrent_dirZ	extractedr�rfrkZcommentsr�r�r!)r]r3r"rV�sD



zextract_messages.runc	Csg}|jrPt|jt��}t|�\}}WdQRXx�|jD]}|�|||f�q6Wn�t|jdd�r�|jj}x�|�	�D]l\}}t
|t�r�tt|��\}}n8gi}}x,|D]$\}}	}
|�||	f�|
p�i||<q�W|�|||f�qpWn x|jD]}|�|t
if�q�W|S)N�message_extractors)rzrb�po_file_read_mode�
parse_mappingrr[�getattrr.r�rQr$r
r	r)r3r��fileobjr�r�r]r��mapping�patternr�r�r!r!r"r��s&

zextract_messages._get_mappingsN)r6r7r8rmrnror;r9r:r<r=r/rNrVr�r!r!r!r"rp
sF

C=rpcCs"|dkst�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�r)r4�name�valuer!r!r"�check_message_extractorss	
r�c@sDeZdZdZdZddddddd	gZd
gZdd�Zd
d�Zdd�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)zdomain=r@z&domain of PO file (default 'messages'))zinput-file=rBzname of the input file)zoutput-dir=rAzpath to output directory)zoutput-file=rCzQname of the output file (default '<output_dir>/<locale>/LC_MESSAGES/<domain>.po'))zlocale=rDz$locale for the new localized catalog)zwidth=rsz"set output line width (default 76))zno-wrapNzVdo not break long message lines, longer than the output line width, into several lineszno-wrapcCs.d|_d|_d|_d|_d|_d|_d|_dS)NrGF)�
output_dirrKrJrLrHr�r�)r3r!r!r"r/Aszinit_catalog.initialize_optionsc
Cs�|jstd��|jstd��yt�|j�|_Wn*tk
rX}zt|��Wdd}~XYnX|jsn|jsntd��|js�t	j
�|j|jd|jd�|_t	j
�
t	j
�|j��s�t	�t	j
�|j��|jr�|jr�td��|js�|js�d|_n|jdk	r�t|j�|_dS)Nzyou must specify the input filez-you must provide a locale for the new catalogz%you must specify the output directoryrWz.poz0'--no-wrap' and '--width' are mutually exclusiver�)rJrrLr�parse�_localer
rKr�r\r]r^rHr`�dirname�makedirsr�r�r�)r3�er!r!r"rNJs*
zinit_catalog.finalize_optionsc	Cs�|j�d|j|j�t|jd��}t||jd�}WdQRX|j|_t�	t
�|_d|_t|jd��}t
|||jd�WdQRXdS)Nzcreating catalog %s based on %srX)rLFrZ)r�)rrdrKrJrbrrLr�rZnowrZ
revision_datererr�)r3rjrTrlr!r!r"rVfszinit_catalog.runN)
r6r7r8rmrnror;r/rNrVr!r!r!r"r�s
	r�c@sXeZdZdZdZddddddd	d
ddd
dgZddddddgZdd�Zdd�Zdd�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)zdomain=r@z&domain of PO file (default 'messages'))zinput-file=rBzname of the input file)zoutput-dir=rAz.path to base directory containing the catalogs)zoutput-file=rCzQname of the output file (default '<output_dir>/<locale>/LC_MESSAGES/<domain>.po'))zomit-headerNz%do not include msgid  entry in header)zlocale=rDz locale of the catalog to compile)zwidth=rsz"set output line width (default 76))zno-wrapNzVdo not break long message lines, longer than the output line width, into several lines)zignore-obsolete=Nz1whether to omit obsolete messages from the output)zno-fuzzy-matching�Nzdo not use fuzzy matching)zupdate-header-commentNzupdate target header comment)�previousNz+keep previous msgids of translated messageszomit-headerzno-wrapzignore-obsoletezno-fuzzy-matchingr�zupdate-header-commentcCsLd|_d|_d|_d|_d|_d|_d|_d|_d|_d|_	d|_
d|_dS)NrGF)rHrJr�rKr}rLr�r��ignore_obsolete�no_fuzzy_matching�update_header_commentr�)r3r!r!r"r/�sz!update_catalog.initialize_optionscCs�|jstd��|js"|js"td��|jr6|js6td��|jrJ|jrJtd��|js^|js^d|_n|jdk	rtt|j�|_|jr�|j	r�d|_	dS)Nzyou must specify the input filez-you must specify the output file or directoryzyou must specify the localez0'--no-wrap' and '--width' are mutually exclusiver�F)
rJrrKr�rLr�r�r�r�r�)r3r!r!r"rN�s
zupdate_catalog.finalize_optionsc
Cs
g}|js�|jr:|�|jtj�|j|jd|jd�f�q�x\t�|j�D]8}tj�|j|d|jd�}tj�	|�rH|�||f�qHWn|�|j|jf�|s�t
d��|j}|s�tj�tj�|j
��d}t|j
d��}t|�}WdQRX�x|D�]\}}|j�d||j
�t|d��}t|||d�}WdQRX|j||j|jd�tj�tj�|�t��tj�|��}	y6t|	d	��"}
t|
||j|j|j|jd
�WdQRXWnt�|	��YnXyt�|	|�Wq�tk
�rt�|�t �!|	|�t�|	�Yq�Xq�WdS)NrWz.pozno message catalogs foundrrXzupdating catalog %s based on %s)rLrH)r�rZ)r}r�Zinclude_previousr�)"rKrLr[r\r]r^r�rHr_r`r�splitext�basenamerJrbrrrdr�r�r�r��tempfileZ
gettempprefixrr}r�r�r��remove�rename�OSError�shutilr�)r3rgrLrhrHrj�templater�rTZtmpnameZtmpfiler!r!r"rV�s\


zupdate_catalog.runN)
r6r7r8rmrnror;r/rNrVr!r!r!r"r�xs&r�c@s^eZdZdZdZdeZddddd�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 %sz$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�extractZinitr�NcCs�|dkrtj}tj|jd|jd�|_|j��|j|j_	|jj
ddddd�|jj
d	d
ddtjd
d�|jj
ddddtj
dd�|jjdtjd�|j�|dd��\}}|�|j�|j�r:t��}tdd�|D��}|��d|d}xF|D]>}t�|�}|||jf}	t|	�tjj�p*t��p*dd��q�WdS|�sL|j� d�|d}
|
|j!k�rp|j� 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�actionr2z-vz	--verbose�store_const�loglevelzprint as much as possible)r�r��constr2z-qz--quietzprint as little as possibleF)r�r�rOcSsg|]}t|��qSr!)rR)r�
identifierr!r!r"r�Asz,CommandLineInterface.run.<locals>.<listcomp>z
%%-%ds %%s�ascii�replacerzQno valid command or option passed. Try the -h/--help option for more information.zunknown command "%s")$�sys�argv�optparse�OptionParserr�r��parserZdisable_interspersed_args�_helpZ
print_help�
add_option�logging�DEBUGZERRORZset_defaults�INFO�
parse_args�_configure_loggingr�r�rZlocale_identifiers�max�sortrr�Zenglish_name�print�encode�stdout�encodingrrS�commands�_configure_commandrV)r3r�r��argsZidentifiers�longest�formatr�rL�output�cmdname�cmdinstr!r!r"rV$sJ




zCommandLineInterface.runcCsdt�d�|_|j�|�|jjr.|jjd}nt��}|j�|�|�|�t�d�}|�|�dS)N�babelrz%(message)s)	r�Z	getLoggerrZsetLevelZhandlersZ
StreamHandlerZ
addHandlerZ	FormatterZsetFormatter)r3r�ZhandlerZ	formatterr!r!r"r�Ws

z'CommandLineInterface._configure_loggingcCspt|j���td�tdd�|jD��}dtd|d�}t|j���}x |D]\}}t|||f�qPWdS)Nz	commands:cSsg|]}t|��qSr!)rR)rr�r!r!r"r�isz.CommandLineInterface._help.<locals>.<listcomp>z  %%-%ds %%s�rO)r�r�Zformat_helpr�r��sortedrQ)r3r�r�r�r�rnr!r!r"r�fszCommandLineInterface._helpc
Cs�|j|}|�}|jr|j|_t|t�s,t�|��tj|j|df|j	|d�}t
|dd�}x�|jD]�\}}}	|�d�}
t
||
�
dd��}d|
g}|r�|�d	|�|�|j�|
d��|j�|
d
�}
|
|kr�|jd|
7_qf|
|jk�r|j|d|	d
��qf|
|jk�r(|j|d|	|
d��qf|j||	||
d��qfW|�|�\}}|�rht||�
dd�|�x&t|���D]\}}t|||��qvWy|��Wn2tk
�r�}z|�t|��Wd
d
}~XYnX|S)zB
        :type cmdname: str
        :type argv: list[str]
        r�)r�rnr9r!�=�-�_z--%sz-%sNz<%s>r�)r�r2r[)r�r2�choices)r2�defaultr�)�command_classesrr$rr+r/r�r�r�r�r�rorr�r[r(r<�getr=r;r�r:r��setattr�varsrQZensure_finalizedrrS�str)r3r�r�Zcmdclassr�r�r9ZlongZshortr2r�r�Zstrsr�r�r��keyr��errr!r!r"r�osF


 z'CommandLineInterface._configure_command)N)r6r7r8rmr��VERSIONr�r�r?rpr�r�r�rrVr�r�r�r!r!r!r"r�s 
3	r�cCst��tj�S)N)r�rVr�r�r!r!r!r"�main�src
Cs�i}g}i}t�}t|j�|_tr0|�||�n|�||�xb|��D]V}|dkrbt|�|��}qFdd�|�	dd�D�\}}|�
||f�t|�|��||<qFW|r�x4t|�D](\}	\}}||kr�||}||f||	<q�W||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`
    �
extractorscSsg|]}|���qSr!)r)r�partr!r!r"r��sz!parse_mapping.<locals>.<listcomp>�:rO)rrZ	_sectionsrZreadfpZ	read_fileZsectionsr�rQrr[ra)
r�r�rr�r�r�Zsectionr�r�rir!r!r"r��s(1r�cCs�i}x�|D]�}d|kr&|�d�\}}n
|d}}||kr
|r�g}xH|�d�D]:}|ddkrx|�t|dd��df�qL|�t|��qLWt|�}|||<q
W|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))
    rNr����rt)rr[r�r')Zstringsrurc�funcname�indicesZinds�xr!r!r"r��s

r��__main__)N)N)CrmZ
__future__rr�r�r\r�r�r�r��collectionsrrrLrr�rr�rrZ
babel._compatr	r
rrZ
babel.corer
Zbabel.messages.catalogrZbabel.messages.extractrrrrZbabel.messages.mofilerZbabel.messages.pofilerrZ
babel.utilrZ	distutilsrr>Z
distutils.cmdrZ_CommandZdistutils.errorsrrZConfigParserr�ImportErrorZconfigparserr�r)r?rpr�r�r��objectr�rr�r�r6r!r!r!r"�<module>
s\
*)
[
N