
    =Ki>                     F    S SK JrJr  SSSSSSSSS	S
S.
rS rSS\4S jjrg)    )DecimalInvalidOperation                  )
numKkMGTPEc                    [        U [        [        [        45      (       a  [        U 5      $ [	        U 5      n U nSn[        U 5      S:  a!  U S   S:X  a  U S   [        ;   a
  U SS nU SS nO&[        U 5      S:  a  U S   [        ;   a
  U SS nU SS n [        U5      nUc  U$ UR                  S5      (       a  SnO,[        U5      S:X  a  S	nO[        S
R                  U 5      5      eUS:X  a  [        S
R                  U 5      5      eUS   [        ;  a  [        S
R                  U 5      5      e[        [        US      5      nXU-  -  $ ! [         a    [        SR                  U5      5      ef = f)a  
Parse kubernetes canonical form quantity like 200Mi to a decimal number.
Supported SI suffixes:
base1024: Ki | Mi | Gi | Ti | Pi | Ei
base1000: n | u | m | "" | k | M | G | T | P | E

See https://github.com/kubernetes/apimachinery/blob/master/pkg/api/resource/quantity.go

Input:
quantity: string. kubernetes canonical form quantity

Returns:
Decimal

Raises:
ValueError on invalid or unknown input
Nr	   r   ir   r   zInvalid number format: {}     z{} has unknown suffixkir   )
isinstanceintfloatr   strlen
_EXPONENTSr   
ValueErrorformatendswith)quantitynumbersuffixbaseexponents        [/var/www/html/dynamic-report/venv/lib/python3.13/site-packages/kubernetes/utils/quantity.pyparse_quantityr,      s   $ (S%122x  8}HFF
8}hrlc1B<:%cr]Fbc]F	X!	
 :#2"#E ~s	V	077ABB ~077ABBay
"077ABBz&),-HX%&&+  E4;;FCDDEs   E
 
%E/Nreturnc                 x   U(       d  [        U 5      $ UR                  S5      (       a  SnO [        U5      S:X  a  SnO[        U  S35      eUS:X  a  [        U  S35      eUS   [        ;  a  [        U  S35      eU [        U[        US      -  5      -  nU(       a  UR                  U5      n[        U5      U-   $ )a  
Takes a decimal and produces a string value in kubernetes' canonical quantity form,
like "200Mi".Users can specify an additional decimal number to quantize the output.

Example -  Relatively increase pod memory limits:

# retrieve my_pod
current_memory: Decimal = parse_quantity(my_pod.spec.containers[0].resources.limits.memory)
desired_memory = current_memory * 1.2
desired_memory_str = format_quantity(desired_memory, suffix="Gi", quantize=Decimal(1))
# patch pod with desired_memory_str

'quantize=Decimal(1)' ensures that the result does not contain any fractional digits.

Supported SI suffixes:
base1024: Ki | Mi | Gi | Ti | Pi | Ei
base1000: n | u | m | "" | k | M | G | T | P | E

See https://github.com/kubernetes/apimachinery/blob/master/pkg/api/resource/quantity.go

Input:
quantity: Decimal.  Quantity as a number which is supposed to converted to a string
                    with SI suffix.
suffix: string.     The desired suffix/unit-of-measure of the output string
quantize: Decimal.  Can be used to round/quantize the value before the string
                    is returned. Defaults to None.

Returns:
string. Canonical Kubernetes quantity string containing the SI suffix.

Raises:
ValueError if the SI suffix is not supported.
r   r   r   r   z has unknown suffixr   r   )r    r%   r!   r#   r"   r   quantize)quantity_valuer(   r/   r)   different_scales        r+   format_quantityr2   X   s    F >""s	V	N++>?@@~N++>?@@ay
"N++>?@@$wtz&)7L/L'MMO)228<&((    )N)decimalr   r   r"   r,   r    r2    r3   r+   <module>r6      sC    . 
			
	
	
	
	
	
	

7't6)c 6)r3   