ok

Mini Shell

Direktori : /proc/thread-self/root/proc/self/root/lib/python2.7/site-packages/babel/
Upload File :
Current File : //proc/thread-self/root/proc/self/root/lib/python2.7/site-packages/babel/localedata.pyo

�
��Mc@sdZddlZddlZyddlZWnek
rMddlZnXddlmZdddgZdZ	iZ
ej�Zej
jej
je�d�Zd	�Zd
�Zed�Zd�Zd
efd��YZdeefd��YZdS(s�Low-level locale data access.

:note: The `Locale` class, which uses this module under the hood, provides a
       more convenient interface for accessing the locale data.
i����N(t	DictMixintexiststlisttloadsrestructuredtext ent
localedatacCs3|tkrtStjjtjjtd|��S(s�Check whether locale data is available for the given locale.
    
    :param name: the locale identifier string
    :return: `True` if the locale data exists, `False` otherwise
    :rtype: `bool`
    s%s.dat(t_cachetTruetostpathRtjoint_dirname(tname((s4/usr/lib/python2.7/site-packages/babel/localedata.pyR$scCs]ggtjt�D]}tjj|�^qD]*\}}|dkr/|dkr/|^q/S(s�Return a list of all locale identifiers for which locale data is
    available.
    
    :return: a list of locale identifiers (strings)
    :rtype: `list`
    :since: version 0.8.1
    s.dattroot(RtlistdirR
Rtsplitext(tfilenametstemt	extension((s4/usr/lib/python2.7/site-packages/babel/localedata.pyR0s8cCs%tj�z	tj|�}|s|dks5|r>i}nO|jd�}t|�dkrhd}ndj|d �}t|�j�}t	j
jtd|�}t|d�}zH|dkr�|r�t
|tj|��ntj|�}|t|<Wd|j�Xn|SWdtj�XdS(s�Load the locale data for the given locale.
    
    The locale data is a dictionary that contains much of the data defined by
    the Common Locale Data Repository (CLDR). This data is stored as a
    collection of pickle files inside the ``babel`` package.
    
    >>> d = load('en_US')
    >>> d['languages']['sv']
    u'Swedish'
    
    Note that the results are cached, and subsequent requests for the same
    locale return the same dictionary:
    
    >>> d1 = load('en_US')
    >>> d2 = load('en_US')
    >>> d1 is d2
    True
    
    :param name: the locale identifier string (or "root")
    :param merge_inherited: whether the inherited data should be merged into
                            the data of the requested locale
    :return: the locale data
    :rtype: `dict`
    :raise `IOError`: if no locale data file is found for the given locale
                      identifer, or one of the locales it inherits from
    Rt_ii����s%s.dattrbN(t_cache_locktacquireRtgettsplittlenR	RtcopyRRR
topentmergetpickletclosetrelease(Rtmerge_inheritedtdatatpartstparentRtfileobj((s4/usr/lib/python2.7/site-packages/babel/localedata.pyR=s*
		cCs�x�|j�D]�\}}|dk	r
|j|�}t|t�r�|dkrXi}nt|t�rv||f}q�t|t�r�|\}}|j�}t||�||f}q�|j�}t||�n|}|||<q
q
WdS(s�Merge the data from `dict2` into the `dict1` dictionary, making copies
    of nested dictionaries.
    
    >>> d = {1: 'foo', 3: 'baz'}
    >>> merge(d, {1: 'Foo', 2: 'Bar'})
    >>> items = d.items(); items.sort(); items
    [(1, 'Foo'), (2, 'Bar'), (3, 'baz')]
    
    :param dict1: the dictionary to merge into
    :param dict2: the dictionary containing the data that should be merged
    N(	titemstNoneRt
isinstancetdicttAliasttupleRR(tdict1tdict2tkeytval2tval1taliastothers((s4/usr/lib/python2.7/site-packages/babel/localedata.pyRus"	
R(cBs)eZdZd�Zd�Zd�ZRS(s�Representation of an alias in the locale data.
    
    An alias is a value that refers to some other part of the locale data,
    as specified by the `keys`.
    cCst|�|_dS(N(R)tkeys(tselfR1((s4/usr/lib/python2.7/site-packages/babel/localedata.pyt__init__�scCsdt|�j|jfS(Ns<%s %r>(ttypet__name__R1(R2((s4/usr/lib/python2.7/site-packages/babel/localedata.pyt__repr__�scCsv|}x|jD]}||}qWt|t�rE|j|�}n-t|t�rr|\}}|j|�}n|S(sResolve the alias based on the given data.
        
        This is done recursively, so if one alias resolves to a second alias,
        that second alias will also be resolved.
        
        :param data: the locale data
        :type data: `dict`
        (R1R&R(tresolveR)(R2R tbaseR,R/R0((s4/usr/lib/python2.7/site-packages/babel/localedata.pyR7�s	(R5t
__module__t__doc__R3R6R7(((s4/usr/lib/python2.7/site-packages/babel/localedata.pyR(�s		tLocaleDataDictcBs,eZdZdd�Zd�Zd�ZRS(sUDictionary wrapper that automatically resolves aliases to the actual
    values.
    cCs2tj||�|dkr%|}n||_dS(N(R'R3R%R8(R2R R8((s4/usr/lib/python2.7/site-packages/babel/localedata.pyR3�s	cCs�tj||�}}t|t�r:|j|j�}nt|t�r}|\}}|j|j�j�}t||�nt	|�tkr�t
|d|j�}n||k	r�|||<n|S(NR8(R't__getitem__R&R(R7R8R)RRR4R;(R2R,torigtvalR/R0((s4/usr/lib/python2.7/site-packages/babel/localedata.pyR<�s
cCsttj|�d|j�S(NR8(R;R'RR8(R2((s4/usr/lib/python2.7/site-packages/babel/localedata.pyR�sN(R5R9R:R%R3R<R(((s4/usr/lib/python2.7/site-packages/babel/localedata.pyR;�s	(R:RRt	threadingtImportErrortdummy_threadingtUserDictRt__all__t
__docformat__RtRLockRRR	tdirnamet__file__R
RRRRRtobjectR(R'R;(((s4/usr/lib/python2.7/site-packages/babel/localedata.pyt<module>s$
!		
8	!!

Zerion Mini Shell 1.0