Ë
    Ü_Ëi�  ã                  óR   — d Z ddlmZ ddlmZ ddlmZmZmZm	Z	m
Z
  G d„ de«      Zy)z/Tools for representing JavaScript code in BSON.é    )Úannotations)ÚMapping)ÚAnyr   ÚOptionalÚTypeÚUnionc                  óv   — e Zd ZU dZdZded<   	 d	 	 	 	 	 	 	 	 	 dd„Zedd„«       Zdd	„Z	dd
„Z
dZded<   dd„Zy)ÚCodeaG  BSON's JavaScript code type.

    Raises :class:`TypeError` if `code` is not an instance of
    :class:`str` or `scope` is not ``None`` or an instance
    of :class:`dict`.

    Scope variables can be set by passing a dictionary as the `scope`
    argument or by using keyword arguments. If a variable is set as a
    keyword argument it will override any setting for that variable in
    the `scope` dictionary.

    :param code: A string containing JavaScript code to be evaluated or another
        instance of Code. In the latter case, the scope of `code` becomes this
        Code's :attr:`scope`.
    :param scope: dictionary representing the scope in which
        `code` should be evaluated - a mapping from identifiers (as
        strings) to values. Defaults to ``None``. This is applied after any
        scope associated with a given `code` above.
    :param kwargs: scope variables can also be passed as
        keyword arguments. These are applied after `scope` and `code`.

    .. versionchanged:: 3.4
      The default value for :attr:`scope` is ``None`` instead of ``{}``.

    é   zUnion[Mapping[str, Any], None]Ú_Code__scopeNr   c                óä  — t        |t        «      st        dt        |«      › �«      ‚t        j	                  | |«      }	 |j
                  |_        |�Vt        |t        «      st        dt        |«      › �«      ‚|j                  �|j                  j                  |«       n||_        |r0|j                  �|j                  j                  |«       |S ||_        |S # t        $ r
 d |_        Y Œžw xY w)Nz%code must be an instance of str, not z'scope must be an instance of dict, not )
Ú
isinstanceÚstrÚ	TypeErrorÚtypeÚ__new__Úscoper   ÚAttributeErrorÚ_MappingÚupdate)ÚclsÚcoder   ÚkwargsÚselfs        úL/var/www/pod-logistic/pod-api/venv/lib/python3.12/site-packages/bson/code.pyr   zCode.__new__4   sÝ   € ô ˜$¤Ô$ÜÐCÄDÈÃJÀ<ÐPÓQÐQä�{‰{˜3 Ó%ˆð	 ØŸ:™:ˆDŒLð ÐÜ˜e¤XÔ.ÜÐ"IÌ$ÈuË+ÈÐ WÓXÐXØ�|‰|Ð'Ø—‘×#Ñ# EÕ*à$�”áØ�|‰|Ð'Ø—‘×#Ñ# FÔ+ð ˆð  &�”àˆøô# ò 	 ØˆDŽLð	 ús   ¿C ÃC/Ã.C/c                ó   — | j                   S )z/Scope dictionary for this instance or ``None``.)r   ©r   s    r   r   z
Code.scopeT   s   € ð �|‰|Ðó    c                óN   — dt         j                  | «      › d| j                  ›d�S )NzCode(z, ú))r   Ú__repr__r   r   s    r   r!   zCode.__repr__Y   s&   € Ø”s—|‘| DÓ)Ð*¨"¨T¯\©\Ð,<¸AÐ>Ð>r   c                ó‚   — t        |t        «      r/| j                  t        | «      f|j                  t        |«      fk(  S y)NF)r   r
   r   r   ©r   Úothers     r   Ú__eq__zCode.__eq__\   s4   € Ü�eœTÔ"Ø—L‘L¤# d£)Ð,°·±ÄÀEÃ
Ð0KÑKÐKØr   Ú__hash__c                ó   — | |k(   S ©N© r#   s     r   Ú__ne__zCode.__ne__c   s   € Ø˜5‘=Ð Ð r   r(   )
r   z
Type[Code]r   zUnion[str, Code]r   úOptional[Mapping[str, Any]]r   r   Úreturnr
   )r,   r+   )r,   r   )r$   r   r,   Úbool)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú_type_markerÚ__annotations__r   Úpropertyr   r!   r%   r&   r*   r)   r   r   r
   r
      s|   … ñð4 €LØ+Ó+ð
 .2ðØðàðð +ðð ð	ð
 
óð@ òó ðó?óð
 €HˆcÓô!r   r
   N)r1   Ú
__future__r   Úcollections.abcr   r   Útypingr   r   r   r   r   r
   r)   r   r   ú<module>r8      s$   ðñ 6Ý "å /ß 6Õ 6ôN!ˆ3õ N!r   