Ë
    qPêjrP  ã                   óø   — d dl Z d dlZd dlZd dlZd dlmZmZmZ d dlm	Z
  ej                  e«      Z G d„ d«      Z G d„ d«      Z G d„ d	«      Z G d
„ de«      Z G d„ de«      Z G d„ d«      Z G d„ d«      Zy)é    N)Úensure_bytesÚensure_unicodeÚurlparse)ÚEXCEPTION_MAPc                   ó&   — e Zd Zg d¢Zd„ Zd„ Zd„ Zy)ÚMonitor)zbefore-parameter-buildzrequest-createdzresponse-receivedz
after-callzafter-call-errorc                 ó    — || _         || _        y)zåAbstraction for monitoring clients API calls

        :param adapter: An adapter that takes event emitter events
            and produces monitor events

        :param publisher: A publisher for generated monitor events
        N)Ú_adapterÚ
_publisher)ÚselfÚadapterÚ	publishers      úX/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/botocore/monitoring.pyÚ__init__zMonitor.__init__!   s   € ð  ˆŒØ#ˆ�ó    c                 ó^   — | j                   D ]  }|j                  || j                  «       Œ  y)z(Register an event emitter to the monitorN)Ú_EVENTS_TO_REGISTERÚregister_lastÚcapture)r   Úevent_emitterÚevent_to_registers      r   ÚregisterzMonitor.register,   s/   € à!%×!9Ñ!9ò 	IÐØ×'Ñ'Ð(9¸4¿<¹<ÕHñ	Ir   c                 óØ   — 	 | j                   j                  ||«      }|r| j                  j                  |«       yy# t        $ r#}t
        j                  d||d¬«       Y d}~yd}~ww xY w)zÚCaptures an incoming event from the event emitter

        It will feed an event emitter event to the monitor's adaptor to create
        a monitor event and then publish that event to the monitor's publisher.
        z:Exception %s raised by client monitor in handling event %sT)Úexc_infoN)r
   Úfeedr   ÚpublishÚ	ExceptionÚloggerÚdebug)r   Ú
event_nameÚpayloadÚmonitor_eventÚes        r   r   zMonitor.capture1   si   € ð
	Ø ŸM™M×.Ñ.¨z¸7ÓCˆMÙØ—‘×'Ñ'¨Õ6ð øäò 	Ü�L‰LØLØØØð	 ÷ ñ ûð	ús   ‚9= ½	A)ÁA$Á$A)N)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   © r   r   r   r      s   „ òÐò	$òIó
r   r   c                   ól   — e Zd Zej                  fd„Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d„ Zd	„ Zd
„ Zd„ Zd„ Zy)ÚMonitorEventAdapterc                 ó   — || _         y)z›Adapts event emitter events to produce monitor events

        :type time: callable
        :param time: A callable that produces the current time
        N)Ú_time)r   Útimes     r   r   zMonitorEventAdapter.__init__E   s   € ð ˆ�
r   c                 ó0   —  | j                  |«      di |¤ŽS )a   Feed an event emitter event to generate a monitor event

        :type emitter_event_name: str
        :param emitter_event_name: The name of the event emitted

        :type emitter_payload: dict
        :param emitter_payload: The payload to associated to the event
            emitted

        :rtype: BaseMonitorEvent
        :returns: A monitor event based on the event emitter events
            fired
        r'   )Ú_get_handler)r   Úemitter_event_nameÚemitter_payloads      r   r   zMonitorEventAdapter.feedM   s    € ð 5ˆt× Ñ Ð!3Ó4ÑG°ÑGÐGr   c                 ód   — t        | d|j                  d«      d   j                  dd«      z   «      S )NÚ_handle_ú.r   ú-Ú_)ÚgetattrÚsplitÚreplace)r   r    s     r   r.   z MonitorEventAdapter._get_handler]   s6   € ÜØ�*˜z×/Ñ/°Ó4°QÑ7×?Ñ?ÀÀSÓIÑIó
ð 	
r   c                 ó~   — t        |j                  j                  |j                  | j	                  «       ¬«      |d<   y )N©ÚserviceÚ	operationÚ	timestampÚcurrent_api_call_event)ÚAPICallEventÚservice_modelÚ
service_idÚ	wire_nameÚ_get_current_time)r   ÚmodelÚcontextÚkwargss       r   Ú_handle_before_parameter_buildz2MonitorEventAdapter._handle_before_parameter_buildb   s4   € Ü,8Ø×'Ñ'×2Ñ2Ø—o‘oØ×,Ñ,Ó.ô-
ˆÐ(Ò)r   c                 ó°   — |j                   }|d   j                  | j                  «       ¬«      }|j                  |_        |j
                  |_        ||d<   y )Nr>   )r=   Úcurrent_api_call_attempt_event)rE   Únew_api_call_attemptrC   ÚheadersÚrequest_headersÚurl)r   ÚrequestrF   rE   Únew_attempt_events        r   Ú_handle_request_createdz+MonitorEventAdapter._handle_request_createdi   sY   € Ø—/‘/ˆØ#Ø$ñ
ç
Ñ
¨×)?Ñ)?Ó)AÐ
Ó
Bð 	ð -4¯O©OÐÔ)Ø '§¡ÐÔØ4EˆÐ0Ò1r   c                 óÊ   — |j                  d«      }| j                  |«      |_        |�2|d   d   |_        |d   d   |_        |j                  d«      |_        |S ||_        |S )NrI   ÚResponseMetadataÚHTTPStatusCodeÚHTTPHeadersÚError)ÚpopÚ_get_latencyÚlatencyÚhttp_status_codeÚresponse_headersÚgetÚparsed_errorÚwire_exception)r   Úparsed_responserE   Ú	exceptionrF   Úattempt_events         r   Ú_handle_response_receivedz-MonitorEventAdapter._handle_response_receivedr   s‹   € ð  Ÿ™Ð$DÓEˆØ $× 1Ñ 1°-Ó @ˆÔØÐ&Ø-<Ø"ñ.àñ. ˆMÔ*ð .=Ø"ñ.àñ.ˆMÔ*ð *9×)<Ñ)<¸WÓ)EˆMÔ&ð Ðð ,5ˆMÔ(ØÐr   c                 ó^   — |d   j                  dd«      |d   _        | j                  |«      S )NrR   ÚMaxAttemptsReachedFr>   )r[   Úretries_exceededÚ_complete_api_call)r   rE   ÚparsedrF   s       r   Ú_handle_after_callz&MonitorEventAdapter._handle_after_callƒ   s;   € Ø=CØñ>
ç
‰#Ð" EÓ
*ð 	Ð(Ñ)Ô:ð ×&Ñ& wÓ/Ð/r   c                 óV   — | j                  |«      |d   _        | j                  |«      S ©Nr>   )Ú_is_retryable_exceptionrd   re   )r   rE   r_   rF   s       r   Ú_handle_after_call_errorz,MonitorEventAdapter._handle_after_call_error‰   s3   € ð "×9Ñ9¸)ÓDð 	Ø$ñ	
ä
Ø×&Ñ& wÓ/Ð/r   c                 ó:   — t        |t        t        d   «      «      S )NÚGENERAL_CONNECTION_ERROR)Ú
isinstanceÚtupleÚRETRYABLE_EXCEPTIONS)r   r_   s     r   rj   z+MonitorEventAdapter._is_retryable_exception“   s    € ÜØ”uÔ1Ð2LÑMÓNó
ð 	
r   c                 óT   — |j                  d«      }| j                  |«      |_        |S ri   )rV   rW   rX   )r   rE   Ú
call_events      r   re   z&MonitorEventAdapter._complete_api_call˜   s*   € Ø—[‘[Ð!9Ó:ˆ
Ø!×.Ñ.¨zÓ:ˆ
ÔØÐr   c                 ó<   — | j                  «       |j                  z
  S ©N)rC   r=   ©r   Úevents     r   rW   z MonitorEventAdapter._get_latency�   s   € Ø×%Ñ%Ó'¨%¯/©/Ñ9Ð9r   c                 ó:   — t        | j                  «       dz  «      S )Niè  )Úintr+   ©r   s    r   rC   z%MonitorEventAdapter._get_current_time    s   € Ü�4—:‘:“< $Ñ&Ó'Ð'r   N)r$   r%   r&   r,   r   r   r.   rG   rP   ra   rg   rk   rj   re   rW   rC   r'   r   r   r)   r)   D   sG   „ Ø ŸI™Ió òHò 
ò

òFòò"0ò0ò
ò
ò
:ó(r   r)   c                   ó   — e Zd Zd„ Zd„ Zd„ Zy)ÚBaseMonitorEventc                 ó.   — || _         || _        || _        y)a‹  Base monitor event

        :type service: str
        :param service: A string identifying the service associated to
            the event

        :type operation: str
        :param operation: A string identifying the operation of service
            associated to the event

        :type timestamp: int
        :param timestamp: Epoch time in milliseconds from when the event began
        Nr:   )r   r;   r<   r=   s       r   r   zBaseMonitorEvent.__init__¥   s   € ð ˆŒØ"ˆŒØ"ˆ�r   c                 óN   — | j                   j                  › d| j                  ›d�S )Nú(ú))Ú	__class__r$   Ú__dict__ry   s    r   Ú__repr__zBaseMonitorEvent.__repr__·   s%   € Ø—.‘.×)Ñ)Ð*¨!¨D¯M©MÐ+<¸AÐ>Ð>r   c                 ób   — t        || j                  «      r| j                  |j                  k(  S y)NF)rn   r€   r�   )r   Úothers     r   Ú__eq__zBaseMonitorEvent.__eq__º   s&   € Ü�e˜TŸ^™^Ô,Ø—=‘= E§N¡NÑ2Ð2Ør   N)r$   r%   r&   r   r‚   r…   r'   r   r   r{   r{   ¤   s   „ ò#ò$?ór   r{   c                   ó,   ‡ — e Zd Z	 	 	 dˆ fd„	Zd„ Zˆ xZS )r?   c                 óf   •— t         ‰| �  |||¬«       || _        || _        |€g | _        || _        y)a¡  Monitor event for a single API call

        This event corresponds to a single client method call, which includes
        every HTTP requests attempt made in order to complete the client call

        :type service: str
        :param service: A string identifying the service associated to
            the event

        :type operation: str
        :param operation: A string identifying the operation of service
            associated to the event

        :type timestamp: int
        :param timestamp: Epoch time in milliseconds from when the event began

        :type latency: int
        :param latency: The time in milliseconds to complete the client call

        :type attempts: list
        :param attempts: The list of APICallAttempts associated to the
            APICall

        :type retries_exceeded: bool
        :param retries_exceeded: True if API call exceeded retries. False
            otherwise
        r:   N)Úsuperr   rX   Úattemptsrd   )r   r;   r<   r=   rX   r‰   rd   r€   s          €r   r   zAPICallEvent.__init__Á   sD   ø€ ôH 	‰ÑØ y¸Ið 	ô 	
ð ˆŒØ ˆŒØÐØˆDŒMØ 0ˆÕr   c                 ó€   — t        | j                  | j                  |¬«      }| j                  j	                  |«       |S )zÏInstantiates APICallAttemptEvent associated to the APICallEvent

        :type timestamp: int
        :param timestamp: Epoch time in milliseconds to associate to the
            APICallAttemptEvent
        r:   )ÚAPICallAttemptEventr;   r<   r‰   Úappend)r   r=   r`   s      r   rJ   z!APICallEvent.new_api_call_attemptî   s7   € ô ,Ø—L‘L¨D¯N©NÀiô
ˆð 	�‰×Ñ˜]Ô+ØÐr   )NNF)r$   r%   r&   r   rJ   Ú__classcell__©r€   s   @r   r?   r?   À   s   ø„ ð ØØõ+1öZr   r?   c                   ó.   ‡ — e Zd Z	 	 	 	 	 	 	 dˆ fd„	Zˆ xZS )r‹   c                 óŒ   •— t         ‰| �  |||¬«       || _        || _        || _        || _        || _        |	| _        |
| _        y)aÞ  Monitor event for a single API call attempt

        This event corresponds to a single HTTP request attempt in completing
        the entire client method call.

        :type service: str
        :param service: A string identifying the service associated to
            the event

        :type operation: str
        :param operation: A string identifying the operation of service
            associated to the event

        :type timestamp: int
        :param timestamp: Epoch time in milliseconds from when the HTTP request
            started

        :type latency: int
        :param latency: The time in milliseconds to complete the HTTP request
            whether it succeeded or failed

        :type url: str
        :param url: The URL the attempt was sent to

        :type http_status_code: int
        :param http_status_code: The HTTP status code of the HTTP response
            if there was a response

        :type request_headers: dict
        :param request_headers: The HTTP headers sent in making the HTTP
            request

        :type response_headers: dict
        :param response_headers: The HTTP headers returned in the HTTP response
            if there was a response

        :type parsed_error: dict
        :param parsed_error: The error parsed if the service returned an
            error back

        :type wire_exception: Exception
        :param wire_exception: The exception raised in sending the HTTP
            request (i.e. ConnectionError)
        r:   N)	rˆ   r   rX   rM   rY   rL   rZ   r\   r]   )r   r;   r<   r=   rX   rM   rY   rL   rZ   r\   r]   r€   s              €r   r   zAPICallAttemptEvent.__init__ý   sW   ø€ ôr 	‰ÑØ y¸Ið 	ô 	
ð ˆŒØˆŒØ 0ˆÔØ.ˆÔØ 0ˆÔØ(ˆÔØ,ˆÕr   )NNNNNNN)r$   r%   r&   r   r�   rŽ   s   @r   r‹   r‹   ü   s&   ø„ ð ØØØØØØ÷B-ñ B-r   r‹   c                   ó  — e Zd ZdZdZdZdZdZddddœZ e	j                  d	«       e	j                  d
«      dœZg d¢Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd „ Z d!„ Z!d"„ Z"d#„ Z#d$„ Z$d%„ Z%y&)'ÚCSMSerializeréÿ   é€   é   i   ÚXAmznRequestIdÚXAmzRequestIdÚXAmzId2)zx-amzn-requestidzx-amz-request-idz
x-amz-id-2zSAWS4-HMAC-SHA256 Credential=(?P<access_key>\w+)/\d+/(?P<signing_region>[a-z0-9-]+)/zAWS (?P<access_key>\w+):)Úv4Ús3)r;   r<   r=   r‰   rX   rd   rM   rL   rY   rZ   r\   r]   c                 ó4   — | j                  |«       || _        y)zÖSerializes monitor events to CSM (Client Side Monitoring) format

        :type csm_client_id: str
        :param csm_client_id: The application identifier to associate
            to the serialized events
        N)Ú_validate_client_idÚcsm_client_id©r   r�   s     r   r   zCSMSerializer.__init__d  s   € ð 	× Ñ  Ô/Ø*ˆÕr   c                 ól   — t        |«      | j                  kD  rt        d|› d| j                  › d�«      ‚y )Nz&The value provided for csm_client_id: z exceeds the maximum length of z characters)ÚlenÚ_MAX_CLIENT_ID_LENGTHÚ
ValueErrorrž   s     r   rœ   z!CSMSerializer._validate_client_idn  sH   € Üˆ}Ó × :Ñ :Ò:ÜØ8¸¸ð H)Ø)-×)CÑ)CÐ(DÀKðQóð ð ;r   c                 ó  — | j                  |«      }| j                  |«      }||d<   | j                  D ]*  }t        ||d«      }|€Œ t        | d|z   «      |||¬«       Œ, t	        t        j                  |d¬«      «      S )zàSerializes a monitor event to the CSM format

        :type event: BaseMonitorEvent
        :param event: The event to serialize to bytes

        :rtype: bytes
        :returns: The CSM serialized form of the event
        ÚTypeNÚ_serialize_)Ú
event_type)ú,ú:)Ú
separators)Ú_get_base_event_dictÚ_get_event_typeÚ_SERIALIZEABLE_EVENT_PROPERTIESr6   r   ÚjsonÚdumps)r   rv   Ú
event_dictr¦   ÚattrÚvalues         r   Ú	serializezCSMSerializer.serializeu  sŒ   € ð ×.Ñ.¨uÓ5ˆ
Ø×)Ñ)¨%Ó0ˆ
Ø'ˆ
�6ÑØ×8Ñ8ò 	ˆDÜ˜E 4¨Ó.ˆEØÑ Ø3”˜˜m¨dÑ2Ó3Ø˜:°*öð	ô œDŸJ™J z¸jÔIÓJÐJr   c                 ó    — d| j                   dœS )Né   )ÚVersionÚClientId)r�   ru   s     r   rª   z"CSMSerializer._get_base_event_dict‰  s   € àØ×*Ñ*ñ
ð 	
r   c                 ó   — ||d<   y )NÚServicer'   )r   r;   r¯   rF   s       r   Ú_serialize_servicez CSMSerializer._serialize_service�  s   € Ø 'ˆ
�9Òr   c                 ó   — ||d<   y )NÚApir'   )r   r<   r¯   rF   s       r   Ú_serialize_operationz"CSMSerializer._serialize_operation’  s   € Ø%ˆ
�5Òr   c                 ó   — ||d<   y )NÚ	Timestampr'   )r   r=   r¯   rF   s       r   Ú_serialize_timestampz"CSMSerializer._serialize_timestamp•  s   € Ø"+ˆ
�;Òr   c                 óP   — t        |«      |d<   |r| j                  ||d   «       y y )NÚAttemptCountéÿÿÿÿ)r    Ú_add_fields_from_last_attempt)r   r‰   r¯   rF   s       r   Ú_serialize_attemptsz!CSMSerializer._serialize_attempts˜  s,   € Ü%(¨£]ˆ
�>Ñ"ÙØ×.Ñ.¨z¸8ÀB¹<ÕHð r   c                 óx  — |j                   r@| j                  |j                   «      }|�||d<   | j                  |j                   «      |d<   |j                  �|j                  |d<   |j                  �| j                  |j                  |d«       |j                  �| j                  |j                  |d«       y y )NÚRegionÚ	UserAgentÚFinalHttpStatusCodeÚApiCall)rL   Ú_get_regionÚ_get_user_agentrY   r\   Ú_serialize_parsed_errorr]   Ú_serialize_wire_exception)r   r¯   Úlast_attemptÚregions       r   rÃ   z+CSMSerializer._add_fields_from_last_attempt�  sÅ   € Ø×'Ò'ð ×%Ñ% l×&BÑ&BÓCˆFØÐ!Ø'-�
˜8Ñ$Ø&*×&:Ñ&:Ø×,Ñ,ó'ˆJ�{Ñ#ð ×(Ñ(Ð4Ø0<×0MÑ0MˆJÐ,Ñ-Ø×$Ñ$Ð0Ø×(Ñ(Ø×)Ñ)¨:°yôð ×&Ñ&Ð2Ø×*Ñ*Ø×+Ñ+¨Z¸õð 3r   c                 ó0   — |dk(  r||d<   y |dk(  r||d<   y y )NrÉ   ÚLatencyÚApiCallAttemptÚAttemptLatencyr'   )r   rX   r¯   r¦   s       r   Ú_serialize_latencyz CSMSerializer._serialize_latency²  s-   € Ø˜Ò"Ø$+ˆJ�yÒ!ØÐ+Ò+Ø+2ˆJÐ'Ò(ð ,r   c                 ó   — |rd|d<   y d|d<   y )Nr´   r   ÚMaxRetriesExceededr'   )r   rd   r¯   rF   s       r   Ú_serialize_retries_exceededz)CSMSerializer._serialize_retries_exceeded¸  s   € ñ 1A¨1ˆ
Ð'Ò(Àaˆ
Ð'Ò(r   c                 ó4   — t        |«      j                  |d<   y )NÚFqdn)r   Únetloc)r   rM   r¯   rF   s       r   Ú_serialize_urlzCSMSerializer._serialize_url½  s   € Ü% c›]×1Ñ1ˆ
�6Òr   c                 óÀ   — | j                  |«      |d<   | j                  |«      r| j                  |«      |d<   | j                  |«      }|�||d<   d|v r	|d   |d<   y y )NrÇ   Ú	AccessKeyrÆ   zX-Amz-Security-TokenÚSessionToken)rË   Ú
_is_signedÚ_get_access_keyrÊ   )r   rL   r¯   rF   rÏ   s        r   Ú_serialize_request_headersz(CSMSerializer._serialize_request_headersÀ  sy   € ð #'×"6Ñ"6°Ó"Gˆ
�;ÑØ�?‰?˜?Ô+Ø&*×&:Ñ&:¸?Ó&KˆJ�{Ñ#Ø×!Ñ! /Ó2ˆØÐØ#)ˆJ�xÑ Ø! _Ñ4Ø)8Ø&ñ*ˆJ�~Ò&ð 5r   c                 ó   — ||d<   y )NÚHttpStatusCoder'   )r   rY   r¯   rF   s       r   Ú_serialize_http_status_codez)CSMSerializer._serialize_http_status_codeÎ  s   € ð (8ˆ
Ð#Ò$r   c                 ób   — | j                   j                  «       D ]  \  }}||v sŒ||   ||<   Œ y rt   )Ú"_RESPONSE_HEADERS_TO_EVENT_ENTRIESÚitems)r   rZ   r¯   rF   ÚheaderÚentrys         r   Ú_serialize_response_headersz)CSMSerializer._serialize_response_headersÓ  s>   € ð "×DÑD×JÑJÓLò 	=‰MˆF�EØÐ)Ò)Ø$4°VÑ$<�
˜5Ò!ñ	=r   c                 óª   — |dk(  rdnd}| j                  |d   | j                  «      ||dz   <   | j                  |d   | j                  «      ||dz   <   y )NrÉ   ÚFinalÚ ÚCodeÚAwsExceptionÚMessageÚAwsExceptionMessage)Ú	_truncateÚ_MAX_ERROR_CODE_LENGTHÚ_MAX_MESSAGE_LENGTH)r   r\   r¯   r¦   rF   Úfield_prefixs         r   rÌ   z%CSMSerializer._serialize_parsed_errorÚ  sf   € ð #-°	Ò"9‘w¸rˆØ48·N±NØ˜Ñ  $×"=Ñ"=ó5
ˆ
�< .Ñ0Ñ1ð <@¿>¹>Ø˜Ñ# T×%=Ñ%=ó<
ˆ
�<Ð"7Ñ7Ò8r   c                 óØ   — |dk(  rdnd}| j                  |j                  j                  | j                  «      ||dz   <   | j                  t	        |«      | j
                  «      ||dz   <   y )NrÉ   rì   rí   ÚSdkExceptionÚSdkExceptionMessage)rò   r€   r$   Ú_MAX_EXCEPTION_CLASS_LENGTHÚstrrô   )r   r]   r¯   r¦   rF   rõ   s         r   rÍ   z'CSMSerializer._serialize_wire_exceptionå  sm   € ð #-°	Ò"9‘w¸rˆØ48·N±NØ×$Ñ$×-Ñ-¨t×/OÑ/Oó5
ˆ
�< .Ñ0Ñ1ð <@¿>¹>Ü�Ó ×!9Ñ!9ó<
ˆ
�<Ð"7Ñ7Ò8r   c                 óH   — t        |t        «      ryt        |t        «      ryy )NrÉ   rÒ   )rn   r?   r‹   ru   s     r   r«   zCSMSerializer._get_event_typeð  s"   € Ü�eœ\Ô*ØÜ˜Ô2Ô3Ø#ð 4r   c                 ón   — | j                  |«      }| j                  |«      \  }}|j                  d«      S )NÚ
access_key)Ú_get_auth_valueÚ_get_auth_matchÚgroup)r   rL   Úauth_valr5   Ú
auth_matchs        r   rà   zCSMSerializer._get_access_keyö  s7   € Ø×'Ñ'¨Ó8ˆØ×,Ñ,¨XÓ6‰ˆˆ:Ø×Ñ Ó-Ð-r   c                 óž   — | j                  |«      sy | j                  |«      }| j                  |«      \  }}|dk7  ry |j                  d«      S )Nr™   Úsigning_region)rß   rþ   rÿ   r   )r   rL   r  Úsignature_versionr  s        r   rÊ   zCSMSerializer._get_regionû  sT   € Ø�‰˜Ô/ØØ×'Ñ'¨Ó8ˆØ(,×(<Ñ(<¸XÓ(FÑ%Ð˜:Ø Ò$ØØ×ÑÐ 0Ó1Ð1r   c                 ól   — | j                  t        |j                  dd«      «      | j                  «      S )Nz
User-Agentrí   )rò   r   r[   Ú_MAX_USER_AGENT_LENGTH©r   rL   s     r   rË   zCSMSerializer._get_user_agent  s1   € Ø�~‰~Ü˜?×.Ñ.¨|¸RÓ@ÓAØ×'Ñ'ó
ð 	
r   c                 ó
   — d|v S ©NÚAuthorizationr'   r  s     r   rß   zCSMSerializer._is_signed
  s   € Ø /Ð1Ð1r   c                 ó   — t        |d   «      S r
  )r   r  s     r   rþ   zCSMSerializer._get_auth_value  s   € Ü˜o¨oÑ>Ó?Ð?r   c                 óz   — | j                   j                  «       D ]  \  }}|j                  |«      }|sŒ||fc S  y)N)NN)Ú_AUTH_REGEXSrç   Úmatch)r   r  r  Úregexr  s        r   rÿ   zCSMSerializer._get_auth_match  sG   € Ø(,×(9Ñ(9×(?Ñ(?Ó(Aò 	0Ñ$Ð˜uØ—K‘K Ó)ˆEÚØ(¨%Ð/Ò/ð	0ð r   c                 óZ   — t        |«      |kD  rt        j                  d||«       |d | S |S )Nz6Truncating following value to maximum length of %s: %s)r    r   r   )r   ÚtextÚ
max_lengths      r   rò   zCSMSerializer._truncate  s7   € Üˆt‹9�zÒ!Ü�L‰LØHØØôð
 ˜˜Ð$Ð$Øˆr   N)&r$   r%   r&   r¡   rù   ró   r  rô   ræ   ÚreÚcompiler  r¬   r   rœ   r²   rª   r¹   r¼   r¿   rÄ   rÃ   rÔ   r×   rÛ   rá   rä   rê   rÌ   rÍ   r«   rà   rÊ   rË   rß   rþ   rÿ   rò   r'   r   r   r’   r’   B  sç   „ ØÐØ"%ÐØ ÐØ ÐØÐà,Ø+Øñ*Ð&ð ˆb�j‰jð/ó
ð
 ˆb�j‰jÐ4Ó5ñ€Lò'Ð#ò+òòKò(
ò(ò&ò,òIò
ò*3òHò
2òò8ò
=ò	
ò	
ò$ò.ò
2ò
ò2ò@òór   r’   c                   ó   — e Zd ZdZd„ Zd„ Zy)ÚSocketPublisheri    c                 ó2   — || _         ||f| _        || _        y)a)  Publishes monitor events to a socket

        :type socket: socket.socket
        :param socket: The socket object to use to publish events

        :type host: string
        :param host: The host to send events to

        :type port: integer
        :param port: The port on the host to send events to

        :param serializer: The serializer to use to serialize the event
            to a form that can be published to the socket. This must
            have a `serialize()` method that accepts a monitor event
            and return bytes
        N)Ú_socketÚ_addressÚ_serializer)r   ÚsocketÚhostÚportÚ
serializers        r   r   zSocketPublisher.__init__%  s   € ð" ˆŒØ˜t˜ˆŒØ%ˆÕr   c                 ó  — | j                   j                  |«      }t        |«      | j                  kD  r+t        j                  dt        |«      | j                  «       y| j                  j                  || j                  «       y)zÆPublishes a specified monitor event

        :type event: BaseMonitorEvent
        :param event: The monitor event to be sent
            over the publisher's socket to the desired address.
        z`Serialized event of size %s exceeds the maximum length allowed: %s. Not sending event to socket.N)	r  r²   r    Ú_MAX_MONITOR_EVENT_LENGTHr   r   r  Úsendtor  )r   rv   Úserialized_events      r   r   zSocketPublisher.publish:  sp   € ð  ×+Ñ+×5Ñ5°eÓ<ÐÜÐÓ  4×#AÑ#AÒAÜ�L‰Lð<äÐ$Ó%Ø×.Ñ.ô	ð Ø�‰×ÑÐ,¨d¯m©mÕ<r   N)r$   r%   r&   r!  r   r   r'   r   r   r  r  "  s   „ Ø (Ðò&ó*=r   r  )r­   Úloggingr  r,   Úbotocore.compatr   r   r   Úbotocore.retryhandlerr   rp   Ú	getLoggerr$   r   r   r)   r{   r?   r‹   r’   r  r'   r   r   ú<module>r(     s…   ðó Û Û 	Û ç BÑ BÝ Gà	ˆ×	Ñ	˜8Ó	$€÷)ñ )÷X](ñ ](÷@ñ ô89Ð#ô 9ôxC-Ð*ô C-÷L]ñ ]÷@(=ò (=r   