ó
    öÞ jû  ã                  óf  • % S r SSKJr  SSKrSSKrSSKJrJr  SSKJ	r	  SSK
Jr  SSKrSSK
JrJrJr  S	r\" \5      r\R&                  " S
5      rS\S
'   \R&                  " S5      rS\S'   0 rS\S'   SS jrSS jr        SS jrSS jrSS jrSS jrSS jr\R>                  SS j5       r g) a°  
Primitives to deal with a concurrency supporting context, as introduced in
Python 3.7 as :mod:`contextvars`.

.. versionadded:: 20.1.0
.. versionchanged:: 21.1.0
   Reimplemented without using a single dict as context carrier for improved
   isolation. Every key-value pair is a separate `contextvars.ContextVar` now.
.. versionchanged:: 23.3.0
   Callsite parameters are now also collected under asyncio.

See :doc:`contextvars`.
é    )ÚannotationsN)Ú	GeneratorÚMapping)Ú	FrameType)ÚAnyé   )ÚBindableLoggerÚ	EventDictÚWrappedLoggerÚ
structlog_Ú_ASYNC_CALLING_STACKz!contextvars.ContextVar[FrameType]Ú_ASYNC_CALLING_THREADz'contextvars.ContextVar[tuple[int, str]]z&dict[str, contextvars.ContextVar[Any]]Ú_CONTEXT_VARSc                 óÚ   • 0 n [         R                  " 5       nU HM  nUR                  R                  [        5      (       d  M)  X   [
        Ld  M6  X   XR                  [        S '   MO     U $ )z\
Return a copy of the *structlog*-specific context-local context.

.. versionadded:: 21.2.0
N)ÚcontextvarsÚcopy_contextÚnameÚ
startswithÚSTRUCTLOG_KEY_PREFIXÚEllipsisÚSTRUCTLOG_KEY_PREFIX_LEN)ÚrvÚctxÚks      ÚO/var/www/html/gaurav/venv/lib/python3.13/site-packages/structlog/contextvars.pyÚget_contextvarsr   5   s^   € ð 
€BÜ
×
"Ò
"Ó
$€CãˆØ�6‰6×ÑÔ1×2Ó2°s±vÄXÔ7MØ47±FˆB�v‰vÔ.Ð/Ð0Ó1ñ ð €Ió    c                ód   • [        5       nUR                  [        R                  " U 5      5        U$ )z{
Return a copy of the current context-local context merged with the context
from *bound_logger*.

.. versionadded:: 21.2.0
)r   ÚupdateÚ	structlogÚget_context)Úbound_loggerr   s     r   Úget_merged_contextvarsr#   E   s(   € ô Ó
€CØ‡J�JŒy×$Ò$ \Ó2Ô3à€Jr   c                óò   • [         R                  " 5       nU H[  nUR                  R                  [        5      (       d  M)  X4   [
        Ld  M6  UR                  UR                  [        S X4   5        M]     U$ )a  
A processor that merges in a global (context-local) context.

Use this as your first processor in :func:`structlog.configure` to ensure
context-local context is included in all log calls.

.. versionadded:: 20.1.0
.. versionchanged:: 21.1.0 See toplevel note.
N)r   r   r   r   r   r   Ú
setdefaultr   )ÚloggerÚmethod_nameÚ
event_dictr   r   s        r   Úmerge_contextvarsr)   R   sb   € ô ×
"Ò
"Ó
$€CãˆØ�6‰6×ÑÔ1×2Ó2°s±vÄXÔ7MØ×!Ñ! !§&¡&Ô)AÐ)BÐ"CÀSÁVÖLñ ð Ðr   c                 ó¶   • [         R                  " 5       n U  H>  nUR                  R                  [        5      (       d  M)  UR                  [        5        M@     g)zÃ
Clear the context-local context.

The typical use-case for this function is to invoke it early in request-
handling code.

.. versionadded:: 20.1.0
.. versionchanged:: 21.1.0 See toplevel note.
N)r   r   r   r   r   Úsetr   )r   r   s     r   Úclear_contextvarsr,   g   s=   € ô ×
"Ò
"Ó
$€CÛˆØ�6‰6×ÑÔ1×2Ó2Ø�E‰E”(ŽOò r   c                 óî   • 0 nU R                  5        H,  u  p#[         U 3n [        U   nUR                  U5      X'   M.     U$ ! [         a%    [        R
                  " U[        S9nU[        U'    NGf = f)aÜ  
Put keys and values into the context-local context.

Use this instead of :func:`~structlog.BoundLogger.bind` when you want some
context to be global (context-local).

Return the mapping of `contextvars.Token`\s resulting
from setting the backing :class:`~contextvars.ContextVar`\s.
Suitable for passing to :func:`reset_contextvars`.

.. versionadded:: 20.1.0
.. versionchanged:: 21.1.0 Return the `contextvars.Token` mapping
    rather than None. See also the toplevel note.
)Údefault)Úitemsr   r   ÚKeyErrorr   Ú
ContextVarr   r+   )Úkwr   r   ÚvÚstructlog_kÚvars         r   Úbind_contextvarsr6   w   s~   € ð 
€BØ—‘–
‰ˆÜ-Ð.¨q¨cÐ2ˆð	-Ü Ñ,ˆCð
 —‘˜“
ˆ‹ñ ð €Iøô ó 	-Ü×(Ò(¨¼hÑGˆCØ),ŒM˜+Ó&ð	-ús   £	AÁ,A4Á3A4c                 ó~   • U R                  5        H)  u  p[         U 3n[        U   nUR                  U5        M+     g)zP
Reset contextvars corresponding to the given Tokens.

.. versionadded:: 21.1.0
N)r/   r   r   Úreset)r2   r   r3   r4   r5   s        r   Úreset_contextvarsr9   ”   s:   € ð —‘–
‰ˆÜ-Ð.¨q¨cÐ2ˆÜ˜KÑ(ˆØ�	‰	�!Žò r   c                 óz   • U  H5  n[          U 3nU[        ;   d  M  [        U   R                  [        5        M7     g)a
  
Remove *keys* from the context-local context if they are present.

Use this instead of :func:`~structlog.BoundLogger.unbind` when you want to
remove keys from a global (context-local) context.

.. versionadded:: 20.1.0
.. versionchanged:: 21.1.0 See toplevel note.
N)r   r   r+   r   )Úkeysr   r4   s      r   Úunbind_contextvarsr<       s8   € ó ˆÜ-Ð.¨q¨cÐ2ˆØœ-Õ'Ü˜+Ñ&×*Ñ*¬8Ö4ò r   c               +  ó<  #   • [        5       nUR                  5       U R                  5       -   Vs0 sH  o"X   _M	     nn[        S0 U D6   Sv •  [        U R                  5       6   [        S0 UD6  gs  snf ! [        U R                  5       6   [        S0 UD6  f = f7f)z¼
Bind *kw* to the current context-local context. Unbind or restore *kw*
afterwards. Do **not** affect other keys.

Can be used as a context manager or decorator.

.. versionadded:: 21.4.0
N© )r   r;   r6   r<   )r2   Úcontextr   Úsaveds       r   Úbound_contextvarsrA   °   sˆ   é € ô Ó€GØ$+§L¡L£N°R·W±W³YÒ$>Ó?Ñ$>˜q�‘
Š]Ñ$>€EÐ?äÑ�rÒð"Ûä˜BŸG™G›IÑ&ÜÑ!˜5Ó!ùò @øô 	˜BŸG™G›IÑ&ÜÑ!˜5Ó!üs'   ‚.B°A1½BÁA6 Á'BÁ6#BÂB)Úreturnúdict[str, Any])r"   r	   rB   rC   )r&   r   r'   Ústrr(   r
   rB   r
   )rB   ÚNone)r2   r   rB   z$Mapping[str, contextvars.Token[Any]])r2   zcontextvars.Token[Any]rB   rE   )r;   rD   rB   rE   )r2   r   rB   zGenerator[None, None, None])!Ú__doc__Ú
__future__r   Ú
contextlibr   Úcollections.abcr   r   Útypesr   Útypingr   r    r	   r
   r   r   Úlenr   r1   r   Ú__annotations__r   r   r   r#   r)   r,   r6   r9   r<   ÚcontextmanagerrA   r>   r   r   Ú<module>rO      sá   ðòõ #ã Û ç .Ý Ý ã ç <Ñ <ð $Ð ÙÐ3Ó4Ð ð ×ÒÐ1Ó2ð Ð7ó ð ×ÒÐ2Ó3ð Ð>ó ð 9;€Ð5Ó :ôô 
ðØðØ(+ðØ9Bðàôô*ô ô:	ô5ð  ×Ñó"ó ñ"r   