Ë
    èlÖi$  ã                   óV   — d dl mZmZmZmZ d dlmZmZ d dlm	Z	 d dl
Z
 G d„ de«      Zy)é    )ÚOptionalÚUnionÚTupleÚDict)ÚSuccessCallbackÚFailureCallback)Ú
EventStoreNc                   óÈ  — e Zd Zddddddi ddf	dee   dee   dee   dee   deeee	eef   f      dee   de
eef   d	ee   d
eej                     ddfd„Zedee   fd„«       Zej$                  dee   fd„«       Zedee   fd„«       Zej$                  dee   fd„«       Zedee   fd„«       Zej$                  dee   fd„«       Zedee   fd„«       Zej$                  dee   fd„«       Zedeeee	eef   f      fd„«       Zej$                  deeee	eef   f      fd„«       Zedee   fd„«       Zej$                  dee   fd„«       Zede
eef   fd„«       Zej$                  de
eef   fd„«       Zd"dedefd„Zedee   fd„«       Zej$                  dee   fd„«       Zedeej                     fd „«       Zej$                  deej                     fd!„«       Zy)#ÚEmitterConfigurationNÚ
batch_sizeÚ
on_successÚ
on_failureÚ
byte_limitÚrequest_timeoutÚbuffer_capacityÚcustom_retry_codesÚevent_storeÚsessionÚreturnc
                 ó‚   — || _         || _        || _        || _        || _        || _        || _        || _        |	| _        y)a®  
        Configuration for the emitter that sends events to the Snowplow collector.
        :param batch_size:     The maximum number of queued events before the buffer is flushed. Default is 10.
        :type  batch_size:     int | None
        :param on_success:      Callback executed after every HTTP request in a flush has status code 200
                                Gets passed one argument, an array of dictionaries corresponding to the sent events' payloads
        :type  on_success:      function | None
        :param on_failure:      Callback executed if at least one HTTP request in a flush has status code other than 200
                                Gets passed two arguments:
                                1) The number of events which were successfully sent
                                2) An array of dictionaries corresponding to the unsent events' payloads
        :type  on_failure:      function | None
        :param byte_limit:      The size event list after reaching which queued events will be flushed
        :type  byte_limit:      int | None
        :param request_timeout: Timeout for the HTTP requests. Can be set either as single float value which
                                 applies to both "connect" AND "read" timeout, or as tuple with two float values
                                 which specify the "connect" and "read" timeouts separately
        :type request_timeout:  float | tuple | None
        :param  custom_retry_codes: Set custom retry rules for HTTP status codes received in emit responses from the Collector.
                                    By default, retry will not occur for status codes 400, 401, 403, 410 or 422. This can be overridden here.
                                    Note that 2xx codes will never retry as they are considered successful.
        :type   custom_retry_codes: dict
        :param  event_store:    Stores the event buffer and buffer capacity. Default is an InMemoryEventStore object with buffer_capacity of 10,000 events.
        :type   event_store:    EventStore | None
        :param  session:    Persist parameters across requests by using a session object
        :type   session:    request.Session | None
        N)	r   r   r   r   r   r   r   r   r   )
Úselfr   r   r   r   r   r   r   r   r   s
             úk/var/www/html/strategist-ai/venv_dbt/lib/python3.12/site-packages/snowplow_tracker/emitter_configuration.pyÚ__init__zEmitterConfiguration.__init__   sH   € ðP %ˆŒØ$ˆŒØ$ˆŒØ$ˆŒØ.ˆÔØ.ˆÔØ"4ˆÔØ&ˆÔØˆ�ó    c                 ó   — | j                   S )zb
        The maximum number of queued events before the buffer is flushed. Default is 10.
        )Ú_batch_size©r   s    r   r   zEmitterConfiguration.batch_sizeK   ó   € ð
 ×ÑÐr   Úvaluec                 óŒ   — t        |t        «      r|dk  rt        d«      ‚t        |t        «      s|�t        d«      ‚|| _        y )Nr   zbatch_size must greater than 0zbatch_size must be of type int)Ú
isinstanceÚintÚ
ValueErrorr   ©r   r   s     r   r   zEmitterConfiguration.batch_sizeR   óA   € ä�eœSÔ! e¨a¢iÜÐ=Ó>Ð>Ü˜%¤Ô%¨%Ð*;ÜÐ=Ó>Ð>Ø ˆÕr   c                 ó   — | j                   S )z†
        Callback executed after every HTTP request in a flush has status code 200. Gets passed the number of events flushed.
        ©Ú_on_successr   s    r   r   zEmitterConfiguration.on_successZ   r   r   c                 ó   — || _         y ©Nr'   r$   s     r   r   zEmitterConfiguration.on_successa   ó
   € à ˆÕr   c                 ó   — | j                   S )ac  
        Callback executed if at least one HTTP request in a flush has status code other than 200
                                Gets passed two arguments:
                                1) The number of events which were successfully sent
                                2) An array of dictionaries corresponding to the unsent events' payloads
        ©Ú_on_failurer   s    r   r   zEmitterConfiguration.on_failuree   s   € ð ×ÑÐr   c                 ó   — || _         y r*   r-   r$   s     r   r   zEmitterConfiguration.on_failureo   r+   r   c                 ó   — | j                   S )zX
        The size event list after reaching which queued events will be flushed
        )Ú_byte_limitr   s    r   r   zEmitterConfiguration.byte_limits   r   r   c                 óŒ   — t        |t        «      r|dk  rt        d«      ‚t        |t        «      s|�t        d«      ‚|| _        y )Nr   zbyte_limit must greater than 0zbyte_limit must be of type int)r!   r"   r#   r1   r$   s     r   r   zEmitterConfiguration.byte_limitz   r%   r   c                 ó   — | j                   S )a3  
        Timeout for the HTTP requests. Can be set either as single float value which
                                     applies to both "connect" AND "read" timeout, or as tuple with two float values
                                     which specify the "connect" and "read" timeouts separately
        ©Ú_request_timeoutr   s    r   r   z$EmitterConfiguration.request_timeout‚   s   € ð ×$Ñ$Ð$r   c                 ó   — || _         y r*   r4   r$   s     r   r   z$EmitterConfiguration.request_timeout‹   s
   € à %ˆÕr   c                 ó   — | j                   S )z¶
        The maximum capacity of the event buffer. The default buffer capacity is 10 000 events.
                                When the buffer is full new events are lost.
        )Ú_buffer_capacityr   s    r   r   z$EmitterConfiguration.buffer_capacity�   s   € ð ×$Ñ$Ð$r   c                 óŒ   — t        |t        «      r|dk  rt        d«      ‚t        |t        «      s|�t        d«      ‚|| _        y )Nr   z#buffer_capacity must greater than 0z#buffer_capacity must be of type int)r!   r"   r#   r8   r$   s     r   r   z$EmitterConfiguration.buffer_capacity—   sA   € ä�eœSÔ! e¨a¢iÜÐBÓCÐCÜ˜%¤Ô%¨%Ð*;ÜÐBÓCÐCØ %ˆÕr   c                 ó   — | j                   S )zi
        Custom retry rules for HTTP status codes received in emit responses from the Collector.
        ©Ú_custom_retry_codesr   s    r   r   z'EmitterConfiguration.custom_retry_codesŸ   s   € ð
 ×'Ñ'Ð'r   c                 ó   — || _         y r*   r;   r$   s     r   r   z'EmitterConfiguration.custom_retry_codes¦   s
   € à#(ˆÕ r   Ústatus_codec                 óü   — t        |t        «      st        d«       yt        |t        «      st        d«       yd|cxk  rdk  rn nt        d«       y|| j                  |<   || j                  j                  «       v S )a>  
        Add a retry rule for HTTP status code received from emit responses from the Collector.
        :param  status_code:    HTTP response code
        :type   status_code:    int
        :param  retry:  Set the status_code to retry (True) or not retry (False). Default is True
        :type   retry:  bool
        zstatus_code must be of type intFzretry must be of type booléÈ   i,  zNcustom_retry_codes should not include codes for succesful requests (2XX codes))r!   r"   ÚprintÚboolr   Úkeys)r   r>   Úretrys      r   Úset_retry_codez#EmitterConfiguration.set_retry_codeª   sw   € ô ˜+¤sÔ+ÜÐ3Ô4Øä˜%¤Ô&ÜÐ.Ô/Øà�+Ô# Õ#ÜØ`ôð à/4ˆ×Ñ Ñ,à˜d×5Ñ5×:Ñ:Ó<Ð<Ð<r   c                 ó   — | j                   S r*   ©Ú_event_storer   s    r   r   z EmitterConfiguration.event_storeÄ   s   € à× Ñ Ð r   c                 ó   — || _         y r*   rG   r$   s     r   r   z EmitterConfiguration.event_storeÈ   s
   € à!ˆÕr   c                 ó   — | j                   S )zT
        Persist parameters across requests using a requests.Session object
        ©Ú_sessionr   s    r   r   zEmitterConfiguration.sessionÌ   s   € ð
 �}‰}Ðr   c                 ó   — || _         y r*   rK   r$   s     r   r   zEmitterConfiguration.sessionÓ   s	   € àˆ�r   )T)Ú__name__Ú
__module__Ú__qualname__r   r"   r   r   r   Úfloatr   r   rB   r	   ÚrequestsÚSessionr   Úpropertyr   Úsetterr   r   r   r   r   r   rE   r   r   © r   r   r   r      s†  „ ð %)Ø04Ø04Ø$(ØGKØ)-Ø.0Ø,0Ø.2ñ0à˜S‘Mð0ð ˜_Ñ-ð0ð ˜_Ñ-ð	0ð
 ˜S‘Mð0ð " %¨¨u°U¸E°\Ñ/BÐ(BÑ"CÑDð0ð " #™ð0ð !  d ™Oð0ð ˜jÑ)ð0ð ˜(×*Ñ*Ñ+ð0ð 
ó0ðd ð ˜H S™Mò  ó ð ð ×Ñð! ¨¡ò !ó ð!ð ð ˜H _Ñ5ò  ó ð ð ×Ñð! ¨Ñ 9ò !ó ð!ð ð ˜H _Ñ5ò  ó ð ð ×Ñð! ¨Ñ 9ò !ó ð!ð ð ˜H S™Mò  ó ð ð ×Ñð! ¨¡ò !ó ð!ð ð% ¨%°°u¸UÀE¸\Ñ7JÐ0JÑ*KÑ!Lò %ó ð%ð ×Ñð& X¨e°E¸5ÀÈÀÑ;NÐ4NÑ.OÑ%Pò &ó ð&ð ð% ¨#¡ò %ó ð%ð ×Ñð& X¨c¡]ò &ó ð&ð ð( D¨¨d¨¡Oò (ó ð(ð ×Ñð)¨¨S°$¨Y©ò )ó ð)ñ=¨#ð =¸dó =ð4 ð!˜X jÑ1ò !ó ð!ð ×Ñð" ¨*Ñ!5ò "ó ð"ð ð˜ (×"2Ñ"2Ñ3ò ó ðð ‡^�^ð˜X h×&6Ñ&6Ñ7ò ó ñr   r   )Útypingr   r   r   r   Úsnowplow_tracker.typingr   r   Úsnowplow_tracker.event_storer	   rR   Úobjectr   rV   r   r   ú<module>r[      s$   ð÷$ 0Ó /ß DÝ 3Û ô}˜6õ }r   