/usr/lib/python3/dist-packages/babel/__pycache__
Edit: /usr/lib/python3/dist-packages/babel/__pycache__/support.cpython-310.pyc (22318B)
o
V\W @ s d Z ddlZddlZddlmZ ddlmZmZmZm Z ddl
mZmZm
Z
mZmZ ddlmZmZmZ G dd deZG d d
d
eZG dd dejeZG d
d deejZdS )a-
babel.support
~~~~~~~~~~~~~
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
:copyright: (c) 2013-2019 by the Babel Team.
:license: BSD, see LICENSE for more details.
N)Locale)format_dateformat_datetimeformat_timeformat_timedelta)
format_numberformat_decimalformat_currencyformat_percentformat_scientific)PY2 text_typetext_to_nativec @ sr e Zd ZdZdddZdddZddd Zdd
dZ
dddZdd Z dddZ
dd ZdddZdd Z
dS )FormataC Wrapper class providing the various date and number formatting functions
bound to a specific locale and time-zone.
>>> from babel.util import UTC
>>> from datetime import date
>>> fmt = Format('en_US', UTC)
>>> fmt.date(date(2007, 4, 1))
u'Apr 1, 2007'
>>> fmt.decimal(1.2345)
u'1.234'
Nc C s t || _|| _dS )zInitialize the formatter.
:param locale: the locale identifier or `Locale` instance
:param tzinfo: the time-zone info (a `tzinfo` instance or `None`)
N)r parselocaletzinfo)selfr r r //usr/lib/python3/dist-packages/babel/support.py__init__' s
zFormat.__init__mediumc C t ||| jdS )zReturn a date formatted according to the given pattern.
>>> from datetime import date
>>> fmt = Format('en_US')
>>> fmt.date(date(2007, 4, 1))
u'Apr 1, 2007'
r )r r )r dateformatr r r r 0 s zFormat.datec C t ||| j| jdS )a6 Return a date and time formatted according to the given pattern.
>>> from datetime import datetime
>>> 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'
r r )r r r )r datetimer r r r r : s
zFormat.datetimec C r )a Return a time formatted according to the given pattern.
>>> from datetime import datetime
>>> 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'
r )r r r )r timer r r r r F s zFormat.timesecond333333?Fc C s t |||||| jdS )zReturn a time delta according to the rules of the given locale.
>>> from datetime import timedelta
>>> fmt = Format('en_US')
>>> fmt.timedelta(timedelta(weeks=11))
u'3 months'
)granularity thresholdr
add_directionr )r r )r deltar" r# r r$ r r r timedeltaQ s
zFormat.timedeltac C t || jdS )zReturn an integer number formatted for the locale.
>>> fmt = Format('en_US')
>>> fmt.number(1099)
u'1,099'
r )r r r numberr r r r) _ s z
Format.numberc C r )zReturn a decimal number formatted for the locale.
>>> fmt = Format('en_US')
>>> fmt.decimal(1.2345)
u'1.234'
r )r r r r) r r r r decimalh zFormat.decimalc C r )zHReturn a number in the given currency formatted for the locale.
r )r r )r r) currencyr r r r- q s zFormat.currencyc C r )zReturn a number formatted as percentage for the locale.
>>> fmt = Format('en_US')
>>> fmt.percent(0.34)
u'34%'
r )r
r r* r r r percentv r, zFormat.percentc C r' )zLReturn a number formatted using scientific notation for the locale.
r )r r r( r r r
scientific s zFormat.scientificN)Nr )r r! r F)__name__
__module____qualname____doc__r r r r r&