mf ddlZddlZddlZddlmZddlmZddlmZddl m Z m Z er,ddl m Z ddl mZddl mZdd l mZdd l mZdd l mZdd lmZmZGd deZGddeZGddeZdS)N) text_type)MYPY)Session) json_dumpscapture_internal_exceptions)Any)Optional)Union)Dict)List)Iterator)EventEventDataCategoryceZdZ ddZedZdZdZdZdZ dZ d Z d Z d Z d Zed ZedZdZdS)EnvelopeNcp|t|}|pi|_|g}nt|}||_dSN)dictheaderslistitems)selfrrs J/opt/imunify360/venv/lib64/python3.11/site-packages/sentry_sdk/envelope.py__init__zEnvelope.__init__sB  7mmG}" =EEKKE c|dt|jddd|jDdS)Nzenvelope with z items (z, c3$K|] }|jV dSr) data_category).0xs r z'Envelope.description..*s$::!ao::::::r))lenrjoinrs r descriptionzEnvelope.description%sE  OOOO II::tz::: : : : :  rcj|tt|ddS)Njsoneventpayloadtypeadd_itemItem PayloadRef)rr*s r add_eventzEnvelope.add_event-s4 d:5#9#9#9HHHIIIIIrcj|tt|ddS)Nr( transactionr+r.)rr4s radd_transactionzEnvelope.add_transaction3s4 d:;#?#?#?mTTTUUUUUrct|tr|}|t t |ddS)Nr(sessionr+) isinstancerto_jsonr/r0r1)rr7s r add_sessionzEnvelope.add_session9sU gw ' ' (oo''G d:7#;#;#;)LLLMMMMMrc:|j|dSr)rappend)ritems rr/zEnvelope.add_itemAs  $rcN|jD]}|}||cSdSr)r get_event)rrr*s rr?zEnvelope.get_eventGs;Z  EOO%%E  !trcN|jD]}|}||cSdSr)rget_transaction_event)rr=r*s rrAzEnvelope.get_transaction_eventOs=J  D..00E  !trc*t|jSr)iterrr%s r__iter__zEnvelope.__iter__WsDJrc|t|j|d|jD]}||dS)N )writerrrserialize_into)rfr=s rrHzEnvelope.serialize_into[sa  4<(())) J # #D    " " " " # #rcztj}|||SrioBytesIOrHgetvaluerouts r serializezEnvelope.serialized/jll C   ||~~rctj|}g} t|}|n||3|||S)Nrr)r)loadsreadliner0deserialize_fromr<)clsrIrrr=s rrXzEnvelope.deserialize_fromjsn *QZZ\\** ((++D| LL      s7%0000rcP|tj|SrrXrLrMrYbytess r deserializezEnvelope.deserializex" ##BJu$5$5666rc(d|jd|jdS)NzrUr%s r__repr__zEnvelope.__repr__s37<<<LLr)NN)__name__ __module__ __qualname__rpropertyr&r2r5r:r/r?rArDrHrQ classmethodrXr^rbrrrrs%      X JJJ VVV NNN      ###  1 1[ 177[7 MMMMMrrc>eZdZ ddZdZedZdZdS)r1Nc0||_||_||_dSr)r)r]path)rr]rkr)s rrzPayloadRef.__init__s   rcV|j|jmt5t|jd5}||_dddn #1swxYwYdddn #1swxYwYn(|jt |j|_nd|_|jS)Nrbr)r]rkropenreadr)r)rrIs r get_byteszPayloadRef.get_bytess : y$022..di...!%&VVXX ..............................&' 22   zs4A0A A0A A0 A !A00A47A4c|jdS|jP|j}t|tr|dd}t j|d}|r|SdS)Nzapplication/jsonutf-8replacerzapplication/octet-stream)r)rkr8r]decode mimetypes guess_type)rrktys rinferred_content_typez PayloadRef.inferred_content_typesn 9 %% Y "9D$&& 7{{7I66%d++A.B  ))rcd|jdS)Nz >>>>rr1ceZdZ d dZdZedZedZdZdZ dZ d Z d Z e d Ze d ZdS)r0NcX|t|}n|i}||_t|trt |}n;t|t r$t |d}n|}|||d<|||d<|||d<nd|vr |j|d<||_dS)N)r]rrfilenamer- content_type) rrr8r]r1rencoderxr,)rr,rr-r}r|s rrz Item.__init__s  7mmGG _G gu % %  w///GG  + +  w~~g'>'>???GGG  "*GJ   "GFO  #&2GN # # 7 * *&-&CGN # rc8d|jd|jd|jdS)NzQ>Q.R.R.RSSSBBWg666B  rcP|tj|Srr[r\s rr^zItem.deserialize#r_r)NNNN)rcrdrerrbrfr-rrpr?rArHrQrgrXr^rhrrr0r0s  >   ((X(  X (((    ["77[777rr0)rLr)rusentry_sdk._compatrsentry_sdk._typesrsentry_sdk.sessionsrsentry_sdk.utilsrrtypingrr r r r r rrobjectrr1r0rhrrrs ((((((""""""''''''DDDDDDDD;::::::::lMlMlMlMlMvlMlMlM^)>)>)>)>)>)>)>)>Xx7x7x7x7x76x7x7x7x7x7r