ok

Mini Shell

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

�
��Mc@sdZddlmZmZmZddlZddlmZddlmZm	Z	m
Z
mZddlm
Z
mZmZmZmZmZddlmZmZdd	d
gZdZdefd��YZd	efd
��YZd
ejefd��YZdS(s�Several classes and functions that help with integrating and using Babel
in applications.

.. note: the code in this module is not used by Babel itself
i����(tdatetdatetimettimeN(tLocale(tformat_datetformat_datetimetformat_timetLC_TIME(t
format_numbertformat_decimaltformat_currencytformat_percenttformat_scientifict
LC_NUMERIC(tsettUTCtFormatt	LazyProxytTranslationssrestructuredtext encBszeZdZdd�Zddd�Zddd�Zddd�Zd�Zdd�Z	d�Z
dd	�Zd
�ZRS(sWrapper class providing the various date and number formatting functions
    bound to a specific locale and time-zone.
    
    >>> fmt = Format('en_US', UTC)
    >>> fmt.date(date(2007, 4, 1))
    u'Apr 1, 2007'
    >>> fmt.decimal(1.2345)
    u'1.234'
    cCstj|�|_||_dS(s�Initialize the formatter.
        
        :param locale: the locale identifier or `Locale` instance
        :param tzinfo: the time-zone info (a `tzinfo` instance or `None`)
        N(Rtparsetlocalettzinfo(tselfRR((s1/usr/lib/python2.7/site-packages/babel/support.pyt__init__,stmediumcCst||d|j�S(s�Return a date formatted according to the given pattern.
        
        >>> fmt = Format('en_US')
        >>> fmt.date(date(2007, 4, 1))
        u'Apr 1, 2007'
        
        :see: `babel.dates.format_date`
        R(RR(RRtformat((s1/usr/lib/python2.7/site-packages/babel/support.pyR5s	cCst||d|jd|j�S(sHReturn a date and time formatted according to the given pattern.
        
        >>> from pytz import timezone
        >>> fmt = Format('en_US', tzinfo=timezone('US/Eastern'))
        >>> fmt.datetime(datetime(2007, 4, 1, 15, 30))
        u'Apr 1, 2007 11:30:00 AM'
        
        :see: `babel.dates.format_datetime`
        RR(RRR(RRR((s1/usr/lib/python2.7/site-packages/babel/support.pyR@s
cCst||d|jd|j�S(s+Return a time formatted according to the given pattern.
        
        >>> from pytz import timezone
        >>> fmt = Format('en_US', tzinfo=timezone('US/Eastern'))
        >>> fmt.time(datetime(2007, 4, 1, 15, 30))
        u'11:30:00 AM'
        
        :see: `babel.dates.format_time`
        RR(RRR(RRR((s1/usr/lib/python2.7/site-packages/babel/support.pyRMs
cCst|d|j�S(s�Return an integer number formatted for the locale.
        
        >>> fmt = Format('en_US')
        >>> fmt.number(1099)
        u'1,099'
        
        :see: `babel.numbers.format_number`
        R(RR(Rtnumber((s1/usr/lib/python2.7/site-packages/babel/support.pyRYs	cCst||d|j�S(s�Return a decimal number formatted for the locale.
        
        >>> fmt = Format('en_US')
        >>> fmt.decimal(1.2345)
        u'1.234'
        
        :see: `babel.numbers.format_decimal`
        R(R	R(RRR((s1/usr/lib/python2.7/site-packages/babel/support.pytdecimalds	cCst||d|j�S(sReturn a number in the given currency formatted for the locale.
        
        :see: `babel.numbers.format_currency`
        R(R
R(RRtcurrency((s1/usr/lib/python2.7/site-packages/babel/support.pyRoscCst||d|j�S(s�Return a number formatted as percentage for the locale.
        
        >>> fmt = Format('en_US')
        >>> fmt.percent(0.34)
        u'34%'
        
        :see: `babel.numbers.format_percent`
        R(RR(RRR((s1/usr/lib/python2.7/site-packages/babel/support.pytpercentvs	cCst|d|j�S(s�Return a number formatted using scientific notation for the locale.
        
        :see: `babel.numbers.format_scientific`
        R(RR(RR((s1/usr/lib/python2.7/site-packages/babel/support.pyt
scientific�sN(
t__name__t
__module__t__doc__tNoneRRRRRRRRR(((s1/usr/lib/python2.7/site-packages/babel/support.pyR!s		
		cBs(eZdZddddgZd�Zd�Zee�Zd�Zd�Zd	�Z	d
�Z
d�Zd�Zd
�Z
d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd �Z RS(!s�Class for proxy objects that delegate to a specified function to evaluate
    the actual object.
    
    >>> def greeting(name='world'):
    ...     return 'Hello, %s!' % name
    >>> lazy_greeting = LazyProxy(greeting, name='Joe')
    >>> print lazy_greeting
    Hello, Joe!
    >>> u'  ' + lazy_greeting
    u'  Hello, Joe!'
    >>> u'(%s)' % lazy_greeting
    u'(Hello, Joe!)'
    
    This can be used, for example, to implement lazy translation functions that
    delay the actual translation until the string is actually used. The
    rationale for such behavior is that the locale of the user may not always
    be available. In web applications, you only know the locale when processing
    a request.
    
    The proxy implementation attempts to be as complete as possible, so that
    the lazy objects should mostly work as expected, for example for sorting:
    
    >>> greetings = [
    ...     LazyProxy(greeting, 'world'),
    ...     LazyProxy(greeting, 'Joe'),
    ...     LazyProxy(greeting, 'universe'),
    ... ]
    >>> greetings.sort()
    >>> for greeting in greetings:
    ...     print greeting
    Hello, Joe!
    Hello, universe!
    Hello, world!
    t_funct_argst_kwargst_valuecOsPtj|d|�tj|d|�tj|d|�tj|dd�dS(NR#R$R%R&(tobjectt__setattr__R"(Rtfunctargstkwargs((s1/usr/lib/python2.7/site-packages/babel/support.pyR�scCsD|jdkr=|j|j|j�}tj|d|�n|jS(NR&(R&R"R#R$R%R'R((Rtvalue((s1/usr/lib/python2.7/site-packages/babel/support.pyR,�scCs
||jkS(N(R,(Rtkey((s1/usr/lib/python2.7/site-packages/babel/support.pyt__contains__�scCs
t|j�S(N(tboolR,(R((s1/usr/lib/python2.7/site-packages/babel/support.pyt__nonzero__�scCs
t|j�S(N(tdirR,(R((s1/usr/lib/python2.7/site-packages/babel/support.pyt__dir__�scCs
t|j�S(N(titerR,(R((s1/usr/lib/python2.7/site-packages/babel/support.pyt__iter__�scCs
t|j�S(N(tlenR,(R((s1/usr/lib/python2.7/site-packages/babel/support.pyt__len__�scCs
t|j�S(N(tstrR,(R((s1/usr/lib/python2.7/site-packages/babel/support.pyt__str__�scCs
t|j�S(N(tunicodeR,(R((s1/usr/lib/python2.7/site-packages/babel/support.pyt__unicode__�scCs|j|S(N(R,(Rtother((s1/usr/lib/python2.7/site-packages/babel/support.pyt__add__�scCs||jS(N(R,(RR;((s1/usr/lib/python2.7/site-packages/babel/support.pyt__radd__�scCs|j|S(N(R,(RR;((s1/usr/lib/python2.7/site-packages/babel/support.pyt__mod__�scCs||jS(N(R,(RR;((s1/usr/lib/python2.7/site-packages/babel/support.pyt__rmod__�scCs|j|S(N(R,(RR;((s1/usr/lib/python2.7/site-packages/babel/support.pyt__mul__�scCs||jS(N(R,(RR;((s1/usr/lib/python2.7/site-packages/babel/support.pyt__rmul__�scOs|j||�S(N(R,(RR*R+((s1/usr/lib/python2.7/site-packages/babel/support.pyt__call__�scCs
|j|kS(N(R,(RR;((s1/usr/lib/python2.7/site-packages/babel/support.pyt__lt__�scCs
|j|kS(N(R,(RR;((s1/usr/lib/python2.7/site-packages/babel/support.pyt__le__�scCs
|j|kS(N(R,(RR;((s1/usr/lib/python2.7/site-packages/babel/support.pyt__eq__�scCs
|j|kS(N(R,(RR;((s1/usr/lib/python2.7/site-packages/babel/support.pyt__ne__�scCs
|j|kS(N(R,(RR;((s1/usr/lib/python2.7/site-packages/babel/support.pyt__gt__�scCs
|j|kS(N(R,(RR;((s1/usr/lib/python2.7/site-packages/babel/support.pyt__ge__�scCst|j|�dS(N(tdelattrR,(Rtname((s1/usr/lib/python2.7/site-packages/babel/support.pyt__delattr__�scCst|j|�S(N(tgetattrR,(RRJ((s1/usr/lib/python2.7/site-packages/babel/support.pyt__getattr__�scCst|j||�dS(N(tsetattrR,(RRJR,((s1/usr/lib/python2.7/site-packages/babel/support.pyR(�scCs|j|=dS(N(R,(RR-((s1/usr/lib/python2.7/site-packages/babel/support.pyt__delitem__scCs|j|S(N(R,(RR-((s1/usr/lib/python2.7/site-packages/babel/support.pyt__getitem__scCs||j|<dS(N(R,(RR-R,((s1/usr/lib/python2.7/site-packages/babel/support.pyt__setitem__s(!RR R!t	__slots__RR,tpropertyR.R0R2R4R6R8R:R<R=R>R?R@RARBRCRDRERFRGRHRKRMR(RORPRQ(((s1/usr/lib/python2.7/site-packages/babel/support.pyR�s>"																											cBs�eZdZdZd
ed�Zd
d
ed�Zee�Zd�Ze	d�Z
d�Zd�Zd�Z
d	�Zd
�Zd�Zd�ZRS(s&An extended translation catalog class.tmessagescCsMtjj|d|�tdt|dd�g�|_||_i|_dS(s�Initialize the translations catalog.

        :param fileobj: the file-like object the translation should be read
                        from
        tfpRJN(	tgettexttGNUTranslationsRtfilterR"RLtfilestdomaint_domains(RtfileobjRZ((s1/usr/lib/python2.7/site-packages/babel/support.pyRs!	cCs�|dk	rOt|ttf�s-|g}ng|D]}t|�^q4}n|sa|j}ntj|||�}|s�tj�S|dt	|d�d|�S(s�Load translations from the given directory.

        :param dirname: the directory containing the ``MO`` files
        :param locales: the list of locales in order of preference (items in
                        this list can be either `Locale` objects or locale
                        strings)
        :param domain: the message domain
        :return: the loaded catalog, or a ``NullTranslations`` instance if no
                 matching translations were found
        :rtype: `Translations`
        R\trbRZN(
R"t
isinstancetlistttupleR7tDEFAULT_DOMAINRVtfindtNullTranslationstopen(tclstdirnametlocalesRZRtfilename((s1/usr/lib/python2.7/site-packages/babel/support.pytloads"
cCs#dt|�j|jjd�fS(Ns
<%s: "%s">sproject-id-version(ttypeRt_infotget(R((s1/usr/lib/python2.7/site-packages/babel/support.pyt__repr__3scCs�t|d|j�}|r7||jkr7|j|�S|jj|�}|rk|dk	rk|j|�n|j|�||j|<|S(s�Add the given translations to the catalog.

        If the domain of the translations is different than that of the
        current catalog, they are added as a catalog that is only accessible
        by the various ``d*gettext`` functions.

        :param translations: the `Translations` instance with the messages to
                             add
        :param merge: whether translations for message domains that have
                      already been added should be merged with the existing
                      translations
        :return: the `Translations` instance (``self``) so that `merge` calls
                 can be easily chained
        :rtype: `Translations`
        RZN(RLRaRZtmergeR[RlR"tadd_fallback(RttranslationsRnRZtexisting((s1/usr/lib/python2.7/site-packages/babel/support.pytadd7s


cCsQt|tj�rM|jj|j�t|t�rM|jj|j�qMn|S(s�Merge the given translations into the catalog.

        Message translations in the specified catalog override any messages
        with the same identifier in the existing catalog.

        :param translations: the `Translations` instance with the messages to
                             merge
        :return: the `Translations` instance (``self``) so that `merge` calls
                 can be easily chained
        :rtype: `Translations`
        (R^RVRWt_catalogtupdateRRYtextend(RRp((s1/usr/lib/python2.7/site-packages/babel/support.pyRnTs
cCs|jj||�j|�S(sULike ``gettext()``, but look the message up in the specified
        domain.
        (R[RlRV(RRZtmessage((s1/usr/lib/python2.7/site-packages/babel/support.pytdgettextgscCs|jj||�j|�S(sWLike ``lgettext()``, but look the message up in the specified 
        domain.
        (R[Rltlgettext(RRZRv((s1/usr/lib/python2.7/site-packages/babel/support.pyt	ldgettextmscCs|jj||�j|�S(sVLike ``ugettext()``, but look the message up in the specified
        domain.
        (R[Rltugettext(RRZRv((s1/usr/lib/python2.7/site-packages/babel/support.pyt	dugettextsscCs"|jj||�j|||�S(sVLike ``ngettext()``, but look the message up in the specified
        domain.
        (R[Rltngettext(RRZtsingulartpluraltnum((s1/usr/lib/python2.7/site-packages/babel/support.pyt	dngettextyscCs"|jj||�j|||�S(sWLike ``lngettext()``, but look the message up in the specified
        domain.
        (R[Rlt	lngettext(RRZR}R~R((s1/usr/lib/python2.7/site-packages/babel/support.pyt
ldngettextscCs"|jj||�j|||�S(sVLike ``ungettext()`` but look the message up in the specified
        domain.
        (R[Rlt	ungettext(RRZR}R~R((s1/usr/lib/python2.7/site-packages/babel/support.pyt
dungettext�sN(RR R!RaR"RRitclassmethodRmtTrueRrRnRwRyR{R�R�R�(((s1/usr/lib/python2.7/site-packages/babel/support.pyRs							(R!RRRRVt
babel.coreRtbabel.datesRRRRt
babel.numbersRR	R
RRR
t
babel.utilRRt__all__t
__docformat__R'RRRWR(((s1/usr/lib/python2.7/site-packages/babel/support.pyt<module>s".h�

Zerion Mini Shell 1.0