
    ̆h|k                    V   S r SSKJr  SSKrSSKrSSKrSSKJr  SSKJ	r	J
r
JrJrJr  SSKJr  SSKJrJrJrJr  SSKJrJrJrJrJrJr  \	(       a  SSKrSS	KJr  SS
KJ r    " S S5      r! " S S5      r" " S S\RF                  5      r# " S S\#\RH                  5      r%    SS jr&g)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-2025 by the Babel Team.
:license: BSD, see LICENSE for more details.
    )annotationsN)Iterator)TYPE_CHECKINGAnyCallableIterableLiteral)Locale)format_dateformat_datetimeformat_timeformat_timedelta)format_compact_currencyformat_compact_decimalformat_currencyformat_decimalformat_percentformat_scientific)Decimal)_PredefinedTimeFormatc                  <   \ rS rSrSr SSS.       SS jjjr  S     SS jjr  S     SS jjr  S     SS	 jjr    S           SS
 jjr	SS jr
SSS jjr  S       SS jjrSS jr  S         S S jjrSSS jjrSS jrSrg)!Format'   a  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'
Nlatn)numbering_systemc               R    [         R                  " U5      U l        X l        X0l        g)ag  Initialize the formatter.

:param locale: the locale identifier or `Locale` instance
:param tzinfo: the time-zone info (a `tzinfo` instance or `None`)
:param numbering_system: The numbering system used for formatting number symbols. Defaults to "latn".
                         The special value "default" will use the default numbering system of the locale.
N)r
   parselocaletzinfor   )selfr   r   r   s       E/opt/services/DDDS/venv/lib/python3.13/site-packages/babel/support.py__init__Format.__init__4   s     ll6* 0    c                *    [        XU R                  S9$ )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    dateformats      r!   r&   Format.dateF   s     4<<r$   c                @    [        XU R                  U R                  S9$ )u  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    datetimer'   s      r!   r+   Format.datetimeT   s     xDKKXXr$   c                @    [        XU R                  U R                  S9$ )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    timer'   s      r!   r.   Format.timec   s     4DKKPPr$   c           	     .    [        XUXEU R                  S9$ )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    deltar1   r2   r'   r3   s         r!   	timedeltaFormat.timedeltar   s       *3'-'+{{4 	4r$   c                >    [        XR                  U R                  S9$ )zlReturn an integer number formatted for the locale.

>>> fmt = Format('en_US')
>>> fmt.number(1099)
u'1,099'
r   r   r   r   r   r    numbers     r!   r;   Format.number   s     f[[4K`K`aar$   c                @    [        XU R                  U R                  S9$ )znReturn a decimal number formatted for the locale.

>>> fmt = Format('en_US')
>>> fmt.decimal(1.2345)
u'1.234'
r8   r9   r    r;   r'   s      r!   decimalFormat.decimal        fT[[SWShShiir$   c                D    [        UUUU R                  U R                  S9$ )zReturn a number formatted in compact form for the locale.

>>> fmt = Format('en_US')
>>> fmt.compact_decimal(123456789)
u'123M'
>>> fmt.compact_decimal(1234567, format_type='long', fraction_digits=2)
'1.23 million'
format_typefraction_digitsr   r   )r   r   r   )r    r;   rD   rE   s       r!   compact_decimalFormat.compact_decimal   s*     &#+;;!22
 	
r$   c                @    [        XU R                  U R                  S9$ )zHReturn a number in the given currency formatted for the locale.
        r8   )r   r   r   )r    r;   currencys      r!   rI   Format.currency   s     vVZVkVkllr$   c           	     B    [        XX4U R                  U R                  S9$ )zReturn a number in the given currency formatted for the locale
using the compact number format.

>>> Format('en_US').compact_currency(1234567, "USD", format_type='short', fraction_digits=2)
'$1.23M'
rC   )r   r   r   )r    r;   rI   rD   rE   s        r!   compact_currencyFormat.compact_currency   s&     'v[.2kkDLaLac 	cr$   c                @    [        XU R                  U R                  S9$ )zpReturn a number formatted as percentage for the locale.

>>> fmt = Format('en_US')
>>> fmt.percent(0.34)
u'34%'
r8   )r   r   r   r>   s      r!   percentFormat.percent   rA   r$   c                >    [        XR                  U R                  S9$ )zLReturn a number formatted using scientific notation for the locale.
        r8   )r   r   r   r:   s     r!   
scientificFormat.scientific   s     !dNcNcddr$   )r   r   r   N)r   zLocale | strr   z_datetime.tzinfo | Noner   zLiteral['default'] | strreturnNone)Nmedium)r&   _datetime.date | Noner'   _PredefinedTimeFormat | strrU   str)r+   rX   r'   rY   rU   rZ   )r.   z*_datetime.time | _datetime.datetime | Noner'   rY   rU   rZ   )secondg333333?longF)r4   z_datetime.timedelta | intr1   zCLiteral['year', 'month', 'week', 'day', 'hour', 'minute', 'second']r2   floatr'   z,Literal['narrow', 'short', 'medium', 'long']r3   boolrU   rZ   )r;   float | Decimal | strrU   rZ   )r;   r_   r'   
str | NonerU   rZ   )shortr   )r;   r_   rD   zLiteral['short', 'long']rE   intrU   rZ   )r;   r_   rI   rZ   rU   rZ   )
r;   r_   rI   rZ   rD   zLiteral['short']rE   rb   rU   rZ   )__name__
__module____qualname____firstlineno____doc__r"   r&   r+   r.   r5   r;   r?   rF   rI   rL   rO   rR   __static_attributes__ r$   r!   r   r   '   s   
 +/1
 6<11 (1
 31 
1( '+.6=#= ,= 
	=  +/.6Y'Y ,Y 
	Y" <@.6Q8Q ,Q 
	Q$ \d?E#4(4 Y4 	4
 =4 4 
4(bj 18 	
%
 .
 	

 

,m )0 c%c c &	c
 c 
c jer$   r   c                     \ rS rSr% Sr/ SQr\(       a  S\S'   S\S'   S\S	'   S
\S'   S\S'   S\S'   SS.S1S jjr\	S2S j5       r
S3S jrS4S jrS5S jrS6S jrS7S jrS8S jrS9S jrS9S jrS9S jrS9S jrS9S jrS9S jrS:S  jrS;S! jrS;S" jrS;S# jrS;S$ jrS;S% jrS;S& jrS<S' jrS=S( jrS>S) jr S?S* jr!S@S+ jr"SAS, jr#SBS- jr$SCS. jr%S/r&g0)D	LazyProxy   a  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!
)_func_args_kwargs_value_is_cache_enabled_attribute_errorCallable[..., Any]rm   ztuple[Any, ...]rn   zdict[str, Any]ro   r^   rq   r   rp   zAttributeError | Nonerr   T)enable_cachec                  [         R                  U SU5        [         R                  U SU5        [         R                  U SU5        [         R                  U SU5        [         R                  U SS 5        [         R                  U SS 5        g )Nrm   rn   ro   rq   rp   rr   )object__setattr__)r    funcrt   argskwargss        r!   r"   LazyProxy.__init__   sp    4$/4$/4F34!4lC4404!3T:r$   c                *   U R                   cQ   U R                  " U R                  0 U R                  D6nU R                  (       d  U$ [
        R                  U SU5        U R                   $ ! [         a  n[
        R                  U SU5        e S nAff = f)Nrr   rp   )rp   rm   rn   ro   AttributeErrorrv   rw   rq   )r    valueerrors      r!   r~   LazyProxy.value  s    ;;

DJJ?$,,?
 ))tXu5{{ " ""4);UCs   &A+ +
B5BBc                    XR                   ;   $ rT   r~   r    keys     r!   __contains__LazyProxy.__contains__  s    jj  r$   c                ,    [        U R                  5      $ rT   )r^   r~   r    s    r!   __bool__LazyProxy.__bool__      DJJr$   c                ,    [        U R                  5      $ rT   )dirr~   r   s    r!   __dir__LazyProxy.__dir__      4::r$   c                ,    [        U R                  5      $ rT   )iterr~   r   s    r!   __iter__LazyProxy.__iter__  r   r$   c                ,    [        U R                  5      $ rT   )lenr~   r   s    r!   __len__LazyProxy.__len__"  r   r$   c                ,    [        U R                  5      $ rT   )rZ   r~   r   s    r!   __str__LazyProxy.__str__%  r   r$   c                     U R                   U-   $ rT   r   r    others     r!   __add__LazyProxy.__add__(      zzE!!r$   c                    XR                   -   $ rT   r   r   s     r!   __radd__LazyProxy.__radd__+      zz!!r$   c                     U R                   U-  $ rT   r   r   s     r!   __mod__LazyProxy.__mod__.  r   r$   c                    XR                   -  $ rT   r   r   s     r!   __rmod__LazyProxy.__rmod__1  r   r$   c                     U R                   U-  $ rT   r   r   s     r!   __mul__LazyProxy.__mul__4  r   r$   c                    XR                   -  $ rT   r   r   s     r!   __rmul__LazyProxy.__rmul__7  r   r$   c                &    U R                   " U0 UD6$ rT   r   )r    ry   rz   s      r!   __call__LazyProxy.__call__:  s    zz4*6**r$   c                     U R                   U:  $ rT   r   r   s     r!   __lt__LazyProxy.__lt__=  r   r$   c                     U R                   U:*  $ rT   r   r   s     r!   __le__LazyProxy.__le__@      zzU""r$   c                     U R                   U:H  $ rT   r   r   s     r!   __eq__LazyProxy.__eq__C  r   r$   c                     U R                   U:g  $ rT   r   r   s     r!   __ne__LazyProxy.__ne__F  r   r$   c                     U R                   U:  $ rT   r   r   s     r!   __gt__LazyProxy.__gt__I  r   r$   c                     U R                   U:  $ rT   r   r   s     r!   __ge__LazyProxy.__ge__L  r   r$   c                0    [        U R                  U5        g rT   )delattrr~   r    names     r!   __delattr__LazyProxy.__delattr__O  s    

D!r$   c                `    U R                   b  U R                   e[        U R                  U5      $ rT   )rr   getattrr~   r   s     r!   __getattr__LazyProxy.__getattr__R  s+      ,'''tzz4((r$   c                0    [        U R                  X5        g rT   )setattrr~   )r    r   r~   s      r!   rw   LazyProxy.__setattr__W  s    

D(r$   c                    U R                   U	 g rT   r   r   s     r!   __delitem__LazyProxy.__delitem__Z  s    JJsOr$   c                     U R                   U   $ rT   r   r   s     r!   __getitem__LazyProxy.__getitem__]  s    zz#r$   c                     X R                   U'   g rT   r   )r    r   r~   s      r!   __setitem__LazyProxy.__setitem__`  s    

3r$   c                t    [        U R                  /U R                  Q7SU R                  0U R                  D6$ )Nrt   )rk   rm   rn   rq   ro   r   s    r!   __copy__LazyProxy.__copy__c  s@    JJ
 ZZ
//
 ll	
 	
r$   c                    SSK Jn  [        U" U R                  U5      /U" U R                  U5      Q7SU" U R
                  U5      0U" U R                  U5      D6$ )Nr   )deepcopyrt   )copyr   rk   rm   rn   rq   ro   )r    memor   s      r!   __deepcopy__LazyProxy.__deepcopy__k  s_    !TZZ&
 djj$'
!$"8"8$?
 t||T*	
 	
r$   ri   N)
rx   rs   ry   r   rt   r^   rz   r   rU   rV   )rU   r   )r   rv   rU   r^   )rU   r^   )rU   z	list[str])rU   zIterator[Any])rU   rb   rU   rZ   )r   rv   rU   r   )ry   r   rz   r   rU   r   )r   rv   rU   r^   )r   rZ   rU   rV   )r   rZ   rU   r   )r   rZ   r~   r   rU   rV   )r   r   rU   rV   )r   r   rU   r   )r   r   r~   r   rU   rV   )rU   rk   )r   r   rU   rk   )'rc   rd   re   rf   rg   	__slots__r   __annotations__r"   propertyr~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rw   r   r   r   r   r   rh   ri   r$   r!   rk   rk      s    !D aI!!//RV ;  !  """"""+"###"#")
) 

r$   rk   c                  x  ^  \ rS rSr% \(       a
  S\S'   S\S'   SrSSU 4S jjjrSS jrSS	 jr	SS
 jr
\
rSS jrSS jrSS jr\rSrS S jrS!S jrS"S jrS#S jrS$S jrS"S jrS%S jrS&S jr\rS'S jrS(S jrS(S jr\rS)S jr\R@                  R>                  r!\R@                  RD                  r#Sr$U =r%$ )*NullTranslationsiu  zdict[str, str]_infozNullTranslations | None	_fallbackNc           
        > 0 U l         S U l        [        TU ]  US9  [	        [        S[        USS5      /5      5      U l        U R                  U l	        0 U l
        g)zInitialize a simple translations class which is not backed by a
real catalog. Behaves similar to gettext.NullTranslations but also
offers Babel's on *gettext methods (e.g. 'dgettext()').

:param fp: a file-like object (ignored in this class)
c                    [        U S:g  5      $ )N   )rb   )ns    r!   <lambda>+NullTranslations.__init__.<locals>.<lambda>  s    #a1f+r$   fpNr   )_catalogpluralsuperr"   listfilterr   filesDEFAULT_DOMAINdomain_domains)r    r   	__class__s     r!   r"   NullTranslations.__init__}  sV     ;=8MB&FD(A'BCD
))57r$   c                V    U R                   R                  X5      R                  U5      $ )zELike ``gettext()``, but look the message up in the specified
domain.
)r   getgettextr    r   messages      r!   dgettextNullTranslations.dgettext  s$     }}  .66w??r$   c                    SSK nUR                  S[        SS9  U R                  R	                  X5      R                  U5      $ )zFLike ``lgettext()``, but look the message up in the specified
domain.
r   Nz1ldgettext() is deprecated, use dgettext() instead   
stacklevel)warningswarnDeprecationWarningr   r  lgettext)r    r   r  r  s       r!   	ldgettextNullTranslations.ldgettext  sC     	? 	 	

 }}  .77@@r$   c                V    U R                   R                  X5      R                  U5      $ )zFLike ``ugettext()``, but look the message up in the specified
domain.
)r   r  ugettextr  s      r!   	udgettextNullTranslations.udgettext  s$     }}  .77@@r$   c                X    U R                   R                  X5      R                  X#U5      $ )zFLike ``ngettext()``, but look the message up in the specified
domain.
)r   r  ngettextr    r   singularr   nums        r!   	dngettextNullTranslations.dngettext  s&     }}  .77#NNr$   c                    SSK nUR                  S[        SS9  U R                  R	                  X5      R                  X#U5      $ )zGLike ``lngettext()``, but look the message up in the specified
domain.
r   Nz3ldngettext() is deprecated, use dngettext() insteadr
  r  )r  r  r  r   r  	lngettext)r    r   r  r   r  r  s         r!   
ldngettextNullTranslations.ldngettext  sE     	A 	 	

 }}  .883OOr$   c                X    U R                   R                  X5      R                  X#U5      $ )zFLike ``ungettext()`` but look the message up in the specified
domain.
)r   r  	ungettextr  s        r!   
udngettextNullTranslations.udngettext  s&     }}  .883OOr$   z%s%sc                4   U R                   X4-  n[        5       nU R                  R                  X45      nXTL a,  U R                  R                  X0R	                  S5      4U5      nXTLa  U$ U R
                  (       a  U R
                  R                  X5      $ U$ )a  Look up the `context` and `message` id in the catalog and return the
corresponding message string, as an 8-bit string encoded with the
catalog's charset encoding, if known.  If there is no entry in the
catalog for the `message` id and `context` , and a fallback has been
set, the look up is forwarded to the fallback's ``pgettext()``
method. Otherwise, the `message` id is returned.
r   )CONTEXT_ENCODINGrv   r   r  r   r   pgettext)r    contextr  ctxt_msg_idmissingtmsgs         r!   r(  NullTranslations.pgettext  s     ++w.@@(}}  6?==$$k;;q>%BGLDK>>>>**7<<r$   c                    SSK nUR                  S[        SS9  U R                  X5      n[	        U SS5      =(       d    [
        R                  " 5       n[        U[        5      (       a  UR                  U5      $ U$ )zEquivalent to ``pgettext()``, but the translation is returned in the
preferred system encoding, if no other encoding was explicitly set with
``bind_textdomain_codeset()``.
r   Nz1lpgettext() is deprecated, use pgettext() insteadr
  r  _output_charset)
r  r  r  r(  r   r   getpreferredencoding
isinstancerZ   encode)r    r)  r  r  r,  encodings         r!   	lpgettextNullTranslations.lpgettext  sn    
 	? 	 	

 }}W.4!2D9ZV=X=X=Z(24(=(=t{{8$G4Gr$   c                    U R                   X4-  n U R                  XPR                  U5      4   nU$ ! [         a>    U R                  (       a  U R                  R                  XX45      s $ US:X  a  Us $ Us $ f = f)a  Do a plural-forms lookup of a message id.  `singular` is used as the
message id for purposes of lookup in the catalog, while `num` is used to
determine which plural form to use.  The returned message string is an
8-bit string encoded with the catalog's charset encoding, if known.

If the message id for `context` is not found in the catalog, and a
fallback is specified, the request is forwarded to the fallback's
``npgettext()`` method.  Otherwise, when ``num`` is 1 ``singular`` is
returned, and ``plural`` is returned in all other cases.
r   )r'  r   r   KeyErrorr   	npgettext)r    r)  r  r   r  r*  r,  s          r!   r8  NullTranslations.npgettext  sy     ++w.AA		==+{{3/?!@ADK 	~~~~//6OOax	s    3 7A;,A;6A;:A;c                   SSK nUR                  S[        SS9  U R                  X4-  n U R                  X`R                  U5      4   n[        U SS5      =(       d    [        R                  " 5       nUR                  U5      $ ! [         a>    U R                  (       a  U R                  R                  XX45      s $ US:X  a  Us $ Us $ f = f)zEquivalent to ``npgettext()``, but the translation is returned in the
preferred system encoding, if no other encoding was explicitly set with
``bind_textdomain_codeset()``.
r   Nz3lnpgettext() is deprecated, use npgettext() insteadr
  r  r/  r   )r  r  r  r'  r   r   r   r   r0  r2  r7  r   
lnpgettext)	r    r)  r  r   r  r  r*  r,  r3  s	            r!   r;  NullTranslations.lnpgettext  s    
 	A 	 	

 ++w.AA
	==+{{3/?!@ADt%6=^A\A\A^H;;x(( 	~~~~00FPPax	s   AB 7C=CCCc                   U R                   X4-  n[        5       nU R                  R                  X45      nXTL a7  U R                  (       a  U R                  R                  X5      $ [        U5      $ [        U[        5      (       d   eU$ )aK  Look up the `context` and `message` id in the catalog and return the
corresponding message string, as a Unicode string.  If there is no entry
in the catalog for the `message` id and `context`, and a fallback has
been set, the look up is forwarded to the fallback's ``upgettext()``
method.  Otherwise, the `message` id is returned.
)r'  rv   r   r  r   	upgettextrZ   r1  )r    r)  r  ctxt_message_idr+  r,  s         r!   r>  NullTranslations.upgettext  su     //72DD(}}  :?~~~~//AAw<$$$$$r$   c                   U R                   X4-  n U R                  XPR                  U5      4   nU$ ! [         aO    U R                  (       a  U R                  R                  XX45      s $ US:X  a  [        U5      O
[        U5      n U$ f = f)a  Do a plural-forms lookup of a message id.  `singular` is used as the
message id for purposes of lookup in the catalog, while `num` is used to
determine which plural form to use.  The returned message string is a
Unicode string.

If the message id for `context` is not found in the catalog, and a
fallback is specified, the request is forwarded to the fallback's
``unpgettext()`` method.  Otherwise, when `num` is 1 `singular` is
returned, and `plural` is returned in all other cases.
r   )r'  r   r   r7  r   
unpgettextrZ   )r    r)  r  r   r  r?  r,  s          r!   rB  NullTranslations.unpgettext+  s     //72EE	>==/;;s3C!DED
 	  	>~~~~00FPP$'1H3x=#f+D		>s   3 7B,BBc                V    U R                   R                  X5      R                  X#5      $ )zFLike `pgettext()`, but look the message up in the specified
`domain`.
)r   r  r(  r    r   r)  r  s       r!   	dpgettextNullTranslations.dpgettext?  s$     }}  .77IIr$   c                V    U R                   R                  X5      R                  X#5      $ )zGLike `upgettext()`, but look the message up in the specified
`domain`.
)r   r  r>  rE  s       r!   
udpgettextNullTranslations.udpgettextE  s$     }}  .88JJr$   c                V    U R                   R                  X5      R                  X#5      $ )zEquivalent to ``dpgettext()``, but the translation is returned in the
preferred system encoding, if no other encoding was explicitly set with
``bind_textdomain_codeset()``.
)r   r  r4  rE  s       r!   
ldpgettextNullTranslations.ldpgettextM  s$    
 }}  .88JJr$   c                X    U R                   R                  X5      R                  X#XE5      $ )zGLike ``npgettext``, but look the message up in the specified
`domain`.
)r   r  r8  r    r   r)  r  r   r  s         r!   
dnpgettextNullTranslations.dnpgettextT  s-     }}  .889?F 	Fr$   c                X    U R                   R                  X5      R                  X#XE5      $ )zHLike ``unpgettext``, but look the message up in the specified
`domain`.
)r   r  rB  rO  s         r!   udnpgettextNullTranslations.udnpgettext[  s-     }}  .99':@G 	Gr$   c                X    U R                   R                  X5      R                  X#XE5      $ )zEquivalent to ``dnpgettext()``, but the translation is returned in
the preferred system encoding, if no other encoding was explicitly set
with ``bind_textdomain_codeset()``.
)r   r  r;  rO  s         r!   ldnpgettextNullTranslations.ldnpgettextd  s-    
 }}  .99':@G 	Gr$   )r   r   r   r   r   rT   )r   "gettext._TranslationsReader | NonerU   rV   )r   rZ   r  rZ   rU   rZ   )
r   rZ   r  rZ   r   rZ   r  rb   rU   rZ   )r)  rZ   r  rZ   rU   str | object)r)  rZ   r  rZ   rU   str | bytes | object)
r)  rZ   r  rZ   r   rZ   r  rb   rU   rZ   )
r)  rZ   r  rZ   r   rZ   r  rb   rU   str | bytes)r)  rZ   r  rZ   rU   rZ   )r   rZ   r)  rZ   r  rZ   rU   rY  )r   rZ   r)  rZ   r  rZ   rU   rZ   )r   rZ   r)  rZ   r  rZ   rU   rZ  )r   rZ   r)  rZ   r  rZ   r   rZ   r  rb   rU   rZ   )r   rZ   r)  rZ   r  rZ   r   rZ   r  rb   rU   r[  )&rc   rd   re   rf   r   r   r   r"   r  r  r  	dugettextr  r   r$  
dungettextr'  r(  r4  r8  r;  r>  rB  rF  rI  
dupgettextrL  rP  rS  dunpgettextrV  r  r   r  r  r#  rh   __classcell__r   s   @r!   r   r   u  s    **N8 8"@
AA IO
PP J "&H.0"(JK JKFG KG ''//H((11Ir$   r   c                     ^  \ rS rSrSrSrS
SU 4S jjjr\R                  R                  r	\R                  R                  r\   S       SS jj5       rSS jrSSS jjrSS jrS	rU =r$ )Translationsip  z&An extended translation catalog class.messagesc                T   > [         TU ]  US9  U=(       d    U R                  U l        g)zInitialize the translations catalog.

:param fp: the file-like object the translation should be read from
:param domain: the message domain (default: 'messages')
r   N)r   r"   r   r   )r    r   r   r   s      r!   r"   Translations.__init__u  s'     	B3 3 3r$   c                    U(       d  U R                   n[        R                  " X1[        U5      5      nU(       d
  [	        5       $ [        US5       nU " XSS9sSSS5        $ ! , (       d  f       g= f)a@  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 (default: 'messages')
rb)r   r   N)r   r  find_locales_to_namesr   open)clsdirnamelocalesr   filenamer   s         r!   loadTranslations.load  sT     ''F<<1B71KL#%%(D!R", "!!s   A!!
A/c                p    U R                   R                  S5      nS[        U 5      R                   SU S3$ )Nzproject-id-version<z: "z">)r   r  typerc   )r    versions     r!   __repr__Translations.__repr__  s5    **..!564:&&'s7)266r$   c                T   [        USU R                  5      nU(       a   X0R                  :X  a  U R                  U5      $ U R                  R                  U5      nU(       a(  [        U[        5      (       a  UR                  U5        U $ UR                  U 5        XR                  U'   U $ )a  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
r   )	r   r   r   merger   r  r1  rc  add_fallback)r    translationsry  r   existings        r!   addTranslations.add  s     x1D1DEV{{*::l++==$$V,Z,77NN<(
  %%d+$0MM&!r$   c                   [        U[        R                  5      (       a_  U R                  R	                  UR                  5        [        U[
        5      (       a%  U R                  R                  UR                  5        U $ )a  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
)r1  r  GNUTranslationsr   updaterc  r   extend)r    r{  s     r!   ry  Translations.merge  sY     lG$;$;<<MM  !6!67,55

!!,"4"45r$   )r   )NN)r   rX  r   r`   )NNN)rm  zstr | os.PathLike[str] | Nonern  ,Iterable[str | Locale] | Locale | str | Noner   r`   rU   r   r   )T)r{  rc  ry  r^   )r{  rc  )rc   rd   re   rf   rg   r   r"   r  r  r  r  r#  classmethodrp  rv  r}  ry  rh   r`  ra  s   @r!   rc  rc  p  s    0N4 4 &&..H''00I 26@D!	-.- >- 	-
 
- -,74 r$   rc  c                    U c  g[        U [        5      (       a  [        U 5      /$ [        U [        5      (       a  U /$ U  Vs/ s H  n[        U5      PM     sn$ s  snf )zNormalize a `locales` argument to a list of locale names.

:param locales: the list of locales in order of preference (items in
                this list can be either `Locale` objects or locale
                strings)
N)r1  r
   rZ   )rn  r   s     r!   rj  rj    sV     '6""G~'3y&-.gFCKg...s   A)rn  r  rU   zlist[str] | None)'rg   
__future__r   r  r   oscollections.abcr   typingr   r   r   r   r	   
babel.corer
   babel.datesr   r   r   r   babel.numbersr   r   r   r   r   r   r+   	_datetimer?   r   r   r   rk   r   r  rc  rj  ri   r$   r!   <module>r     s    #   	 $ B B  S S   1he heV`
 `
Fx2w// x2vT#W%<%< Tn/9//r$   