
    Dh                    z    d dl mZ d dlZd dlmZ  G d dej
                        Z G d de      Z G d d	e      Zy)
    )annotationsN)	timedeltac                  V    e Zd Zej                  d        Zej                  dd       Zy)SmoothingAlgorithmc                    t         )NNotImplementedError)selfkwargss     x/var/www/fastuser/data/www/generator.snapmosaic.io/flask_app/venv/lib/python3.12/site-packages/progressbar/algorithms.py__init__zSmoothingAlgorithm.__init__   s    !!    c                    t         )zWUpdates the algorithm with a new value and returns the smoothed
        value.
        r   r
   	new_valueelapseds      r   updatezSmoothingAlgorithm.update   s
    
 "!r   Nr   floatr   r   returnr   )__name__
__module____qualname__abcabstractmethodr   r    r   r   r   r      s4    " " 	" "r   r   c                  "    e Zd ZdZdddZddZy)ExponentialMovingAveragez
    The Exponential Moving Average (EMA) is an exponentially weighted moving
    average that reduces the lag that's typically associated with a simple
    moving average. It's more responsive to recent changes in data.
    c                     || _         d| _        y Nr   alphavaluer
   r"   s     r   r   z!ExponentialMovingAverage.__init__   s    

r   c                |    | j                   |z  d| j                   z
  | j                  z  z   | _        | j                  S )N   r!   r   s      r   r   zExponentialMovingAverage.update   s2    ZZ)+q4::~.KK
zzr   Ng      ?r"   r   r   Noner   r   r   r   __doc__r   r   r   r   r   r   r      s    r   r   c                  "    e Zd ZdZdddZddZy)DoubleExponentialMovingAveragez
    The Double Exponential Moving Average (DEMA) is essentially an EMA of an
    EMA, which reduces the lag that's typically associated with a simple EMA.
    It's more responsive to recent changes in data.
    c                .    || _         d| _        d| _        y r    r"   ema1ema2r$   s     r   r   z'DoubleExponentialMovingAverage.__init__+   s    
		r   c                   | j                   |z  d| j                   z
  | j                  z  z   | _        | j                   | j                  z  d| j                   z
  | j                  z  z   | _        d| j                  z  | j                  z
  S )Nr&      r/   r   s      r   r   z%DoubleExponentialMovingAverage.update0   si    JJ*a$**n		-II	JJ*a$**n		-II	499}tyy((r   Nr'   r(   r   r*   r   r   r   r-   r-   $   s    
)r   r-   )	
__future__r   r   datetimer   ABCr   r   r-   r   r   r   <module>r7      s8    " 
 
" 
"1  )%7 )r   