+
    2jC`                      a  0 t $ R t^ RIHt ^ RIHtHtHtHtH	t	 ^RI
Ht ^RIHtHt ]'       d   ^ RIHt ]P"                  t]P&                  t]P*                  t]P.                  t. ROt ! R	 R
4      t ! R R4      t]! 4       t]! 4       t]tR]R&   ] ]]!]]!3,          t"R]R&   R R lt#R R lt$R R lt%R R lt&R R lt' ! R R]],          4      t(R R lt)R# )a   Generic version range with interval operations.

A Range represents a set of versions as a canonical list of intervals; see
``Range.__init__`` for what makes a list canonical. Supports intersection,
union, complement, and containment.

This is equivalent to pubgrub-rs's ``version_ranges::Ranges<V>``:
https://github.com/pubgrub-rs/pubgrub/tree/release/version-ranges

The type parameter V can be any ordered, hashable type. The simple test
provider uses int; the Python provider uses packaging.version.Version.
)annotations)TYPE_CHECKINGAnyGeneric	TypeAliascast)override)RangeRelationVersionType)IterableBoundIntervalRangec                      ] tR t^(tRtR R ltR R ltR R ltR R	 lt]	R
 R l4       t
]	R R l4       t]	R R l4       tRtR# )_NegativeInfinityzSentinel that sorts before every version.

Used as the lower bound of unbounded intervals like ``(-inf, 5)``.
Use the module-level ``NEGATIVE_INFINITY`` constant, not this class.
c                    V ^8  d   QhRRRR/#    otherobjectreturnbool )formats   "^/home/user/billing-ledger-validation/.venv/lib/python3.14/site-packages/nab_resolver/ranges.py__annotate___NegativeInfinity.__annotate__/        8 8F 8t 8    c                	,    \        V\        4      '       * # N
isinstancer   selfr   s   &&r   __lt___NegativeInfinity.__lt__/       e%6777r   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   r   2         F t r   c                	    R # Tr   r#   s   &&r   __le___NegativeInfinity.__le__2       r   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   r   5         F t r   c                	    R # Fr   r#   s   &&r   __gt___NegativeInfinity.__gt__5       r   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   r   8        4 4F 4t 4r   c                	"    \        V\        4      # r    r!   r#   s   &&r   __ge___NegativeInfinity.__ge__8       %!233r   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   r   <        4 4F 4t 4r   c                "    \        V\        4      # z+Test equality by comparing interval tuples.r!   r#   s   &&r   __eq___NegativeInfinity.__eq__;        %!233r   c                   V ^8  d   QhRR/# r   r   intr   )r   s   "r   r   r   A        ) )# )r   c                    \        R4      # )Hash based on interval tuples.r   hashr$   s   &r   __hash___NegativeInfinity.__hash__@        '((r   c                   V ^8  d   QhRR/# r   r   strr   )r   s   "r   r   r   F         # r   c                	    R # )z-infr   rK   s   &r   __repr___NegativeInfinity.__repr__E       r   r   N__name__
__module____qualname____firstlineno____doc__r%   r,   r3   r9   r   r@   rL   rT   __static_attributes__r   r   r   r   r   (   sW    84 4 4 ) )  r   r   c                      ] tR t^JtRtR R ltR R ltR R ltR R	 lt]	R
 R l4       t
]	R R l4       t]	R R l4       tRtR# )_PositiveInfinityzSentinel that sorts after every version.

Used as the upper bound of unbounded intervals like ``[5, +inf)``.
Use the module-level ``POSITIVE_INFINITY`` constant, not this class.
c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   _PositiveInfinity.__annotate__Q   r0   r   c                	    R # r2   r   r#   s   &&r   r%   _PositiveInfinity.__lt__Q   r5   r   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   ra   T   r7   r   c                	"    \        V\        4      # r    r"   r_   r#   s   &&r   r,   _PositiveInfinity.__le__T   r;   r   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   ra   W   r   r   c                	,    \        V\        4      '       * # r    rf   r#   s   &&r   r3   _PositiveInfinity.__gt__W   r'   r   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   ra   Z   r)   r   c                	    R # r+   r   r#   s   &&r   r9   _PositiveInfinity.__ge__Z   r.   r   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   ra   ^   r=   r   c                "    \        V\        4      # r?   rf   r#   s   &&r   r@   _PositiveInfinity.__eq__]   rB   r   c                   V ^8  d   QhRR/# rD   r   )r   s   "r   r   ra   c   rF   r   c                    \        R4      # )rH   r_   rI   rK   s   &r   rL   _PositiveInfinity.__hash__b   rN   r   c                   V ^8  d   QhRR/# rP   r   )r   s   "r   r   ra   h   rR   r   c                	    R # )z+infr   rK   s   &r   rT   _PositiveInfinity.__repr__g   rV   r   r   NrW   r   r   r   r_   r_   J   sW    48 4 4 ) )  r   r_   r   c               $    V ^8  d   QhRRRRRR/# r   leftr   rightr   ztuple[Bound, bool]r   )r   s   "r   r   r   u   "     
& 
&8 
&H 
&9K 
&r   c                    V ^ ,          V ^,          r2V^ ,          V^,          rTW$8X  d   Y#;'       d    T3# V\         J g   V\         Jd
   W$8  d   WE3# W#3# )z9Return the higher of two lower bounds (for intersection).NEGATIVE_INFINITY)ry   rz   
left_lowerleft_lower_incright_lowerright_lower_incs   &&    r   _max_lower_boundr   u   `    !%a$q'#(8U1X ==o==&&,,1I++%%r   c               $    V ^8  d   QhRRRRRR/# rx   r   )r   s   "r   r   r      r{   r   c                    V ^,          V ^,          r2V^,          V^,          rTW$8X  d   Y#;'       d    T3# V\         J g   V\         Jd
   W$8  d   WE3# W#3# )z8Return the lower of two upper bounds (for intersection).POSITIVE_INFINITY)ry   rz   
left_upperleft_upper_incright_upperright_upper_incs   &&    r   _min_upper_boundr      r   r   c               $    V ^8  d   QhRRRRRR/# )r   intervalr   r   r   r   r   )r   s   "r   r   r      s!     	 	8 	H 	 	r   c                    V ^,          V ^,          r2V^ ,          V^,          rTV\         J g   V\        J d   R# W$8X  d   T;'       d    T'       * # \        W$8  4      # )zCReturn whether ``interval`` finishes below everything in ``other``.F)r   r~   r   )r   r   upperupper_inclusivelowerlower_inclusives   &&    r   _ends_beforer      sW    %a[(1+?"1XuQx?!!U.?%?~#7788r   c               $    V ^8  d   QhRRRRRR/# )r   ry   r   rz   r   r   r   )r   s   "r   r   r      s!     + + + +d +r   c                |    V ^,          pV^,          pV\         J d	   V\         J # V\         J d   R# \        W#8*  4      # )zReturn whether a walk over two interval lists should step ``left``.

Whichever interval ends first cannot meet anything further along the other
list, so it is the one to retire.
T)r   r   )ry   rz   r   r   s   &&  r   _advance_leftr      sE     aJ(K&&///''
)**r   c          
     ,    V ^8  d   QhRRRRRRRRRR/# )r   r   r   r   r   r   r   r   r   )r   s   "r   r   r      sC     H HH H 	H
 H 
Hr   c               x    V \         J g   V\        J d   R# W8  d   R# W8H  ;'       d    T;'       d    T'       * # )z1Return True if the interval contains no versions.FTr~   r   )r   r   r   r   s   &$$$r   _interval_is_emptyr      s;     !!U.?%?}>GG?#F#FGGr   c                     ] tR t^tRtR8tR:R R llt]R R l4       t]R R l4       t	]R R	 l4       t
]R
 R l4       t]R R l4       t]R R l4       t]R R l4       t]R R l4       t]R R l4       t]R R l4       tR R ltR R ltR R ltR R ltR  R! ltR" R# ltR$ R% ltR& R' ltR( R) lt]R* R+ l4       t]R, R- l4       tR. R/ ltR0 R1 lt ]R2 R3 l4       t!]R4 R5 l4       t"R6 R7 lt#R8t$R9# );r   aP  A set of versions represented as a canonical list of intervals.

Modeled after pubgrub-rs ``version_ranges::Ranges<V>``:
https://docs.rs/version-ranges/latest/version_ranges/struct.Ranges.html

Each interval is ``(lower, lower_inclusive, upper, upper_inclusive)``.
See :meth:`__init__` for the invariant the interval list must satisfy.
c                    V ^8  d   QhRRRR/# )r   	intervalstuple[Interval, ...]r   Noner   )r   s   "r   r   Range.__annotate__   s      "6  r   c                     Wn         ^ V n        R# )ax  Create a range from intervals that already satisfy the invariant.

The intervals must be sorted by lower bound, must not overlap or
touch, must each hold at least one version, and must be exclusive at
``NEGATIVE_INFINITY`` and ``POSITIVE_INFINITY``.  Every operator
returns through here, so this neither checks nor normalizes: the
classmethods and the operators maintain the invariant, and a caller
that assembles its own tuple owns it.

Equality and hashing compare interval tuples, so two lists denoting
the same set must be the same list, and
``((1, True, 2, False), (2, True, 3, True))`` is not a legal way to
write ``[1, 3]``.
N
_intervals_hash)r$   r   s   &&r   __init__Range.__init__   s     $
r   c                   V ^8  d   QhRR/# r   r   Range[VersionType]r   )r   s   "r   r   r      s      ( r   c                    V ! R4      # )z&Create a range containing no versions.r   r   clss   &r   emptyRange.empty   s     2wr   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r      s     L L' Lr   c                ,    V ! \         R\        R334      # )z]Create a range containing all versions.

Mirrors :meth:`packaging.ranges.VersionRange.full`.
Fr   r   s   &r   full
Range.full   s     &/@%HJKKr   c                    V ^8  d   QhRRRR/# r   versionr
   r   r   r   )r   s   "r   r   r      s     6 6 60B 6r   c                    V ! VRVR334      # )zCreate a range containing exactly one version.

Mirrors :meth:`packaging.ranges.VersionRange.singleton`.
For a set of versions use :meth:`from_versions`.
Tr   r   r   s   &&r   	singletonRange.singleton   s     WdGT2455r   c                    V ^8  d   QhRRRR/# )r   versionszIterable[VersionType]r   r   r   )r   s   "r   r   r      s      R R%: R?Q Rr   c                    \        \        \        RV4      4      4      pT ! \        ;QJ d    . R V 4       F  NK  	  54      # ! R V 4       4      4      # )a9  Create a range holding exactly the given versions.

The iterable is consumed once and equal versions collapse.
Distinct versions never merge: a range has no notion of one
version following another, so the result still excludes
everything strictly between them.

Cheaper than folding :meth:`singleton` with ``|``.
zIterable[Any]c              3  ,   "   T F
  qR VR 3x  K  	  R# 5i)TNr   ).0r   s   & r   	<genexpr>&Range.from_versions.<locals>.<genexpr>   s     PxG4$7xs   )sortedsetr   tuple)r   r   distincts   && r   from_versionsRange.from_versions   sD     #d?H=>?55PxP5QQ5PxPPQQr   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   r      s     A A{ A/A Ar   c                $    V ! VR\         R334      # )zCreate ``[version, +inf)``.TFr   r   s   &&r   at_leastRange.at_least   s     Wd$5u=?@@r   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   r     s     B B; B3E Br   c                $    V ! VR\         R334      # )zCreate ``(version, +inf)``.Fr   r   s   &&r   greater_thanRange.greater_than  s     We%6>@AAr   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   r     s     A Ak A.@ Ar   c                $    V ! \         RVR334      # )zCreate ``(-inf, version]``.FTr}   r   s   &&r   at_mostRange.at_most  s     &w=?@@r   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   r     s     B B B0B Br   c                $    V ! \         RVR334      # )zCreate ``(-inf, version)``.Fr}   r   s   &&r   	less_thanRange.less_than  s     &w>@AAr   c               $    V ^8  d   QhRRRRRR/# )r   r   r
   r   r   r   r   )r   s   "r   r   r     s"     3 3K 3 3@R 3r   c                V    \        VRVRR7      '       d	   V ! R4      # V ! VRVR334      # )zDCreate ``[lower, upper)``, or the empty range if ``lower >= upper``.TFr   r   r   r   )r   )r   r   r   s   &&&r   betweenRange.between  s<     4ue
 
 r7NUD%/122r   c                   V ^8  d   QhRR/# r   r   r   r   )r   s   "r   r   r     s     ) )$ )r   c                2    \        V P                  4      ^ 8H  # )z,``True`` if this range contains no versions.)lenr   rK   s   &r   is_emptyRange.is_empty  s     4??#q((r   c                    V ^8  d   QhRRRR/# )r   r   r   r   r   r   )r   s   "r   r   r     s      F t r   c                    V P                    FG  w  r#rEV\        Jd   W8  g   W8X  d   V'       g   K&  V\        Jd   W8  g   W8X  d   V'       g   KF   R# 	  R# )z-Test whether version falls within this range.TF)r   r~   r   )r$   r   r   r   r   r   s   &&    r   __contains__Range.__contains__  sN    >Boo:EE--G$4_--G$4_ ?N r   c                    V ^8  d   QhRRRR/# r   r   r   r   r   r   )r   s   "r   r   r   ,  s     ($ ($V ($(: ($r   c                \   \        V\        4      '       g   \        # . p^ ;r4V\        V P                  4      8  d   V\        VP                  4      8  d   V P                  V,          pVP                  V,          p\        WV4      w  rx\        WV4      w  r\        VVV	V
R7      '       g   VP                  WxW34       V^,          pV^,          pW8X  d   V^,          pV^,          pK  V\        J g   V\        Jd   W8  d   V^,          pK  V^,          pK  \        \        V4      4      # )z:Compute the intersection of two ranges (versions in both).r   )r"   r   NotImplementedr   r   r   r   r   appendr   r   )r$   r   result
left_indexright_indexleft_intervalright_intervalinter_lowerinter_lower_incinter_upperinter_upper_incr   r   s   &&           r   __and__Range.__and__,  s   %''!!!##$$
3t//K#eFVFVBW4W OOJ7M"--k:N+;,(K ,<,(K & /! /	   ;P
 'q)J(+K(a
q 00#449Qq a
U6]##r   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   r   V  s     : :F :'9 :r   c                    \        V\        4      '       g   \        # \        V P                  4      \        VP                  4      ,           p\        \        V4      4      # )z)Union of two ranges (versions in either).)r"   r   r   listr   _normalize_intervals)r$   r   all_intervalss   && r   __or__Range.__or__V  sD    %''!!T__-U5E5E0FF)-899r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r   ]  s     0$ 0$. 0$r   c                   V P                   '       d   \        P                  4       # . p\        pRpV P                   F  w  rErgV\        Jg   V\        Jdv   TpV'       * ;'       d	    V\        Jp	Tp
V'       * ;'       d	    V\
        JpV\        J g'   V
\
        J g   W8  g   W8X  d$   V	'       d   V'       d   VP                  WW34       TpTpK  	  V\
        Jd   VP                  W#'       * \
        R34       \        \        V4      4      # )z(Complement (versions NOT in this range).F)r   r   r   r~   r   r   r   r   )r$   r   previous_upperprevious_upper_inclusiver   r   r   r   	gap_lowergap_lower_inclusive	gap_uppergap_upper_inclusives   &           r   
__invert__Range.__invert__]  s   ===::<!# 1#( >Boo:EE &77 11*	00 @ @&.?? $ "	''JJE9J,J $
 !22 $55 ,!.// MM"X #N'6$? ?ND !22MM!=?PRWX U6]##r   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   r     s     H$ H$V H$(: H$r   c                   \        V\        4      '       g   \        # VP                  p\	        V4      p. p^ pV P                   EF  pVw  rxrWS8  d$   \        W%,          V4      '       d   V^,          pK)  RpTpW8  d   W,,          p\        Wm4      '       d   MzVw  rppV\        Jd3   \        VVVV'       * R7      '       g   VP                  WxW'       * 34       V\        J d   RpM+TV'       * r\        VVV	V
R7      '       d   RpMV^,          pK  V'       d   K  \        VVV	V
R7      '       d   K  VP                  WxW34       EK  	  \        \        V4      4      # )zSet difference: versions in self but not in other.

Carves each of this range's intervals against ``other``'s in a single
walk of both lists, so the complement of ``other`` is never built.
Fr   T)r"   r   r   r   r   r   r~   r   r   r   r   )r$   r   right_intervalsright_countr   r   ry   r   r   r   r   fully_coveredscanrz   r   r   r   r   s   &&                r   __sub__Range.__sub__  s{    %''!!**/*!#OOD=A:EE +,d1 1 q !MD$'-  ,,MRJk? &77@R$3%(7$7	A A MM>QR "33$(M *5/6I%$3$3	  %)M	 =); / /	* * uuNOq $t U6]##r   c                    V ^8  d   QhRRRR/# r   r   r   r   r   r   )r   s   "r   r   r     s      1 d r   c                   VP                   p\        V4      p^ pV P                    Fc  pWC8  d$   \        W$,          V4      '       d   V^,          pK)  WC8  d    R# W$,          p\        WV4      w  rx\	        WV4      w  rWxW3V8w  g   Kb   R# 	  R# )a/  Return whether every version in self is also in other.

Walks both interval lists once and stops at the first uncovered
interval.  This leans on the invariant: consecutive intervals in
``other`` always leave a gap, so an interval of self is covered only
when a single interval of other holds all of it.
FT)r   r   r   r   r   )r$   r   r  r  r   ry   rz   r   r   r   r   s   &&         r   	is_subsetRange.is_subset  s      **/*OOD+,d1 1 q )#0E%5d%B"E%5d%B"E?4G $  r   c                    V ^8  d   QhRRRR/# r  r   )r   s   "r   r   r     s     % %!3 % %r   c                $    VP                  V 4      # )z6Return whether every version in other is also in self.)r  r#   s   &&r   is_supersetRange.is_superset  s    t$$r   c                    V ^8  d   QhRRRR/# r  r   )r   s   "r   r   r     s        !3    r   c                P   V P                   pVP                   p\        V4      p\        V4      p^ ;rgWd8  do   Wu8  di   W&,          pW7,          p	\        W4      w  r\        W4      w  r\	        V
VVVR7      '       g   R# \        W4      '       d   V^,          pKi  V^,          pKt  R# )zReturn whether self and other share no version.

Stops at the first shared version rather than building the whole
intersection.
r   FT)r   r   r   r   r   r   )r$   r   left_intervalsr  
left_countr  r   r   ry   rz   r   r   r   r   s   &&            r   is_disjointRange.is_disjoint  s     **(
/*#$$
%+*C!-D#0E%5d%B"E%5d%B"E% / /	  T))a
q r   c                    V ^8  d   QhRRRR/# )r   r   r   r   r	   r   )r   s   "r   r   r     s        0  ]  r   c                    V P                   '       d   \        # V P                  V4      '       d   \        # V P	                  V4      '       d   \
        # \        # )zReturn how self's members sit against other's.

The empty range is both a subset and disjoint, so it is answered ahead
of the walks instead of by running both of them.
)r   
_EMPTY_RELr  _SUBSET_RELr  _DISJOINT_REL_OVERLAPPING_RELr#   s   &&r   relationRange.relation  sE     ===>>%  E""  r   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   r   ,  s     3 3F 3t 3r   c                l    \        V\        4      '       g   \        # V P                  VP                  8H  # r?   )r"   r   r   r   r#   s   &&r   r@   Range.__eq__+  s,     %''!!%"2"222r   c                   V ^8  d   QhRR/# rD   r   )r   s   "r   r   r   3  s      # r   c                v    V P                   pV^ 8X  d&   \        V P                  4      ;'       g    ^pWn         V# )a  Hash the interval tuple once and keep the answer.

A range is immutable and is hashed over and over as a cache key, and
each hash walks every interval and every bound in it.  Zero marks "not
computed yet", so a tuple that really hashes to zero is stored as one.
)r   rJ   r   )r$   cacheds   & r   rL   Range.__hash__2  s4     Q;$//*//aFJr   c                   V ^8  d   QhRR/# )r   r   tuple[tuple[Interval, ...]]r   )r   s   "r   r   r   @  s     	" 	"9 	"r   c                    V P                   3# )am  Return the intervals alone, keeping the memo out of the pickle.

The infinity sentinels hash as plain strings, so a memo computed in
one process is wrong in a process running a different
``PYTHONHASHSEED``.  The wrapping tuple is what makes the empty range
survive: protocols 0 and 1 discard a pickle state that is falsy, and
an empty range's intervals are ``()``.
r   rK   s   &r   __getstate__Range.__getstate__@  s     !!r   c                    V ^8  d   QhRRRR/# )r   stater0  r   r   r   )r   s   "r   r   r   K  s      "= $ r   c                &    Vw  V n         ^ V n        R# )zERestore from :meth:`__getstate__`, leaving the hash to be recomputed.Nr   )r$   r6  s   &&r   __setstate__Range.__setstate__K  s    "
r   c                   V ^8  d   QhRR/# rP   r   )r   s   "r   r   r   Q  s     - -# -r   c                $    RV P                   : R2# )zReturn a debug representation.zRange()r2  rK   s   &r   rT   Range.__repr__P  s     *!,,r   c                   V ^8  d   QhRR/# rP   r   )r   s   "r   r   r   V  s     ! ! !r   c                   V P                   '       d   R# V P                  \        R\        R338X  d   R# . pV P                   Fj  w  r#rEW$8X  d-   V'       d%   V'       d   VP	                  \        V4      4       K8  V'       d   RMRpV'       d   RMRpVP	                  V V RV V 24       Kl  	  R	P                  V4      # )
z'Return a human-readable representation.z<empty>F*[(]r<  z, z | )r   r   r~   r   r   rQ   join)r$   partsr   r   r   r   left_bracketright_brackets   &       r   __str__Range.__str__U  s     ===?? 15:KUSUU>Boo:EE~/oSZ(&5s3'6C~eWBugm_MN ?N zz%  r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r   f  s     ! !$ !r   c                $    V P                   '       * # )z'Return True if this range is non-empty.)r   rK   s   &r   __bool__Range.__bool__f  s    ==  r   )r   r   N)r   )%rX   rY   rZ   r[   r\   	__slots__r   classmethodr   r   r   r   r   r   r   r   r   propertyr   r   r   r   r  r  r  r  r  r&  r   r@   rL   r3  r8  rT   rH  rL  r]   r   r   r   r   r      s}    (I$   L L 6 6 R R A A B B A A B B 3 3 ) )($T:0$dH$T<% D  3 3  	"
 - - ! ! ! !r   c                    V ^8  d   QhRRRR/# )r   r   zlist[Interval]r   r   r   )r   s   "r   r   r   k  s     : :N :7K :r   c                   V '       g   R# R R lpV P                  VR7       V ^ ,          .pV R,           F  w  r4rVVR,          w  rxrV	\        J ;'       g5    V\        J ;'       g%    W8  ;'       g    W8H  ;'       d    T
;'       g    TpV'       dI   V	\        J g   V\        J d
   \        pRpM W8  d   YrMW8X  d   T	pT
;'       g    TpMYVrVVVV3VR&   K  VP                  W4WV34       K  	  \	        V4      # )aO  Sort intervals by lower bound and merge overlapping or adjacent ones.

Order, overlap and touching are all it repairs.  An empty interval, a
reversed one or an inclusive infinity bound comes through untouched unless
a merge happens to absorb or rebuild it, so this is not a way to normalize
a list that breaks the ``Range`` invariant.
c                    V ^8  d   QhRRRR/# )r   r   r   r   ztuple[Any, ...]r   )r   s   "r   r   *_normalize_intervals.<locals>.__annotate__v  s     7 78 7 7r   c                B    V w  rr4V\         J d   R# ^Y'       d   ^ 3# ^3# )    )rV  r}   )r   r   r   _upper_upper_inclusives   &    r   sort_key&_normalize_intervals.<locals>.sort_keyv  s1    ;C8%%K5!66A66r   )key:   NNFr   )sortr   r~   r   r   )r   rY  mergedr   r   r   r   merged_lowermerged_lower_inclusivemerged_uppermerged_upper_inclusiveintervals_overlap	new_uppernew_upper_inclusives   &             r   r   r   k  s3    	7 NNxN 'l^F:CB--62J 	Sl --  ))  $   ) D D/BB? 	 00E=N4N#4	&+#%1=.&(	&<&O&O#16.&#	F2J MM55JKI ;HL =r   N)r~   r   r   r   r   )*__conditional_annotations__r\   
__future__r   typingr   r   r   r   r   _compatr   typesr	   r
   collections.abcr   EMPTYr"  SUBSETr#  DISJOINTr$  OVERLAPPINGr%  __all__r   r_   r~   r   r   __annotations__r   r   r   r   r   r   r   r   r   r   )rg  s   @r   <module>rs     s    # ? ?  -(   
""&& ,,  D D &' %'  y E445) 5
&
&	+Ho!GK  o!d:r   