ó
    üÞ j3  ã                  ón   • S r SSKJr  SSKrSSKrSSKJr	  SSKJ
r  SS jrSS jr      SS	 jr/ S
Qrg)ziPublic UUID v7 helpers.

These helpers expose utilities for generating UUID v7 identifiers in user code.
é    )ÚannotationsNé   )Úuuid7)Úuuid7_deterministicc                 ó   • [        5       $ )zZGenerate a random UUID v7.

Returns:
    uuid.UUID: A random, RFC 9562-compliant UUID v7.
)Ú_uuid7© ó    ÚH/var/www/html/gaurav/venv/lib/python3.13/site-packages/langsmith/uuid.pyr   r      s   € ô ‹8€Or
   c                ó¸   • U R                   c'  U R                  [        R                  R                  S9n [        U R                  5       S-  5      n[        U5      $ )zÃGenerate a UUID v7 from a datetime.

Args:
    dt: A timezone-aware datetime. If naive, it is treated as UTC.

Returns:
    uuid.UUID: A UUID v7 whose timestamp corresponds to the provided time.
)Útzinfoi Êš;)r   ÚreplaceÚ_dtÚtimezoneÚutcÚintÚ	timestampr   )ÚdtÚnanosecondss     r   Úuuid7_from_datetimer      sH   € ð 
‡y�yÑØ�Z‰ZœsŸ|™|×/Ñ/ˆZÐ0ˆÜ�b—l‘l“n }Ñ4Ó5€KÜ�+ÓÐr
   c                óÚ   • [        U[        5      (       a  U(       d  [        S5      e[        R                  " [        U 5      5      nUR
                  S:w  a  [        S5      e[        X!5      $ )ag  Compute the run ID used for a secondary tracing replica.

Args:
    run_id: The original UUID v7 run ID.
    project_name: The secondary replica's destination project name.

Returns:
    uuid.UUID: The run ID used in the secondary replica destination.

Raises:
    ValueError: If ``run_id`` is not UUID v7, or if ``project_name`` is
        empty or invalid.
z'project_name must be a non-empty stringé   zrun_id must be a UUID v7)Ú
isinstanceÚstrÚ
ValueErrorÚ_uuidÚUUIDÚversionÚ_uuid7_deterministic)Úrun_idÚproject_nameÚparsed_run_ids      r   Ú$compute_run_id_for_secondary_replicar#   '   sV   € ô  �l¤C×(Ñ(¶ÜÐBÓCÐCä—J’Jœs 6›{Ó+€MØ×Ñ Ó!ÜÐ3Ó4Ð4Ü Ó<Ð<r
   )r#   r   r   )Úreturnú
_uuid.UUID)r   z_dt.datetimer$   r%   )r    z_uuid.UUID | strr!   r   r$   r%   )Ú__doc__Ú
__future__r   Údatetimer   Úuuidr   Ú_internal._uuidr   r   r   r   r   r#   Ú__all__r	   r
   r   Ú<module>r,      sJ   ðñõ
 #ã Û å ,Ý Hôôð=Øð=Ø,/ð=àô=ò2 S�r
   