
    hj                         S r SSKrSSKJrJr  S\\   S\\S4   4S jrS\S	\S\4S
 jrS\S\\\4   4S jrS\S\\S4   S\	4S jr
g)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Tuplelist_return.c                    [        U 5      n/ nSn[        [        U5      5       HW  nUS-   [        U5      :  a  X   XS-      S-
  :X  a  M'  XS-   US-    nUR                  [	        US   US   S-   5      5        UnMY     [        U5      $ )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.
   r   )sortedrangelenappend_encode_rangetuple)r   sorted_listranges
last_writeicurrent_ranges         @/var/www/html/env/lib/python3.13/site-packages/idna/intranges.pyintranges_from_listr      s     -KFJ3{#$q53{##~U!3a!77#NQU;mM!$4mB6G!6KLM
 % =    startendc                     U S-  U-  $ )N     )r   r   s     r   r   r   "   s    RK3r   rc                     U S-	  U S-  4$ )Nr   l    r   )r   s    r   _decode_ranger   &   s    GqM*++r   int_r   c                     [        U S5      n[        R                  " X5      nUS:  a!  [        XS-
     5      u  pEX@s=::  a  U:  a   g  U[	        U5      :  a  [        X   5      u  pFX@:X  a  gg)z=Determine if `int_` falls into one of the ranges in `ranges`.r   r	   TF)r   bisectbisect_leftr   r   )r    r   tuple_posleftright_s          r   intranges_containr)   *   ss    4#F


V
,C Qw#F7O4%   S[,<r   )__doc__r"   typingr   r   intr   r   r   boolr)   r   r   r   <module>r.      s     tCy U38_ , 3 3 ,S ,U38_ ,C sCx T r   