ó
    Ð]jö  ã                  óL   • S SK Jr  S SKrS SKJs  Jr  S SKJ	r	  S SK
Jr  SS jrg)é    )ÚannotationsN)ÚRandom)ÚCallablec                ó–   • U" 5       R                  SSS9nU R                  S5      R                  SSS9n[        R                  X#-   SS9$ )aÖ  Generate an integer ULID compatible with UUID v4.

ULIDs as defined by the [spec](https://github.com/ulid/spec) look like this:

 01AN4Z07BY      79KA1307SR9X4MV3
|----------|    |----------------|
 Timestamp         Randomness
 48bits            80bits

In the future it would be nice to make this compatible with a UUID,
e.g. v4 UUIDs by setting the version and variant bits correctly.
We can't currently do this because setting these bits would leave us with only 7 bytes of randomness,
which isn't enough for the Python SDK's sampler that currently expects 8 bytes of randomness.
In the future OTEL will probably adopt https://www.w3.org/TR/trace-context-2/#random-trace-id-flag
which relies only on the lower 7 bytes of the trace ID, then all SDKs and tooling should be updated
and leaving only 7 bytes of randomness should be fine.

Right now we only care about:
- Our SDK / Python SDK's in general.
- The OTEL collector.

And both behave properly with 8 bytes of randomness because trace IDs were originally 64 bits
so to be compatible with old trace IDs nothing in OTEL can assume >8 bytes of randomness in trace IDs
unless they generated the trace ID themselves (e.g. the Go SDK _does_ expect >8 bytes of randomness internally).
é   Úbig)Ú	byteorderéP   é
   )Úto_bytesÚgetrandbitsÚintÚ
from_bytes)ÚrandomÚms_timestamp_generatorÚ	timestampÚ
randomnesss       ÚS/home/mande/repo/quber/.venv/lib/python3.13/site-packages/logfire/_internal/ulid.pyÚulidr      sR   € ñ: 'Ó(×1Ñ1°!¸uÐ1ÐE€Ià×#Ñ# BÓ'×0Ñ0°¸uÐ0ÐE€Jä�>‰>˜)Ñ0¸Eˆ>ÐBÐBó    )r   r   r   zCallable[[], int]Úreturnr   )Ú
__future__r   ÚbuiltinsÚ@py_builtinsÚ_pytest.assertion.rewriteÚ	assertionÚrewriteÚ
@pytest_arr   r   Útypingr   r   © r   r   Ú<module>r!      s   ðÝ "ç  „ Õ Ý õ!Cr   