+
    8i,                       R t ^ RIHt ^ RIt^ RIt^ RIHt ^ RIHtHtH	t	H
t
Ht ^ RIHtHt ]P                  ! R4      P                   t]P                  ! R4      P$                  tRtRtRtR t^"tR	tR
tRtRt]],           ^ 3t]^ 3t]],           ^ 3t]^ 3t ]],           ^ 3t!]^ 3t"R]R]PF                  R]R]R^R. R]PH                  ]PJ                  ]PL                  .R^/t']PP                  ! R!/ ]'PS                  4       B t*]]P
                  ]+],]	]-]]-,          ]-3,          3,          t. ! R R]4      t/ ! R R]4      t0R R lt1R R lt2 ! R R4      t3R# )"zHTools for working with the BSON decimal128 type.

.. versionadded:: 3.4
)annotationsNDecimal)AnySequenceTupleTypeUnion)TypeDecoderTypeEncoderz<Qi   i   l          @ l          ` l          p l            precroundingEminEmaxcapitalsflagstrapsclampc                  <    ] tR t^@tRt]R R l4       tR R ltRtR# )DecimalEncoderzConverts Python :class:`decimal.Decimal` to BSON :class:`Decimal128`.

For example::
    opts = CodecOptions(type_registry=TypeRegistry([DecimalEncoder()]))
    bson.encode({"d": decimal.Decimal('1.0')}, codec_options=opts)

.. versionadded:: 4.15
c                   V ^8  d   QhRR/# )   returnzType[Decimal] )formats   "M/var/www/html/photoedit/myenv/lib/python3.14/site-packages/bson/decimal128.py__annotate__DecimalEncoder.__annotate__K   s      ]     c                	    \         # Nr   selfs   &r   python_typeDecimalEncoder.python_typeJ   s    r   c                    V ^8  d   QhRRRR/# )r   valuer   r   
Decimal128r   )r   s   "r   r   r   N   s     ! !c !j !r   c                	    \        V4      # r    r'   r"   r&   s   &&r   transform_pythonDecimalEncoder.transform_pythonN   s    %  r   r   N)	__name__
__module____qualname____firstlineno____doc__propertyr#   r+   __static_attributes__r   r   r   r   r   @   s%      ! !r   r   c                  <    ] tR t^RtRt]R R l4       tR R ltRtR# )DecimalDecoderzConverts BSON :class:`Decimal128` to Python :class:`decimal.Decimal`.

For example::
    opts = CodecOptions(type_registry=TypeRegistry([DecimalDecoder()]))
    bson.decode(data, codec_options=opts)

.. versionadded:: 4.15
c                   V ^8  d   QhRR/# )r   r   Type[Decimal128]r   )r   s   "r   r   DecimalDecoder.__annotate__]   s      + r   c                	    \         # r    r)   r!   s   &r   	bson_typeDecimalDecoder.bson_type\   s    r   c                    V ^8  d   QhRRRR/# )r   r&   r   r   decimal.Decimalr   )r   s   "r   r   r8   `   s     " "C "O "r   c                	"    VP                  4       # r    )
to_decimalr*   s   &&r   transform_bsonDecimalDecoder.transform_bson`   s    !!r   r   N)	r-   r.   r/   r0   r1   r2   r:   r@   r3   r   r   r   r5   r5   R   s%      " "r   r5   c                   V ^8  d   QhRR/# )r   r   zdecimal.Contextr   )r   s   "r   r   r   d   s     # #? #r   c                 `    \         P                  4       p . V R&   \        P                  ! R/ V B # )z}Returns an instance of :class:`decimal.Context` appropriate
for working with IEEE-754 128-bit decimal floating point values.
r   r   )_CTX_OPTIONScopydecimalContext)optss    r   create_decimal128_contextrI   d   s-     DDM??"T""r   c                    V ^8  d   QhRRRR/# )r   r&   _VALUE_OPTIONSr   Tuple[int, int]r   )r   s   "r   r   r   m   s     - -> -o -r   c           
        \         P                  ! \        4      ;_uu_ 4       pVP                  V 4      p RRR4       V P	                  4       '       d#   V P                  4       '       d   \        # \        # V P                  4       w  r#pV P                  4       '       dn   V'       d   \        R4      hV P                  4       '       d#   V P                  4       '       d   \        # \        # V P                  4       '       d   \        # \        # \!        RP#                  V Uu. uF  p\%        V4      NK  	  up4      4      pVP'                  4       p^ p^ p	\)        \+        ^@V4      4       F+  p
V^V
,          ,          '       g   K  V	^V
,          ,          p	K-  	  \)        ^@V4       F2  p
V^V
,          ,          '       g   K  V^V
^@,
          ,          ,          pK4  	  V\,        ,           pV^1,	          ^8X  d.   VR,          pV\.        ,          pWR,          ^/,          ,          pMW^1,          ,          pV'       d   V\0        ,          pW3#   + '       g   i     EL; iu upi )zgConverts a decimal.Decimal to BID (high bits, low bits).

:param value: An instance of decimal.Decimal
Nz'NaN with debug payload is not supported l    i?  )rF   localcontext_DEC128_CTXcreate_decimalis_infinite	is_signed_NINF_PINFas_tupleis_nan
ValueErroris_snan_NSNAN_PSNAN_NNAN_PNANintjoinstr
bit_lengthrangemin_EXPONENT_BIAS_EXPONENT_MASK_SIGN)r&   ctxsigndigitsexponentdigitsignificandra   highlowibiased_exponents   &           r   _decimal_to_128rq   m   s   
 
		k	*	*c""5) 
+ ))u4u4"^^-D(||~~FGG==??"__..6:F:))u4u4bggv>ves5zv>?@K'')JD
C3r:&'!q&!!16MC ( 2z"!q&!!A!b&M!D # /OrzQn$6)b002%%9Q 
+	*	* ?s   III	c                      ] tR t^tRtRt^tR R ltR R lt]	R R l4       t
]R R	 l4       tR
 R ltR R ltR R ltR R ltR R ltR R ltRtR# )r'   a  BSON Decimal128 type::

  >>> Decimal128(Decimal("0.0005"))
  Decimal128('0.0005')
  >>> Decimal128("0.0005")
  Decimal128('0.0005')
  >>> Decimal128((3474527112516337664, 5))
  Decimal128('0.0005')

:param value: An instance of :class:`decimal.Decimal`, string, or tuple of
    (high bits, low bits) from Binary Integer Decimal (BID) format.

.. note:: :class:`~Decimal128` uses an instance of :class:`decimal.Context`
  configured for IEEE-754 Decimal128 when validating parameters.
  Signals like :class:`decimal.InvalidOperation`, :class:`decimal.Inexact`,
  and :class:`decimal.Overflow` are trapped and raised as exceptions::

    >>> Decimal128(".13.1")
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      ...
    decimal.InvalidOperation: [<class 'decimal.ConversionSyntax'>]
    >>>
    >>> Decimal128("1E-6177")
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      ...
    decimal.Inexact: [<class 'decimal.Inexact'>]
    >>>
    >>> Decimal128("1E6145")
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      ...
    decimal.Overflow: [<class 'decimal.Overflow'>, <class 'decimal.Rounded'>]

  To ensure the result of a calculation can always be stored as BSON
  Decimal128 use the context returned by
  :func:`create_decimal128_context`::

    >>> import decimal
    >>> decimal128_ctx = create_decimal128_context()
    >>> with decimal.localcontext(decimal128_ctx) as ctx:
    ...     Decimal128(ctx.create_decimal(".13.3"))
    ...
    Decimal128('NaN')
    >>>
    >>> with decimal.localcontext(decimal128_ctx) as ctx:
    ...     Decimal128(ctx.create_decimal("1E-6177"))
    ...
    Decimal128('0E-6176')
    >>>
    >>> with decimal.localcontext(DECIMAL128_CTX) as ctx:
    ...     Decimal128(ctx.create_decimal("1E6145"))
    ...
    Decimal128('Infinity')

  To match the behavior of MongoDB's Decimal128 implementation
  str(Decimal(value)) may not match str(Decimal128(value)) for NaN values::

    >>> Decimal128(Decimal('NaN'))
    Decimal128('NaN')
    >>> Decimal128(Decimal('-NaN'))
    Decimal128('NaN')
    >>> Decimal128(Decimal('sNaN'))
    Decimal128('NaN')
    >>> Decimal128(Decimal('-sNaN'))
    Decimal128('NaN')

  However, :meth:`~Decimal128.to_decimal` will return the exact value::

    >>> Decimal128(Decimal('NaN')).to_decimal()
    Decimal('NaN')
    >>> Decimal128(Decimal('-NaN')).to_decimal()
    Decimal('-NaN')
    >>> Decimal128(Decimal('sNaN')).to_decimal()
    Decimal('sNaN')
    >>> Decimal128(Decimal('-sNaN')).to_decimal()
    Decimal('-sNaN')

  Two instances of :class:`Decimal128` compare equal if their Binary
  Integer Decimal encodings are equal::

    >>> Decimal128('NaN') == Decimal128('NaN')
    True
    >>> Decimal128('NaN').bid == Decimal128('NaN').bid
    True

  This differs from :class:`decimal.Decimal` comparisons for NaN::

    >>> Decimal('NaN') == Decimal('NaN')
    False
c                    V ^8  d   QhRRRR/# )r   r&   rK   r   Noner   )r   s   "r   r   Decimal128.__annotate__   s     G Gn G Gr   c                	2   \        V\        \        P                  34      '       d   \	        V4      w  V n        V n        R# \        V\        \        34      '       d-   \        V4      ^8w  d   \        R4      hVw  V n        V n        R# \        RV: R24      h)r   zYInvalid size for creation of Decimal128 from list or tuple. Must have exactly 2 elements.zCannot convert z to Decimal128N)
isinstancer`   rF   r   rq   _Decimal128__high_Decimal128__lowlisttuplelenrX   	TypeErrorr*   s   &&r   __init__Decimal128.__init__   s}    ec7??344&5e&<#DKe}--5zQ   
 ',#DKoeYnEFFr   c                   V ^8  d   QhRR/# )r   r   r=   r   )r   s   "r   r   ru     s     '@ '@O '@r   c           	        V P                   pV P                  pV\        ,          '       d   ^M^ pV\        ,          \        8X  d   \        P
                  ! VR
R34      # V\        ,          \        8X  d   \        P
                  ! VR
R34      # V\        ,          \        8X  d   \        P
                  ! VR
R34      # V\        ,          \        8X  d5   VR,          ^/,	          \        ,
          p\        P
                  ! VRV34      # VR,          ^1,	          \        ,
          p\        ^4      p^p\        ^^R4       F+  pW&,          ^V,
          ^,          ,	          WW&   V^,          pK-  	  ^p\        ^^ R4       F+  pW,          ^V,
          ^,          ,	          WW&   V^,          pK-  	  RpW,          ^0,	          V^ &   \        ;QJ d1    . R \        \        P                  VR4      4       4       F  NK  	  5M*! R \        \        P                  VR4      4       4       4      p\        P                   ! \"        4      ;_uu_ 4       p	V	P%                  W8V34      uuR	R	R	4       #   + '       g   i     R	# ; i)zNReturns an instance of :class:`decimal.Decimal` for this
:class:`Decimal128`.
NnFl          l          l          c              3  8   "   T F  p\        V4      x  K  	  R # 5ir    )r^   ).0rk   s   & r   	<genexpr>(Decimal128.to_decimal.<locals>.<genexpr>1  s     O/Nes5zz/Ns   bigNr   )    )rx   ry   rf   _SNANrF   r   _NAN_INFre   rd   	bytearrayrb   r{   r`   r^   
from_bytesrO   rP   rQ   )
r"   rm   rn   rh   rj   arrmaskro   ri   rg   s
   &         r   r?   Decimal128.to_decimal  s    {{jjE\\q5LU"??D"c?33Tkd"??D"c?33Tkd"??D"c?33>!n4 22r9^KH??D$#9:: 22r9^KHm!r1b!AjrAv!m4CF19D " "q!RAkA!|4CF19D ! "+"$A Os3>>#u3M/NOOs3>>#u3M/NOO!!+..#%%tX&>? /...s   I##I4	c               $    V ^8  d   QhRRRRRR/# )r   clsr7   r&   bytesr   r'   r   )r   s   "r   r   ru   7  s'     I I& Iu I Ir   c                   \        V\        4      '       g   \        R\        V4       24      h\	        V4      ^8w  d   \        R4      hV ! \        VR,          4      ^ ,          \        VR,          4      ^ ,          34      # )zCreate an instance of :class:`Decimal128` from Binary Integer
Decimal string.

:param value: 16 byte string (128-bit IEEE 754-2008 decimal floating
    point in Binary Integer Decimal (BID) format).
z(value must be an instance of bytes, not zvalue must be exactly 16 bytes:   NN:Nr   N)rw   r   r}   typer|   rX   
_UNPACK_64)r   r&   s   &&r   from_bidDecimal128.from_bid6  sl     %''FtE{mTUUu:=>>JuRy)!,jr.CA.FGHHr   c                   V ^8  d   QhRR/# )r   r   r   r   )r   s   "r   r   ru   E  s     < <U <r   c                `    \        V P                  4      \        V P                  4      ,           # )z;The Binary Integer Decimal (BID) encoding of this instance.)_PACK_64ry   rx   r!   s   &r   bidDecimal128.bidD  s!     

#ht{{&;;;r   c                   V ^8  d   QhRR/# r   r   r`   r   )r   s   "r   r   ru   I  s       r   c                	h    V P                  4       pVP                  4       '       d   R # \        V4      # )NaN)r?   rW   r`   )r"   decs   & r   __str__Decimal128.__str__I  s%    oo::<<3xr   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   ru   P  s     ) )# )r   c                	    R V : R2# )zDecimal128('z')r   r!   s   &r   __repr__Decimal128.__repr__P  s    dXR((r   c                    V ^8  d   QhRRRR/# )r   r&   rL   r   rt   r   )r   s   "r   r   ru   S  s     ( (/ (d (r   c                	$    Vw  V n         V n        R # r    rx   ry   r*   s   &&r   __setstate__Decimal128.__setstate__S  s    "'TZr   c                   V ^8  d   QhRR/# )r   r   rL   r   )r   s   "r   r   ru   V  s     ' 'o 'r   c                	2    V P                   V P                  3# r    r   r!   s   &r   __getstate__Decimal128.__getstate__V  s    {{DJJ&&r   c                    V ^8  d   QhRRRR/# r   otherr   r   boolr   )r   s   "r   r   ru   Y  s      C D r   c                	l    \        V\        4      '       d   V P                  VP                  8H  # \        # r    )rw   r'   r   NotImplementedr"   r   s   &&r   __eq__Decimal128.__eq__Y  s(    eZ((88uyy((r   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   ru   ^  s     ! !C !D !r   c                	    W8X  * # r    r   r   s   &&r   __ne__Decimal128.__ne__^  s      r   )__high__lowN)r-   r.   r/   r0   r1   	__slots___type_markerr~   r?   classmethodr   r2   r   r   r   r   r   r   r   r3   r   r   r   r'   r'      so    [z $ILG'@R I I < <)('
! !r   r'   l            ir   )4r1   
__future__r   rF   structr   typingr   r   r   r   r	   bson.codec_optionsr
   r   Structpackr   unpackr   re   rd   _EXPONENT_MAX_EXPONENT_MIN_MAX_DIGITSr   r   r   rf   rT   rU   r\   r]   rZ   r[   ROUND_HALF_EVENInvalidOperationOverflowInexactrD   rG   rE   rP   floatr`   r^   rK   r   r5   rI   rq   r'   r   r   r   <module>r      s{   #    4 4 7==##]]4 ''
	q	q		q	q	
%-	
 K''
M
MRg&&(8(8'//JQ	 oo4 1 1 34wsE#x}c:Q4RRS![ !$"[ "$#-`B! B!r   