| 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/__pycache__/ |
Upload File : |
a
�4df � @ s� d Z ddlmZ ddlZddlZddlZddlZddlmZ ddl m
Z
mZmZ ddl
mZ ddlmZmZmZmZ ddlmZmZmZmZmZmZ e
r�dd lmZ dd
lmZ G dd� d�ZG d
d� d�ZG dd� dej �Z G dd� de ej!�Z"dS )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-2023 by the Babel Team.
:license: BSD, see LICENSE for more details.
� )�annotationsN)�Iterator)�
TYPE_CHECKING�Any�Callable)�Locale)�format_date�format_datetime�format_time�format_timedelta)�format_compact_currency�format_compact_decimal�format_currency�format_decimal�format_percent�format_scientific)�Literal)�_PredefinedTimeFormatc @ s e Zd ZdZd=dddd�dd�Zd>d
ddd
�dd�Zd?d
ddd�dd�Zd@dddd�dd�ZdAddddddd �d!d"�Zd#dd$�d%d&�Z dBd#d'dd(�d)d*�Z
dCd#d-d.dd/�d0d1�Zd#ddd2�d3d4�ZdDd#dd5d.dd6�d7d8�Z
dEd#d'dd(�d9d:�Zd#dd$�d;d<�ZdS )F�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'
NzLocale | strzdatetime.tzinfo | None�None)�locale�tzinfo�returnc C s t �|�| _|| _dS )z�Initialize the formatter.
:param locale: the locale identifier or `Locale` instance
:param tzinfo: the time-zone info (a `tzinfo` instance or `None`)
N)r �parser r )�selfr r � r �1/usr/lib/python3.9/site-packages/babel/support.py�__init__4 s zFormat.__init__�mediumzdatetime.date | Nonez_PredefinedTimeFormat | str�str)�date�formatr c C s t ||| jd�S )z�Return 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 r r! r r r r = s zFormat.date)�datetimer! r c C s t ||| j| jd�S )uG Return a date and time formatted according to the given pattern.
>>> from datetime import datetime
>>> from babel.dates import get_timezone
>>> fmt = Format('en_US', tzinfo=get_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 r# r! r r r r# K s
zFormat.datetimez(datetime.time | datetime.datetime | None)�timer! r c C s t ||| j| jd�S )u- Return a time formatted according to the given pattern.
>>> from datetime import datetime
>>> from babel.dates import get_timezone
>>> fmt = Format('en_US', tzinfo=get_timezone('US/Eastern'))
>>> fmt.time(datetime(2007, 4, 1, 15, 30))
u'11:30:00 AM'
r$ )r
r r )r r% r! r r r r% Z s
zFormat.time�second�333333�?�longFzdatetime.timedelta | intzCLiteral['year', 'month', 'week', 'day', 'hour', 'minute', 'second']�floatz,Literal['narrow', 'short', 'medium', 'long']�bool)�delta�granularity� thresholdr! �
add_directionr c C s t |||||| jd�S )z�Return 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'
)r, r- r! r. r )r r )r r+ r, r- r! r. r r r � timedeltai s
�zFormat.timedeltazfloat | decimal.Decimal | str)�numberr c C s t || jd�S )z�Return an integer number formatted for the locale.
>>> fmt = Format('en_US')
>>> fmt.number(1099)
u'1,099'
r"