Ë
    Ìip  ã                   óH   — d dl m Z  d dlmZ d dlmZ d dlmZ e eefde fd„Zy)é    )Údatetime)Úrelativedelta)Ú	BatchSize)ÚDbtRuntimeErrorÚreturnc                 ó0  — |t         j                  k(  r| t        |¬«      z   S |t         j                  k(  r| t        |¬«      z   S |t         j                  k(  r| t        |¬«      z   S |t         j
                  k(  r| t        |¬«      z   S t        d|› d�«      ‚)a�  Offsets the passed in timestamp based on the batch_size and offset.

    Note: THIS IS DIFFERENT FROM MicrobatchBuilder.offset_timestamp. That function first
    `truncates` the timestamp, and then does delta addition subtraction from there. This
    function _doesn't_ truncate the timestamp and uses `relativedelta` for specific edge
    case handling (months, years), which may produce different results than the delta math
    done in `MicrobatchBuilder.offset_timestamp`

    Examples
    2024-09-17 16:06:00 + Batchsize.hour -1 -> 2024-09-17 15:06:00
    2024-09-17 16:06:00 + Batchsize.hour +1 -> 2024-09-17 17:06:00
    2024-09-17 16:06:00 + Batchsize.day -1 -> 2024-09-16 16:06:00
    2024-09-17 16:06:00 + Batchsize.day +1 -> 2024-09-18 16:06:00
    2024-09-17 16:06:00 + Batchsize.month -1 -> 2024-08-17 16:06:00
    2024-09-17 16:06:00 + Batchsize.month +1 -> 2024-10-17 16:06:00
    2024-09-17 16:06:00 + Batchsize.year -1 -> 2023-09-17 16:06:00
    2024-09-17 16:06:00 + Batchsize.year +1 -> 2025-09-17 16:06:00
    2024-01-31 16:06:00 + Batchsize.month +1 -> 2024-02-29 16:06:00
    2024-02-29 16:06:00 + Batchsize.year +1 -> 2025-02-28 16:06:00
    )Úhours)Údays)Úmonths)ÚyearszUnhandled batch_size 'ú')r   Úhourr   ÚdayÚmonthÚyearr   )Ú	timestampÚ
batch_sizeÚoffsets      úZ/var/www/html/strategist-ai/venv/lib/python3.12/site-packages/dbt/event_time/event_time.pyÚoffset_timestampr   	   s‰   € ð, ”Y—^‘^Ò#Øœ=¨vÔ6Ñ6Ð6Ø	”y—}‘}Ò	$Øœ=¨fÔ5Ñ5Ð5Ø	”y—‘Ò	&Øœ=°Ô7Ñ7Ð7Ø	”y—~‘~Ò	%Øœ=¨vÔ6Ñ6Ð6äÐ 6°z°lÀ!ÐDÓEÐEó    N)	r   Údateutil.relativedeltar   Údbt.artifacts.resources.typesr   Údbt_common.exceptionsr   Úintr   © r   r   ú<module>r      s(   ðÝ å 0å 3Ý 1ð  (°IÀcñ FÈhô Fr   