+
    Îij                     R    R t ^ RIt^ RIHtHt R R ltR R ltR R ltR	 R
 ltR# )a	  
Given a list of integers, made up of (hopefully) a small number of long runs
of consecutive integers, compute a representation of the form
((start1, end1), (start2, end2) ...). Then answer the question "was x present
in the original list?" in time O(log(# runs)).
N)ListTuplec                `    V ^8  d   QhR\         \        ,          R\        \        R3,          /# )   list_return.)r   intr   )formats   "]/Users/ahmad/.openclaw/workspace/scripts/.venv/lib/python3.14/site-packages/idna/intranges.py__annotate__r      s&      tCy U38_     c                h   \        V 4      p. pRp\        \        V4      4       F  pV^,           \        V4      8  d$   W,          W^,           ,          ^,
          8X  d   K=  W^,           V^,            pVP                  \	        V^ ,          VR,          ^,           4      4       TpK  	  \        V4      # )a  Represent a list of integers as a sequence of ranges:
((start_0, end_0), (start_1, end_1), ...), such that the original
integers are exactly those x such that start_i <= x < end_i for some i.

Ranges are encoded as single integers (start << 32 | end), not as tuples.
)sortedrangelenappend_encode_rangetuple)r   sorted_listranges
last_writeicurrent_ranges   &     r
   intranges_from_listr      s     -KFJ3{#$q53{##~U!3a!77#NQU;mM!$4mB6G!6KLM
 % =r   c                <    V ^8  d   QhR\         R\         R\         /# )r   startendr   )r   )r	   s   "r
   r   r   "   s!       3 3 r   c                 "    V ^ ,          V,          # )     )r   r   s   &&r
   r   r   "   s    RK3r   c                R    V ^8  d   QhR\         R\        \         \         3,          /# )r   rr   )r   r   )r	   s   "r
   r   r   &   s"     , ,S ,U38_ ,r   c                 &    V ^ ,	          V R,          3# )r   l    r    )r"   s   &r
   _decode_ranger$   &   s    GqM*++r   c                V    V ^8  d   QhR\         R\        \         R3,          R\        /# )r   int_r   .r   )r   r   bool)r	   s   "r
   r   r   *   s)      C sCx T r   c                   \        V ^ 4      p\        P                  ! W4      pV^ 8  d-   \        W^,
          ,          4      w  rEY@u;8:  d
   V8  d    R#  V\	        V4      8  d   \        W,          4      w  rFW@8X  d   R# R# )z=Determine if `int_` falls into one of the ranges in `ranges`.TF)r   bisectbisect_leftr$   r   )r&   r   tuple_posleftright_s   &&     r
   intranges_containr0   *   ss    4#F


V
,C Qw#F7O4%   S[,<r   )	__doc__r)   typingr   r   r   r   r$   r0   r    r   r
   <module>r3      s&     ,,r   