- GRAYBYTE UNDETECTABLE CODES -

403Webshell
Server IP : 184.154.167.98  /  Your IP : 18.227.24.1
Web Server : Apache
System : Linux pink.dnsnetservice.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
User : puertode ( 1767)
PHP Version : 8.2.26
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3.6/site-packages/babel/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3.6/site-packages/babel/__pycache__/numbers.cpython-36.opt-1.pyc
3

qD�Y�e�@s�dZddlZddlmZmZddlmZddlm	Z	m
Z
mZddlm
Z
mZddlmZe	d�ZGd	d
�d
e�ZdFdd�ZdGd
d�ZdHdd�ZdIdd�Zdefdd�Zefdd�Zdd�ZdJdd�Zefdd�Zefdd �Zefd!d"�Zefd#d$�Zefd%d&�Z efd'd(�Z!defd)d*�Z"Gd+d,�d,e#�Z$dedd-fd.d/�Z%defd0d1�Z&defd2d3�Z'Gd4d5�d5e(�Z)efd6d7�Z*efd8d9�Z+d:Z,d;Z-d<e,Z.d=e-Z/d>Z0ej1d?e.e/e0f�Z2d@dA�Z3dBdC�Z4GdDdE�dEe5�Z6dS)Ka�
    babel.numbers
    ~~~~~~~~~~~~~

    Locale dependent formatting and parsing of numeric data.

    The default locale for the functions in this module is determined by the
    following environment variables, in that order:

     * ``LC_NUMERIC``,
     * ``LC_ALL``, and
     * ``LANG``

    :copyright: (c) 2013 by the Babel Team.
    :license: BSD, see LICENSE for more details.
�N)�date�datetime)�chain)�default_locale�Locale�
get_global)�decimal�string_types)�locale_identifiers�
LC_NUMERICc@seZdZdZdd�ZdS)�UnknownCurrencyErrorzRException thrown when a currency is requested for which no data is available.
    cCstj|d|�||_dS)zkCreate the exception.
        :param identifier: the identifier string of the unsupported currency
        zUnknown currency %r.N)�	Exception�__init__�
identifier)�selfr�r�/usr/lib/python3.6/numbers.pyr%szUnknownCurrencyError.__init__N)�__name__�
__module__�__qualname__�__doc__rrrrrr!srcCs&|rtj|�jj�}ntd�}t|�S)aM Return a `set` of normalized currency codes.

    .. versionadded:: 2.5.0

    :param locale: filters returned currency codes by the provided locale.
                   Expected to be a locale instance or code. If no locale is
                   provided, returns the list of all currencies from all
                   locales.
    Zall_currencies)r�parse�
currencies�keysr�set)�localerrrr�list_currencies/srcCs|t|�krt|��dS)a Check the currency code is recognized by Babel.

    Accepts a ``locale`` parameter for fined-grained validation, working as
    the one defined above in ``list_currencies()`` method.

    Raises a `UnknownCurrencyError` exception if the currency is unknown to Babel.
    N)rr)�currencyrrrr�validate_currencyAsrcCs>|st|t�rdSyt||�Wntk
r8dSXdS)zy Returns `True` only if a currency is recognized by Babel.

    This method always return a Boolean and never raise.
    FT)�
isinstancer	rr)rrrrr�is_currencyMsr cCs$t|t�r|j�}t||�s dS|S)z�Returns the normalized sting of any currency code.

    Accepts a ``locale`` parameter for fined-grained validation, working as
    the one defined above in ``list_currencies()`` method.

    Returns None if the currency is unknown to Babel.
    N)rr	�upperr )rrrrr�normalize_currency[s


r"cCsHtj|�}|dk	r:|j|�}|jd}||kr:|||S|jj||�S)a�Return the name used by the locale for the specified currency.

    >>> get_currency_name('USD', locale='en_US')
    u'US Dollar'

    .. versionadded:: 0.9.4

    :param currency: the currency code.
    :param count: the optional count.  If provided the currency name
                  will be pluralized to that number if possible.
    :param locale: the `Locale` object or locale identifier.
    NZcurrency_names_plural)rr�plural_form�_datar�get)r�countr�locr#Zplural_namesrrr�get_currency_namejs


r(cCstj|�jj||�S)z�Return the symbol used by the locale for the specified currency.

    >>> get_currency_symbol('USD', locale='en_US')
    u'$'

    :param currency: the currency code.
    :param locale: the `Locale` object or locale identifier.
    )rrZcurrency_symbolsr%)rrrrr�get_currency_symbol�s	r)cCstd�}|j||d�dS)z�Return currency's precision.

    Precision is the number of decimals found after the decimal point in the
    currency's format pattern.

    .. versionadded:: 2.5.0

    :param currency: the currency code.
    Zcurrency_fractionsZDEFAULTr)rr%)rZ
precisionsrrr�get_currency_precision�s
r*TFcs�td�}�dkrtj��nt�t�r,�j���dkr:��nt�t�rL�j��|j|j�f�}��fdd�}g}	xl|D]d\}
}}}
|r�t|�}|r�t|�}|
r�|s�|
rt|rt|||�rt|r�|	j|
|||
d��qt|	j|
�qtW|	S)asReturns the list of currencies for the given territory that are valid for
    the given date range.  In addition to that the currency database
    distinguishes between tender and non-tender currencies.  By default only
    tender currencies are returned.

    The return value is a list of all currencies roughly ordered by the time
    of when the currency became active.  The longer the currency is being in
    use the more to the left of the list it will be.

    The start date defaults to today.  If no end date is given it will be the
    same as the start date.  Otherwise a range can be defined.  For instance
    this can be used to find the currencies in use in Austria between 1995 and
    2011:

    >>> from datetime import date
    >>> get_territory_currencies('AT', date(1995, 1, 1), date(2011, 1, 1))
    ['ATS', 'EUR']

    Likewise it's also possible to find all the currencies in use on a
    single date:

    >>> get_territory_currencies('AT', date(1995, 1, 1))
    ['ATS']
    >>> get_territory_currencies('AT', date(2011, 1, 1))
    ['EUR']

    By default the return value only includes tender currencies.  This
    however can be changed:

    >>> get_territory_currencies('US')
    ['USD']
    >>> get_territory_currencies('US', tender=False, non_tender=True,
    ...                          start_date=date(2014, 1, 1))
    ['USN', 'USS']

    .. versionadded:: 2.0

    :param territory: the name of the territory to find the currency for.
    :param start_date: the start date.  If not given today is assumed.
    :param end_date: the end date.  If not given the start date is assumed.
    :param tender: controls whether tender currencies should be included.
    :param non_tender: controls whether non-tender currencies should be
                       included.
    :param include_details: if set to `True`, instead of returning currency
                            codes the return value will be dictionaries
                            with detail information.  In that case each
                            dictionary will have the keys ``'currency'``,
                            ``'from'``, ``'to'``, and ``'tender'``.
    Zterritory_currenciesNcs |dks|�ko|dkp|�kS)Nr)�start�end)�end_date�
start_daterr�
_is_active�sz,get_territory_currencies.<locals>._is_active)r�fromZto�tender)	r�date_Ztodayr�	datetime_rr%r!�append)Z	territoryr.r-r1Z
non_tenderZinclude_detailsrZcursr/�resultZ
currency_coder+r,Z	is_tenderr)r-r.r�get_territory_currencies�s64


r6cCstj|�jjdd�S)z�Return the symbol used by the locale to separate decimal fractions.

    >>> get_decimal_symbol('en_US')
    u'.'

    :param locale: the `Locale` object or locale identifier
    r�.)rr�number_symbolsr%)rrrr�get_decimal_symbol�sr9cCstj|�jjdd�S)z�Return the plus sign symbol used by the current locale.

    >>> get_plus_sign_symbol('en_US')
    u'+'

    :param locale: the `Locale` object or locale identifier
    ZplusSign�+)rrr8r%)rrrr�get_plus_sign_symbol�sr;cCstj|�jjdd�S)z�Return the plus sign symbol used by the current locale.

    >>> get_minus_sign_symbol('en_US')
    u'-'

    :param locale: the `Locale` object or locale identifier
    Z	minusSign�-)rrr8r%)rrrr�get_minus_sign_symbol
sr=cCstj|�jjdd�S)z�Return the symbol used by the locale to separate mantissa and exponent.

    >>> get_exponential_symbol('en_US')
    u'E'

    :param locale: the `Locale` object or locale identifier
    Zexponential�E)rrr8r%)rrrr�get_exponential_symbolsr?cCstj|�jjdd�S)z�Return the symbol used by the locale to separate groups of thousands.

    >>> get_group_symbol('en_US')
    u','

    :param locale: the `Locale` object or locale identifier
    �group�,)rrr8r%)rrrr�get_group_symbol srBcCst||d�S)aReturn the given number formatted for a specific locale.

    >>> format_number(1099, locale='en_US')
    u'1,099'
    >>> format_number(1099, locale='de_DE')
    u'1.099'


    :param number: the number to format
    :param locale: the `Locale` object or locale identifier
    )r)�format_decimal)�numberrrrr�
format_number+s
rEcCs.tj|�}|s|jj|�}t|�}|j||�S)a�Return the given decimal number formatted for a specific locale.

    >>> format_decimal(1.2345, locale='en_US')
    u'1.234'
    >>> format_decimal(1.2346, locale='en_US')
    u'1.235'
    >>> format_decimal(-1.2346, locale='en_US')
    u'-1.235'
    >>> format_decimal(1.2345, locale='sv_SE')
    u'1,234'
    >>> format_decimal(1.2345, locale='de')
    u'1,234'

    The appropriate thousands grouping and the decimal separator are used for
    each locale:

    >>> format_decimal(12345.5, locale='en_US')
    u'12,345.5'

    :param number: the number to format
    :param format:
    :param locale: the `Locale` object or locale identifier
    )rrZdecimal_formatsr%�
parse_pattern�apply)rD�formatr�patternrrrrC;s

rCc@seZdZdZdS)�UnknownCurrencyFormatErrorz>Exception raised when an unknown currency format is requested.N)rrrrrrrrrJZsrJZstandardc	Csttj|�}|rt|�}n0y|j|}Wn tk
rFtd|��YnX|r^t|�}||f}nd}|j||||d�S)uReturn formatted currency value.

    >>> format_currency(1099.98, 'USD', locale='en_US')
    u'$1,099.98'
    >>> format_currency(1099.98, 'USD', locale='es_CO')
    u'US$\xa01.099,98'
    >>> format_currency(1099.98, 'EUR', locale='de_DE')
    u'1.099,98\xa0\u20ac'

    The format can also be specified explicitly.  The currency is
    placed with the '¤' sign.  As the sign gets repeated the format
    expands (¤ being the symbol, ¤¤ is the currency abbreviation and
    ¤¤¤ is the full name of the currency):

    >>> format_currency(1099.98, 'EUR', u'¤¤ #,##0.00', locale='en_US')
    u'EUR 1,099.98'
    >>> format_currency(1099.98, 'EUR', u'#,##0.00 ¤¤¤', locale='en_US')
    u'1,099.98 euros'

    Currencies usually have a specific number of decimal digits. This function
    favours that information over the given format:

    >>> format_currency(1099.98, 'JPY', locale='en_US')
    u'\xa51,100'
    >>> format_currency(1099.98, 'COP', u'#,##0.00', locale='es_ES')
    u'1.100'

    However, the number of decimal digits can be overriden from the currency
    information, by setting the last parameter to ``False``:

    >>> format_currency(1099.98, 'JPY', locale='en_US', currency_digits=False)
    u'\xa51,099.98'
    >>> format_currency(1099.98, 'COP', u'#,##0.00', locale='es_ES', currency_digits=False)
    u'1.099,98'

    If a format is not specified the type of currency format to use
    from the locale can be specified:

    >>> format_currency(1099.98, 'EUR', locale='en_US', format_type='standard')
    u'\u20ac1,099.98'

    When the given currency format type is not available, an exception is
    raised:

    >>> format_currency('1099.98', 'EUR', locale='root', format_type='unknown')
    Traceback (most recent call last):
        ...
    UnknownCurrencyFormatError: "'unknown' is not a known currency format type"

    :param number: the number to format
    :param currency: the currency code
    :param format: the format string to use
    :param locale: the `Locale` object or locale identifier
    :param currency_digits: use the currency's number of decimal digits
    :param format_type: the currency format type to use
    z&%r is not a known currency format typeN)r�
force_frac)rrrFZcurrency_formats�KeyErrorrJr*rG)	rDrrHrZcurrency_digitsZformat_typerI�	precisionZfracrrr�format_currency^s:


rNcCs.tj|�}|s|jj|�}t|�}|j||�S)u�Return formatted percent value for a specific locale.

    >>> format_percent(0.34, locale='en_US')
    u'34%'
    >>> format_percent(25.1234, locale='en_US')
    u'2,512%'
    >>> format_percent(25.1234, locale='sv_SE')
    u'2\xa0512\xa0%'

    The format pattern can also be specified explicitly:

    >>> format_percent(25.1234, u'#,##0‰', locale='en_US')
    u'25,123‰'

    :param number: the percent number to format
    :param format:
    :param locale: the `Locale` object or locale identifier
    )rrZpercent_formatsr%rFrG)rDrHrrIrrr�format_percent�s

rOcCs.tj|�}|s|jj|�}t|�}|j||�S)a�Return value formatted in scientific notation for a specific locale.

    >>> format_scientific(10000, locale='en_US')
    u'1E4'

    The format pattern can also be specified explicitly:

    >>> format_scientific(1234567, u'##0E00', locale='en_US')
    u'1.23E06'

    :param number: the number to format
    :param format:
    :param locale: the `Locale` object or locale identifier
    )rrZscientific_formatsr%rFrG)rDrHrrIrrr�format_scientific�s

rPc@seZdZdZdS)�NumberFormatErrorz>Exception raised when a string cannot be parsed into a number.N)rrrrrrrrrQ�srQcCs:yt|jt|�d��Stk
r4td|��YnXdS)aSParse localized number string into an integer.

    >>> parse_number('1,099', locale='en_US')
    1099
    >>> parse_number('1.099', locale='de_DE')
    1099

    When the given string cannot be parsed, an exception is raised:

    >>> parse_number('1.099,98', locale='de')
    Traceback (most recent call last):
        ...
    NumberFormatError: '1.099,98' is not a valid number

    :param string: the string to parse
    :param locale: the `Locale` object or locale identifier
    :return: the parsed number
    :raise `NumberFormatError`: if the string can not be converted to a number
    �z%r is not a valid numberN)�int�replacerB�
ValueErrorrQ)�stringrrrr�parse_number�srWcCsTtj|�}y"tj|jt|�d�jt|�d��Stjk
rNtd|��YnXdS)a�Parse localized decimal string into a decimal.

    >>> parse_decimal('1,099.98', locale='en_US')
    Decimal('1099.98')
    >>> parse_decimal('1.099,98', locale='de')
    Decimal('1099.98')

    When the given string cannot be parsed, an exception is raised:

    >>> parse_decimal('2,109,998', locale='de')
    Traceback (most recent call last):
        ...
    NumberFormatError: '2,109,998' is not a valid decimal number

    :param string: the string to parse
    :param locale: the `Locale` object or locale identifier
    :raise NumberFormatError: if the string can not be converted to a
                              decimal number
    rRr7z %r is not a valid decimal numberN)	rrr�DecimalrTrBr9ZInvalidOperationrQ)rVrrrr�
parse_decimal�s
rYz
[^0-9@#.,]z[0-9@#.,E+]z(?P<prefix>(?:'[^']*'|%s)*)z(?P<number>%s+)z(?P<suffix>.*)z%s%s%scCsjt|�}|jd�}|dkrdS||d}|d|d�jd�}|dkrR||fS|||d}||fS)	z�Parse primary and secondary digit grouping

    >>> parse_grouping('##')
    (1000, 1000)
    >>> parse_grouping('#,###')
    (3, 3)
    >>> parse_grouping('#,####,###')
    (3, 4)
    rA���N����)r[r[r])�len�rfind)�p�widthZg1Zg2rrr�parse_groupings

rbc	Cs@t|t�r|Sdd�}|}d|krP|jdd�\}}||�\}}}||�\}}}	n||�\}}}d|}|}	d|kr�|jdd�\}}
nd}
d|kr�d	|kr�d
|kr�td��d	|kr�|jd	d�\}}n|}d}d
d�}
|
|�}|
|�}|
�r|
||�}|
jd�}|
jd�}
|
|
�}nd}d}t|�}t|||f||	f|||||�S)zParse number format patternscSs&tj|�}|dkrtd|��|j�S)NzInvalid number pattern %r)�	number_re�searchrU�groups)rI�rvrrr�
_match_number9s
z$parse_pattern.<locals>._match_number�;rZr<r>N�@r7�0z5Significant digit patterns can not contain "@" or "0"rRcSsXd}}xF|D]>}|dkr,|d7}|d7}q|dkr>|d7}q|dkrJqqPqW||fS)z(Calculate the min and max allowed digitsrz@0rZ�#rAr)r`�min�max�crrr�parse_precisionXs


z&parse_pattern.<locals>.parse_precisionr:)r�
NumberPattern�splitrU�rsplit�
startswith�lstriprb)rIrgZpos_patternZneg_patternZ
pos_prefixrDZ
pos_suffixZ
neg_prefix�_Z
neg_suffix�expZintegerZfractionro�int_prec�	frac_prec�exp_plus�exp_prec�groupingrrrrF4sH




rFc@s@eZdZdd�Zdd�Zddd�Zdd	�Zd
d�Zddd
�ZdS)rpc		Csv||_||_||_||_||_||_||_||_ddj|j|j�krNd|_	n$ddj|j|j�krld|_	nd|_	dS)N�%rRr\u‰�r)
rI�prefix�suffixr{rwrxrzry�join�scale)	rrIr~rr{rwrxrzryrrrrzszNumberPattern.__init__cCsdt|�j|jfS)Nz<%s %r>)�typerrI)rrrr�__repr__�szNumberPattern.__repr__Nc	Cs^|p|j}t|tj�s$tjt|��}|j|j�}t|j��}|j	�r6|j
�}t|�}|jd|jdkr|||jdd8}n&|jdr�t||jd�|jd}|dkr�|d|}n|d|}d}|dkr�t
|�}n|jr�t|�}t|�}d|j||d|d�t|�||jt|�|j	d|j	d|�f}	n�d|jk�r�|jt|�|jd|jd�}
|
jd�\}}}
|j|dd|�}	|�r|	t|�|
7}	nhtjd	d
|d�}|j|�}tt|��jd�\}}}
|j||jd|jd|�|j|
�p�d||�}	d|j||	|j|f}d
|k�rZ|jdt|||��}|jd|j��}|jd
t||��}|S)NrrZ�
rRz%s%s%s%srir7i�z1.�1rjz%s%s%s�¤u¤¤¤u¤¤)rxrrrX�str�scalebr�rSZ	is_signedrz�adjusted�absrwr=ryr;�_format_significantr?�_format_intrI�	partitionr9�quantize�_format_fracr~rrTr(r!r))r�valuerrrKrxZis_negativervZexp_signrD�text�a�sep�brMZroundedZretvalrrrrG�s`





zNumberPattern.applycCs�|j�}|d|}t|j|�jtjd���}|dkrF|d|}nh|d|�}t|�}	|	t||	d�}
dj|pxddt	|dd�||	|
�||
d�j
d�d�j
d�}|S)NrZrrjz-{intpart}.{pad:0<{fill}}{fracpart}{fracextra}rR)�intpartZpadZfillZfracpartZ	fracextrar7)r�r�r�r�rrXr^rmrHrl�rstrip)rr�ZminimumZmaximumrvr�Zdigitsr5r��i�jrrrr��s 
z!NumberPattern._format_significantc	Cs~t|�}||kr d|||}|jd}d}t|�}x>t|�|krt|||d�|}|d|�}|jd}q8W||S)NrjrrRrZ)r^r{rB)	rr�rlrmrraZgsize�retZsymbolrrrr��s
zNumberPattern._format_intcCs�|p|j\}}t|�|kr.|d|t|�7}|dksJ|dkrNt|�dkrNdSx(t|�|krv|ddkrv|dd�}qPWt|�|S)NrjrrRrZr]r])rxr^rSr9)rr�rrKrlrmrrrr��szNumberPattern._format_frac)NN)N)	rrrrr�rGr�r�r�rrrrrpxs
J
rp)N)N)N)N)NNTFF)7r�rerrr2r3�	itertoolsrZ
babel.corerrrZ
babel._compatrr	Zbabel.localedatar
rr
rrrr r"r(r)r*r6r9r;r=r?rBrErCrLrJrNrOrPrUrQrWrYZ
PREFIX_ENDZNUMBER_TOKENZPREFIX_PATTERNZNUMBER_PATTERNZSUFFIX_PATTERN�compilercrbrF�objectrprrrr�<module>sV




XJ

D

Youez - 2016 - github.com/yon3zu
LinuXploit