+
    2jx                   j   R t ^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIHtH	t	 ^ RI
HtHt ^ RIHtHt ^ RIHtHtHtHtHtHt ^ RIHt ^ RIHt ^R	IHt ^R
IHt ^RIH t! ^RIH"t# ^RIH$t% ^RIH&t' ^RIH(t) ^RI*H+t+H,t,H-t- ^RI.H/t/ ^RI0H1t1 ^RI2H3t3 ^RI4H5t5 ]'       dQ   ^ RI6t6^ RI7H8t8H9t9H:t: ^ RI;H;t; ^ RI<H=t= ^ RI>H?t?H@t@ ^RIAHBtB ^RICHDtD ^RIEHFtF ^RIGHHtHHItIHJtJ ^RIKHLtL ^RIMHNtN ^RI4HOtO . RTOtP]P                  ! ]R4      tS]P                  ! R34      tUR4 R5 ltVR6 R7 ltW ! R8 R+]X4      tY ! R9 R$]P                  4      t[ ! R: R;]P                  4      t\ ! R< R#]P                  4      t] ! R= R!]P                  4      t^ ! R> R.]P                  4      t_ ! R? R"]P                  4      t`]! R@R@RA7       ! RB R)4      4       ta]! R@R@RA7       ! RC R24      4       tb]! R@R@RA7       ! RD R 4      4       tc ! RE R*]X4      td ! RF R1]d4      te ! RG R%]d4      tf ! RH R&]d4      tg ! RI R']X4      th ! RJ R/]X4      ti ! RK R0]X4      tj] ! RL R-4      4       tk]],          tl]m;QJ d    . RM ]! ]k4       4       F  NK  	  5M! RM ]! ]k4       4       4      tnRN RO lto ! RP R(4      tp]q! 4       trRQ RR lts ! RS R,4      ttR# )UzIndex-backed provider for nab-resolver.

Fetches package metadata from package indexes on demand using
nab-index, converting PEP 440/508 types into nab-resolver Range
types.  A FetchCoordinator overlaps index I/O on a background
asyncio loop.
)annotationsN)defaultdictdeque)	dataclassfields)TYPE_CHECKINGcast)MalformedSimpleResponseErrorMetadataHashMismatchError	SdistFileSdistHashMismatchError	WheelFileWheelHashMismatchError)IndexAccessError)UnserveableUrlError)EMPTY_MEMBERSHIP_SETS)extras)listing)	lookahead)metadata_resolver)priority)sources)UnsupportedVcsError	VcsConfig	VcsPolicy)VersionRangecanonicalize_name)WheelMetadata)host_environment)CallableMappingSequence)datetime)Path)IncompatibilityRangeProtocol)Marker)Requirement)Version)IndexOverrideNabProjectConfigPackageOverride)FetchCoordinator)TagSet)ResolveTargetArchiveSourceBuildPolicyDecisionOrder
DistPolicy
ExtrasModeForeignMetadataErrorIncompatiblePythonErrorInvalidUploadTimeErrorListingFilterCacheLocalSourceMetadataErrorMissingExtraErrorProviderProviderStatsResolutionStrategySiblingMetadataDivergenceErrorSourceNameMismatchErrorUnsupportedSdistError	VcsSourcez'^(?P<base>[^\[]+)\[(?P<extra>[^\]]+)\]$c                    V ^8  d   QhRRRR/# )   packagestrreturnztuple[str, str | None] )formats   "^/home/user/billing-ledger-validation/.venv/lib/python3.14/site-packages/nab_python/provider.py__annotate__rK   a   s     B B B!7 B    c                    \         P                  V 4      pVf   V R3# VP                  R4      \        VP                  R4      4      3# )zjSplit 'name[extra]' into ('name', 'extra'), or ('name', None).

The extra name is normalized per PEP 685.
Nbaseextra)	_EXTRA_REmatchgroupr   )rE   ms   & rJ   split_extrarT   a   sC    
 	 AyGGFO.qwww/?@AArL   c               $    V ^8  d   QhRRRRRR/# )rD   rN   rF   rO   rG   rH   )rI   s   "rJ   rK   rK   l   s!     1 1S 1 1 1rL   c                $    V  R\        V4       R2# )zZJoin a base name and extra into 'name[extra]'.

The extra name is normalized per PEP 685.
[]r   )rN   rO   s   &&rJ   
join_extrarY   l   s    
 V1&u-.a00rL   c                      ] tR t^ttRtRtR# )r;   zBRaised when a user-requested extra is not provided by the package.rH   N__name__
__module____qualname____firstlineno____doc____static_attributes__rH   rL   rJ   r;   r;   t   s    LrL   c                  *    ] tR t^xtRtRt Rt RtRtR# )r4   z5How to handle missing extras (not in Provides-Extra).warn
error_user	backtrackrH   N)	r\   r]   r^   r_   r`   WARN
ERROR_USER	BACKTRACKra   rH   rL   rJ   r4   r4   x   s    ?DMJ>I<rL   c                  "    ] tR t^tRtRtRtRtR# )ResolveModea  How the resolver interprets the project.

``SPECIFIC`` resolves one target, the host or an impersonated
marker environment.  ``UNIVERSAL`` resolves one target per tuple
declared in ``[tool.nab.matrix]``.  Both run the same engine over a
list of targets.  ``UNIVERSAL``'s multi-target lockfile format is
*experimental* and may change; the resolver itself is the same one
``SPECIFIC`` runs.  Users opt in by setting
``[tool.nab].mode = "universal"`` and declaring ``[tool.nab.matrix]``.
specific	universalrH   N)r\   r]   r^   r_   r`   SPECIFIC	UNIVERSALra   rH   rL   rJ   rj   rj      s    	 HIrL   rj   c                  6    ] tR t^tRtRt Rt Rt Rt Rt	Rt
R# )	r3   z1How to admit wheels and sdists during resolution.z
wheel-onlyzprefer-wheelzwheel-or-sdistz
sdist-onlyzsdist-installrH   N)r\   r]   r^   r_   r`   
WHEEL_ONLYPREFER_WHEELWHEEL_OR_SDIST
SDIST_ONLYSDIST_INSTALLra   rH   rL   rJ   r3   r3      s3    ;J? "LL%NFJK#MrL   c                  *    ] tR t^tRtRt Rt RtRtR# )r1   a%  How permissive the resolver is about invoking PEP 517 backends.

Three levels, strictest to most permissive.  Each level reads static
metadata from every source it admits; the difference is what is
permitted to fall through to a backend invocation when the static
read returns nothing usable.
neverzbuild-localzbuild-remoterH   N)	r\   r]   r^   r_   r`   NEVERBUILD_LOCALBUILD_REMOTEra   rH   rL   rJ   r1   r1      s+     E	  K "LrL   c                  *    ] tR t^tRtRt Rt RtRtR# )r>   zWhich version the resolver picks within an allowed range.

Mirrors uv's ``--resolution`` flag.  ``LOWEST_DIRECT`` catches missing
``>=`` bounds without dragging the whole transitive graph to its floor.
highestlowestzlowest-directrH   N)	r\   r]   r^   r_   r`   HIGHESTLOWESTLOWEST_DIRECTra   rH   rL   rJ   r>   r>      s!     G.F2#M=rL   c                  $    ] tR t^tRtRt RtRtR# )r2   zAWhether arrived listings may steer which package is decided next.arrivalstablerH   N)r\   r]   r^   r_   r`   ARRIVALSTABLEra   rH   rL   rJ   r2   r2      s    KGPFNrL   T)frozenslotsc                  L    ] tR t^t$ RtR]R&   R]R&   RtR]R&   RtR	]R
&   RtR# )r9   a  A source tree on disk used as the only candidate for a package.

``name`` is the package name; the resolver pins the package to a
single synthetic version, read from the directory's
``[project].version`` field or computed by the build backend when
that field is declared dynamic.  ``path`` is the absolute filesystem
path to the source tree.

``editable`` requests a PEP 660 editable install in the lockfile;
``subdirectory`` is a path under ``path`` for monorepo layouts.
rF   namepathFbooleditableN
str | NonesubdirectoryrH   )	r\   r]   r^   r_   r`   __annotations__r   r   ra   rH   rL   rJ   r9   r9      s'    
 I
IHd#L*#rL   c                  0    ] tR tRt$ RtR]R&   R]R&   RtR# )rB   i
  a;  A VCS reference used as the only candidate for a package.

``name`` is the package name; ``url`` is the pip-style VCS URL
(e.g. ``git+https://github.com/x/y.git@<sha>#subdirectory=pkg``).
The provider clones the repo to its cache and treats the
checked-out source as a :class:`LocalSource` for metadata
extraction.
rF   r   urlrH   Nr\   r]   r^   r_   r`   r   ra   rH   rL   rJ   rB   rB   
       I	HrL   c                  0    ] tR tRt$ RtR]R&   R]R&   RtR# )r0   i  av  A direct-URL archive used as the only candidate for a package.

``name`` is the package name; ``url`` is the archive URL carrying its
hash (and optional subdirectory) in the fragment, e.g.
``https://example.com/x-1.0.tar.gz#sha256=<hex>``.  The provider
downloads and hash-verifies the archive, then extracts and treats it
as a :class:`LocalSource` for metadata extraction.
rF   r   r   rH   Nr   rH   rL   rJ   r0   r0     r   rL   c                      ] tR tRtRtRtR# )r:   i(  z4Raised when dependency metadata cannot be extracted.rH   Nr[   rH   rL   rJ   r:   r:   (  s    >rL   c                      ] tR tRtRtRtR# )rA   i,  ac  Sdist or source tree needs a backend invocation the policy disallows.

Raised when extraction would require a build the current
:class:`BuildPolicy` (or its per-package override) does not permit:
dynamic metadata under :attr:`BuildPolicy.NEVER`, a VCS clone under
:attr:`BuildPolicy.BUILD_LOCAL`, or a remote sdist build failure
under :attr:`BuildPolicy.BUILD_REMOTE`.  For a PyPI sdist it is
caught by :meth:`Provider._look_ahead_ok`, so the resolver skips
the version.  A declared source (local, VCS, archive, or workspace
member) is read while listing its one version, so the error ends
the resolve instead.
rH   Nr[   rH   rL   rJ   rA   rA   ,  s    rL   c                      ] tR tRtRtRtR# )r5   i;  aX  An index candidate's METADATA declares a different release.

Core metadata ``Name`` and ``Version`` say which release an artifact is, so
a candidate whose METADATA (or :pep:`658` sidecar) names another project or
version describes some other release's dependencies.  Caught by
:meth:`Provider._look_ahead_ok` so the resolver skips the version.
rH   Nr[   rH   rL   rJ   r5   r5   ;  s    rL   c                      ] tR tRtRtRtR# )r6   iE  a  An index candidate's METADATA Requires-Python excludes the resolve target.

The Simple-API ``requires-python`` hint is optional, so the listing gate
admits a version whose listing omits it.  Once the wheel METADATA (or sdist
PKG-INFO) is fetched, its authoritative ``Requires-Python`` is checked and
an incompatible candidate is rejected.  Caught by
:meth:`Provider._look_ahead_ok` so the resolver skips the version.
rH   Nr[   rH   rL   rJ   r6   r6   E      rL   c                      ] tR tRtRtRtR# )r7   iR  zMRaised when an index upload-time is not the timezone-aware UTC PEP 700 needs.rH   Nr[   rH   rL   rJ   r7   r7   R  s    WrL   c                      ] tR tRtRtRtR# )r?   iY  a!  Raised when a version's tie-ranked wheels declare different target deps.

nab reads one wheel's dependencies per version and treats it as
authoritative, so a tie whose wheels declare different dependencies is an
ambiguity: pinning from one silently disagrees with an install of the other.
rH   Nr[   rH   rL   rJ   r?   r?   Y  s    rL   c                      ] tR tRtRtRtR# )r@   id  a  Raised when a materialised source's project name differs from its declaration.

A local, VCS, or archive source maps a declared ``name`` to a directory,
repo, or archive and becomes the only candidate for that package.  When the
source's own ``[project].name`` does not canonicalise to the declared name,
it provides a different distribution, so pinning it would carry the wrong
version and dependencies.
rH   Nr[   rH   rL   rJ   r@   r@   d  r   rL   c                  B   ] tR tRt$ Rt^ tR]R&   ^ tR]R&   ^ tR]R&   ^ t	R]R&   ^ t
R]R&   ^ tR]R	&   ^ tR]R
&   ^ tR]R&   ^ tR]R&   ^ tR]R&   ^ tR]R&   ^ tR]R&   ^ tR]R&   ^ tR]R&   ^ tR]R&   ^ tR]R&   ^ tR]R&   ^ tR]R&   ^ tR]R&   ^ tR]R&   ^ tR]R&   RtR# )r=   io  a  Counters describing what the provider did during a resolve.

Complements :class:`nab_resolver.ResolverStats` by tracking the PyPI/wheel
layer (listing fetches, metadata reads, filter rejections).  Used by
benchmarks to measure prefetch and look-ahead wins.
intlistings_fetchedmetadata_fetchedsdist_pkg_info_fetchedwheel_metadata_range_fetchedwheel_metadata_range_full_body wheel_metadata_range_unsupportedwheel_metadata_range_missingdistributions_seenwheels_seensdists_seenexcluded_by_pythonexcluded_by_timeexcluded_by_dist_policyexcluded_by_build_policyexcluded_by_wheel_tags%excluded_versions_no_compatible_wheelsdist_pyproject_fallbacksget_dependencies_callschoose_version_callsprioritize_callslook_ahead_rejectionsrH   N)r\   r]   r^   r_   r`   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   ra   rH   rL   rJ   r=   r=   o  s     cc"#C#() #)*+"C+,-$c-() #)KKc#$S$$%c%"#C#12)32%&s&"#C# !#!c!"3"rL   c              #  8   "   T F  qP                   x  K  	  R # 5iN)r   ).0stats   & rJ   	<genexpr>r     s     A+@4YY+@   c                    V ^8  d   QhRRRR/# )rD   statsr=   rG   ztuple[int, ...]rH   )rI   s   "rJ   rK   rK     s     @ @] @ @rL   c                x   a  \         ;QJ d    . V 3R l\         4       F  NK  	  5# ! V 3R l\         4       4      # )z=Return every counter of ``stats``, in ``_STAT_FIELDS`` order.c              3  <   <"   T F  p\        SV4      x  K  	  R # 5ir   )getattr)r   r   r   s   & rJ   r   _counters.<locals>.<genexpr>  s     ?,$%%,s   )tuple_STAT_FIELDS)r   s   frJ   	_countersr     s%    5?,?5?5?,???rL   c                  2    ] tR tRtRtR R ltR R ltRtR# )	r8   i  a#  Base listing-filter results shared across the targets of one resolve.

The pre-tag half of the listing filter (see
:func:`nab_python._provider.listing.base_distributions`) reads the
listing's files, the policy config, and the target Python, and has no
platform axis, so targets that differ only by platform recompute an
identical list.  Memoising it per (package, Python) leaves only the
wheel-tag pass to run per target.

One instance is only valid across providers that share a coordinator
and a policy config, as the targets of one resolve do.
c                   V ^8  d   QhRR/# rD   rG   NonerH   )rI   s   "rJ   rK   ListingFilterCache.__annotate__  s      $ rL   c                    / V n         R# )zCreate an empty cache.N_entriesselfs   &rJ   __init__ListingFilterCache.__init__  s    
  	rL   c          
     ,    V ^8  d   QhRRRRRRRRR	R
/# )rD   rE   rF   python_versionr   r   r=   computez,Callable[[], list[tuple[Version, DistFile]]]rG   list[tuple[Version, DistFile]]rH   )rI   s   "rJ   rK   r     s<       # 	
 > 
(rL   c           	        V P                   P                  W34      pVeQ   Vw  rg\        \        VRR7       F+  w  rV	'       g   K  \	        W8\        W84      V	,           4       K-  	  \        V4      # \        V4      p
V! 4       p\        ;QJ d)    . R \        \        V4      V
RR7       4       F  NK  	  5M"! R \        \        V4      V
RR7       4       4      p\        V4      V3V P                   W3&   V# )zReturn the filter result for ``package``, running ``compute`` once.

A memo hit replays the counters the filter raised onto ``stats``, so
every target still reports the files it would have walked.
T)strictc              3  6   "   T F  w  rW,
          x  K  	  R # 5ir   rH   )r   nowwass   &  rJ   r   .ListingFilterCache.filtered.<locals>.<genexpr>  s      
&P(#CII&Ps   )	r   getzipr   setattrr   listr   r   )r   rE   r   r   r   entryresultdeltar   countbefores   &&&&&      rJ   filteredListingFilterCache.filtered  s     !!7";<!MF"<tD5E)=)EF  E <5! 
&))E*:F4&P
 
&))E*:F4&P
 
 59L%3Hw/0rL   r   N)r\   r]   r^   r_   r`   r   r   ra   rH   rL   rJ   r8   r8     s     rL   c                    V ^8  d   QhRRRR/# )rD   valueobjectrG   rH   )rI   s   "rJ   rK   rK     s      & V rL   c                    V f   \         # V # )a  Map ``None`` to ``_UNSET``, passing every other value through.

Most policy fields store ``None`` to mean "unset" on the override
dataclasses, so wrapping their attribute access in this helper yields
the ``_UNSET``-or-value shape :meth:`Provider._effective_field`
expects.  The upload-time helpers, where ``None`` is a real value
(a disabled cutoff), build that shape themselves and skip this.
)_UNSETr   s   &rJ   _unset_if_noner     s     }LrL   c                  P   ] tR tRt$ Rt^tR]R&   ^tR]R&   ^@tR]R&   ^@t	R]R&   ^t
^t]P                  t]P                  t]P                  t]P                   t]P"                  tRRR]P&                  R]P*                  ]P.                  RRRRRRRRR]P2                  RRR3R	RR
RR]P6                  /R R llltR R ltR R ltRR R lltR R lt RR R llt!RR R llt"RR R l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,R- R. lt-R/ R0 lt.R1 R2 lt/R3 R4 lt0R5 R6 lt1R7 R8 lt2R9 R: lt3R; R< lt4R= R> lt5R? R@ lt6RA RB lt7RC RD lt8RE RF lt9RG RH lt:RI RJ lt;RK RL lt<RM RN lt=ROR/RP RQ llt>RR RS lt?RT RU lt@RV RW ltARX RY ltBRZ R[ ltCR\RR]R/R^ R_ lltDR` Ra ltERb Rc ltFRd Re ltGRf Rg ltHRh Ri ltIRjRk/Rl Rm lltJRn Ro ltKRp Rq ltLRr Rs ltMRt Ru ltNRv Rw ltORx Ry ltPRz R{ ltQR| R} ltRR~ R ltSR R ltTR R ltUR R ltVR R ltWR R ltXR R ltYRR/R R lltZR 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taRR R lltbR R ltcR R ltdR R lteR R ltfR R ltgR R lthRtiR# )r<   i  a  Lazy index-backed provider for nab-resolver.

Fetches version lists and .metadata from PyPI via nab-index.
A FetchCoordinator submits listing fetches to a background
asyncio loop, so transitive deps are fetched concurrently with
resolution.

``target`` is the environment the resolve is for: its markers gate
every dependency, its Python filters candidates by Requires-Python,
and its wheel tags filter candidates by PEP 425 compatibility, so a
version whose only wheels the target cannot install is a version the
resolver never sees.  Left unset, markers evaluate against the host
and neither filter runs, since nothing has said which machine the
resolve targets.

``constraints`` are the user's version bounds, keyed as the resolver
keys packages, so an extras proxy carries its base's bound under its
own ``name[extra]`` key.  The provider reads them when deciding
whether a missing root extra is worth reporting.

``preferences`` are versions another resolve already decided, tried
first when they are usable here.  A multi-target resolve passes the
pins of an already-resolved target, which aligns the matrix on one
version where every target can take it.  A package the strategy wants
lowest for ignores the preference and takes its own floor.

``listing_filter_cache`` shares the platform-independent half of the
listing filter with the other targets of the same resolve; see
:class:`ListingFilterCache`.

``decision_order`` chooses whether the decision scan may rank a
package on whether its listing has landed yet.  See
:meth:`settled_listing`.
r   PREFETCH_BATCHPREFETCH_DEPTHDEEP_PREFETCH_COUNT_BROAD_LA_REJECT_CAPNconstraintstrust_unverified_sdist_depsFdecision_orderc          2     |    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RRRRRRRRRRRRR R!R"R#R$R%R&R'R(R)R*R+R,R-R.R/R0R1/# )2rD   coordinatorr-   targetzResolveTarget | Noneroot_requirementszdict[str, VersionRange] | Noneuploaded_prior_todatetime | Noneextras_moder4   root_extraszset[tuple[str, str]] | Nonedist_policyr3   build_policyr1   package_overrideszSequence[PackageOverride]index_overridesz"Mapping[str, IndexOverride] | None
vcs_configzVcsConfig | Nonelocal_sourceszlist[LocalSource] | Nonevcs_sourceszlist[VcsSource] | Nonevcs_cache_dirzPath | Nonearchive_sourceszlist[ArchiveSource] | Nonearchive_cache_dirbuild_configzNabProjectConfig | Noneresolution_strategyzResolutionStrategy | strdirect_packageszfrozenset[str] | NonepreferenceszMapping[str, Version] | Nonelisting_filter_cachezListingFilterCache | Noner   z!Mapping[str, VersionRange] | Noner   r   r   r2   rG   r   rH   )rI   s   "rJ   rK   Provider.__annotate__6  s    c= c=%c= %c= :	c=
 +c=  c= 1c=  c= "c= 5c= <c= %c= 0c= ,c= #c=  4!c=" '#c=$ .%c=& 6'c=( /)c=* 2+c=, 8-c=0 71c=2 &*3c=4 &5c=6 
7c=rL   c                  \        V\        4      '       d    \        V4      pWn        W n        W@n        VV n        VV n	        WPn
        T;'       g    \        4       V n        Wpn        Wn        T;'       g    VRJ;'       d    VP                  V n        VV n        V\"        P$                  J V n        T;'       g    \)        4       V n        T;'       g    / P-                  4        UUu/ uF  w  pp\/        V4      VbK  	  uppV n        \3        V	4      V n        T
;'       g    / V n        \9        V P4                  ;'       g    V P6                  4      V n        \<        ;QJ d&    R V P4                   4       F  '       g   K   RM	  RM! R V P4                   4       4      ;'       ge    \<        ;QJ d4    R V P6                  P?                  4        4       F  '       g   K   RM)	  RM%! R V P6                  P?                  4        4       4      V n         T;'       g    \C        4       V n"        \F        PH                  ! Y;'       g    . 4      V n%        Wn&        / V n'        \F        PP                  ! Y;'       g    . 4      V n)        VV n*        \F        PV                  ! Y;'       g    . 4      V n,        Vf1   RV n-        \]        4       V n/        / V P^                  C\`        CV n1        M@VPd                  V n-        \g        VPh                  4      V n/        VPk                  4       V n1        Ve   VPl                  '       d   VPn                  MRV n8        / V n9        / V n:        \        4       V n;        T;'       g    / V n<        T;'       g    / V n=        / V n>        / V n?        / V n@        / V nA        / V nB        / V nC        / V nD        / V nE        ^ V nF        / V nG        / V nH        \        4       V nI        / V nJ        / V nK        / V nL        / V nM        / V nN        / V nO        / V nP        / V nQ        / V nR        / V nS        / V nT        / V nU        . V nV        \        \        4      V nY        \        \        4      V nZ        \        \        P                  P                  4      V n^        \        \        P                  P                  4      V n_        \        \        4      V n`        \        \f        4      V na        / V nb        . V nc        / V nd        RV ne        \        4       V ng        V Px                  '       d{   V Px                   Fh  pV P                  V4      w   pp V V PJ                  9   g#   V V PR                  9   g   V V PX                  9   d   KM  V P
                  P                  V 4       Kj  	  R# R#   \         d2   p\	        R \         4       4      pRT: RT: 2p\        T4      ThRp?ii ; iu uppi )	z?Construct the provider; see the class docstring for parameters.c              3  8   "   T F  qP                   x  K  	  R # 5ir   r   )r   ss   & rJ   r   $Provider.__init__.<locals>.<genexpr>W  s     C0B1ww0Br   z#resolution_strategy must be one of z; got Nc              3  f   "   T F'  pVP                   R J;'       g    VP                  x  K)  	  R # 5ir   r   uploaded_prior_to_disabledr   os   & rJ   r   r    s3      &
, t+KKq/K/KK,   11TFc              3  f   "   T F'  pVP                   R J;'       g    VP                  x  K)  	  R # 5ir   r  r  s   & rJ   r   r    s3      
3 t+KKq/K/KK3r  )j
isinstancerF   r>   
ValueErrorsortedr   r   r   r  r  r   setr   _dist_policyr   r   _resolution_strategyr2   r   settle_listings	frozenset_direct_packagesitemsr   _preferencesr   _package_overrides_index_overridesr   _has_overridesanyvaluesoverrides_set_timer   r   _sourcesindex_local_sourcesr   r  vcs_pinsindex_vcs_sourcesr   r  index_archive_sourcesr  r   r   environmentr   env_with_extrapython_full_versiondict
marker_envenv_with_membershiptags_faithfultags
wheel_tagstag_excluded_wheelstag_excluded_wheels_by_versionbase_filtered_packagesr   r   versions_cache
deps_cachemetadata_cacheextra_deps_mapdeferred_url_extras_unsupported_sdists_invalid_metadatamatching_cache_scan_generation_absent_listing_scanrequires_python_cacheconsulted_markersmarker_base_cachemarker_extra_cachemarker_text_cache_package_partspriority_cacheversions_only_cachewheel_by_version_cache_ascending_versions_cache_widened_ranges_gap_widened_rangessolution_rangessolution_decisionspending_clausesr   r   pending_blockspending_range_blocks
_lookaheadDepRangeUnionzeropending_decision_dep_rangespending_range_dep_rangespending_root_blockspending_metadata_blocks_no_versions_reasons_force_backtrack_targets_force_backtrack_counts_probing_satisfiabler=   r   split_and_normalizerequest_listing)!r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r  r  r  r  r   r   r   excvalidmsgr   versionpkg_
normalizeds!   &&&&&&&&&&&&&&&&&&&&&&$$$        rJ   r   Provider.__init__6  s   : )3///&89L&M# '!2 %9! )&&//#%'(
 ,G ,
 ,
$QQ)Q)Q 	( %8!-1E1EE0?0N0N9; #."3"3!:!:!<1
!<g d#W,!<1
 #((9":=L=R=RPR #4#:#:#S#Sd>S>ST #&# &
,,&
### &
,,&
 #
 #
 #
 S 
**113
SSS 
**113
 
 	 %33	%99$@S@SQST*(*#55d<M<M2N!2'==''R 
 >.2D/?/ADD""D'DD
 #)"<"<D#F$5$56D"("<"<">D "-&2F2F2FFKKD 	 46  OQ+ 14#!2!8!8b7B7H7HbIKNP
 IK  	  	  DF  BD MO !"46! 79" /2e 35>@13 GI  	
 >@ JL#
 DF&HJLN EG9;DF 	
  	! 
00556 	(
 
00556 	%  	   	$ 57! 46%
 8:$ %*!"_
!!!--#'#;#;C#@ 1j$"4"44!T%5%55!T%9%99  00< . "u  /C0BCC9% C/24  !o3./J1
s   V )WW%,WWc                    V ^8  d   QhRRRR/# )rD   rE   rF   rG   r   rH   )rI   s   "rJ   rK   r	  [  s     6 6c 6.L 6rL   c                .    \         P                  ! W4      # )z8See :func:`nab_python._provider.listing.fetch_versions`.)_listingfetch_versionsr   rE   s   &&rJ   rj  Provider.fetch_versions[  s    &&t55rL   c                    V ^8  d   QhRRRR/# rD   canonical_namerF   rG   r   rH   )rI   s   "rJ   rK   r	  _  s     H HC HJ HrL   c                L    V P                   P                  P                  V4      # )zReturn the index that served ``canonical_name``'s listing, or None.

Drawn from the coordinator's record of which configured index a
package's listing came from; ``None`` before any listing resolves
or for synthetic (local / VCS / archive) sources.
)r   indexget_listing_indexr   ro  s   &&rJ   serving_indexProvider.serving_index_  s!     %%77GGrL   c               (    V ^8  d   QhRRRRRRRR/# )	rD   ro  rF   rb  r)   
index_namer   rG   r1   rH   )rI   s   "rJ   rK   r	  h  s2        	
 
rL   c           	         V P                  VVVRR R R7      pV\        J d   V P                  # \        V\        4      '       g   Q hV# )aN  Return the build policy for ``canonical_name==version`` from ``index_name``.

Caller must canonicalise the name first.  A per-package override
whose version range contains ``version`` and a per-index override
for ``index_name`` that both set ``build-policy`` are a conflict
(raises :class:`~nab_python.config.OverrideConflictError`).
zbuild-policyc                ,    \        V P                  4      # r   r   r   r  s   &rJ   <lambda>1Provider.effective_build_policy.<locals>.<lambda>z  s    N1>>$BrL   c                ,    \        V P                  4      # r   rz  r{  s   &rJ   r|  r}  {  s    ."@rL   fieldpackage_valueindex_value)_effective_fieldr   r   r  r1   r   ro  rb  rw  r   s   &&&& rJ   effective_build_policyProvider.effective_build_policyh  sY     && B@ ' 
 V$$$&+....rL   c                    V ^8  d   QhRRRR/# )rD   ro  rF   rG   r1   rH   )rI   s   "rJ   rK   r	    s     ! ! ! !rL   c                    V P                    FY  pVP                  V8X  g   K  VP                  f   K&  \        VP                  P
                  4      '       d   KM  VP                  u # 	  V P                  # )aq  Return the build policy for a synthetic local/VCS/archive source.

These sources have no serving index and their version is not
known until the backend runs, so the version-scoped lookup does
not apply.  A per-package override is honoured only when it uses a
bare-name requirement (full range); a version-scoped override does
not govern such a source's build decision.
)r   r   r   rF   requirement	specifier)r   ro  overrides   && rJ   !effective_build_policy_for_source*Provider.effective_build_policy_for_source  s]     //H/))5H00::;;,,, 0    rL   c               (    V ^8  d   QhRRRRRRRR/# )	rD   ro  rF   rb  r)   rw  r   rG   r3   rH   )rI   s   "rJ   rK   r	    s2        	
 
rL   c           	         V P                   '       g   V P                  # V P                  VVVRR R R7      pV\        J d   V P                  # \	        V\
        4      '       g   Q hV# )zHReturn the dist policy for ``name==version`` served from ``index_name``.zdist-policyc                ,    \        V P                  4      # r   r   r   r{  s   &rJ   r|  0Provider.effective_dist_policy.<locals>.<lambda>  s    N1==$ArL   c                ,    \        V P                  4      # r   r  r{  s   &rJ   r|  r    s    ."?rL   r  )r"  r  r  r   r  r3   r  s   &&&& rJ   effective_dist_policyProvider.effective_dist_policy  sq     """$$$&&A? ' 
 V$$$&*----rL   c               (    V ^8  d   QhRRRRRRRR/# )	rD   ro  rF   rb  r)   rw  r   rG   r   rH   )rI   s   "rJ   rK   r	    s2     / // / 	/
 
/rL   c           	         V P                   '       g   V P                  # V P                  VVVRV P                  V P                  R7      pV\
        J d   V P                  # \        RV4      # )au  Return the upload-time cutoff for ``canonical_name==version``, or None.

A matching override may set an absolute cutoff or disable it (the
``false`` form); a disabling override returns ``None``.  Falls
back to the global ``uploaded_prior_to`` when no override sets the
field.  A per-package (range-matching) and a per-index override
that both set the field are a conflict.
zuploaded-prior-tor  r   )r"  r   r  _package_uploaded_prior_to_index_uploaded_prior_tor   r   r  s   &&&& rJ   effective_uploaded_prior_to$Provider.effective_uploaded_prior_to  su     """)))&&%9955 ' 
 V))) %v..rL   c               (    V ^8  d   QhRRRRRRRR/# )	rD   ro  rF   rb  r)   rw  r   rG   r   rH   )rI   s   "rJ   rK   r	    s2        	
 
rL   c           	         V P                  VVVRR R R7      pV\        J d   V P                  # \        V\        4      '       g   Q hV# )z<Return the sdist-trust flag for ``canonical_name==version``.z!dist-policy.trust-unverified-depsc                ,    \        V P                  4      # r   r   dist_trust_unverified_depsr{  s   &rJ   r|  5Provider.effective_trust_unverified.<locals>.<lambda>  s    N13O3O$PrL   c                ,    \        V P                  4      # r   r  r{  s   &rJ   r|  r    s    .1M1M"NrL   r  )r  r   r   r  r   r  s   &&&& rJ   effective_trust_unverified#Provider.effective_trust_unverified  sY     &&5PN ' 
 V333&$''''rL   c               $    V ^8  d   QhRRRRRR/# )rD   ro  rF   rb  r)   rG   ztuple[Requirement, ...] | NonerH   )rI   s   "rJ   rK   r	    s$     % %!%,3%	'%rL   c                N    V P                  VVR 4      pVf   R# VP                  # )a  Return the ``dependencies`` metadata override for ``name==version``.

Metadata overrides live only on the per-package surface, so this
is a single-surface lookup with no per-index arbitration and no
:class:`OverrideConflictError`.  Returns the replacement
requirement tuple (possibly empty, meaning "no runtime deps")
when a range-matching override sets ``dependencies``, else
``None`` when nothing overrides them.
c                ,    \        V P                  4      # r   )r   dependenciesr{  s   &rJ   r|  1Provider.effective_dependencies.<locals>.<lambda>  s    nQ^^4rL   N)_matching_package_overrider  r   ro  rb  r  s   &&& rJ   effective_dependenciesProvider.effective_dependencies  s4     224

 $$$rL   c               $    V ^8  d   QhRRRRRR/# )rD   ro  rF   rb  r)   rG   r   rH   )rI   s   "rJ   rK   r	    s$     ( (!(,3(	(rL   c                v    V P                   '       g   R# V P                  VVR 4      pVf   R# VP                  # )a3  Return the ``requires-python`` metadata override for ``name==version``.

Single-surface (per-package only), like
:meth:`effective_dependencies`.  Returns the raw specifier string a
range-matching override sets (which may be ``""``, meaning "no Python
requirement"), else ``None`` when nothing overrides it.
Nc                ,    \        V P                  4      # r   )r   requires_pythonr{  s   &rJ   r|  4Provider.effective_requires_python.<locals>.<lambda>  s    nQ%6%67rL   )r   r  r  r  s   &&& rJ   effective_requires_python"Provider.effective_requires_python  sC     &&&227

 '''rL   c               $    V ^8  d   QhRRRRRR/# )rD   ro  rF   rb  r)   rG   ztuple[str, ...] | NonerH   )rI   s   "rJ   rK   r	  	  s$     ' '!',3'	'rL   c                N    V P                  VVR 4      pVf   R# VP                  # )zReturn the ``provides-extra`` metadata override for ``name==version``.

Single-surface (per-package only).  Returns the declared extras
(possibly empty, meaning "no extras") a range-matching override
sets, else ``None`` when nothing overrides them.
c                ,    \        V P                  4      # r   )r   provides_extrar{  s   &rJ   r|  3Provider.effective_provides_extra.<locals>.<lambda>  s    nQ%5%56rL   N)r  r  r  s   &&& rJ   effective_provides_extra!Provider.effective_provides_extra	  s4     226

 &&&rL   c                    V ^8  d   QhRRRR/# )rD   ro  rF   rG   Ituple[tuple[Requirement, ...] | None, str | None, tuple[str, ...] | None]rH   )rI   s   "rJ   rK   r	    s     7 7!7	R7rL   c                l   RpRpRpV P                    F  pVP                  V8w  d   K  \        VP                  P                  4      '       d   K=  Vf   VP
                  e   VP
                  pVf   VP                  e   VP                  pVe   K  VP                  f   K  VP                  pK  	  W#V3# )a  Resolve a local/VCS/archive source's metadata override bundle.

These sources have no listing and their version is not known
until materialised, so a metadata override governs them only through
a bare-name requirement (full range); a version-scoped override does
not match a source.  Mirrors
:meth:`effective_build_policy_for_source`.  Each field is taken from
the first bare-name entry that sets it (a present ``""`` or ``()`` is
a set value); the parse-time overlap rules make that entry unique.
N)r   r   rF   r  r  r  r  r  )r   ro  depsr  r  r  s   &&    rJ   _source_metadata_override"Provider._source_metadata_override  s     04&*15//H}}.8''1122| 5 5 A,,&8+C+C+O"*":":%(*A*A*M!)!8!8 0 ~66rL   c               $    V ^8  d   QhRRRRRR/# )rD   ro  rF   rb  r)   rG   r  rH   )rI   s   "rJ   rK   r	  8  s$     
 
!
,3
	R
rL   c                    WP                   9   g!   WP                  9   g   WP                  9   d   V P                  V4      # V P	                  W4      V P                  W4      V P                  W4      3# )aO  Resolve the ``(dependencies, requires_python, provides_extra)`` override.

A local/VCS/archive source selects bare-name-only (its materialised
version is not knowable to the user when writing the selector); every
other candidate selects version-scoped.  Each field resolves
independently, so the three may come from different entries.
)r   r   r  r  r  r  r  r   ro  rb  s   &&&rJ   effective_metadata_override$Provider.effective_metadata_override8  sm     000!1!11!5!5511.AA''@**>C)).B
 	
rL   c                    V ^8  d   QhRRRR/# )rD   r  r,   rG   r   rH   )rI   s   "rJ   rK   r	  O  s      _  rL   c                j    V P                   e   V P                   # V P                  '       d   R# \        # )zIPer-package upload-time value: a datetime, ``None`` (disabled), or unset.Nr   r  r   r  s   &rJ   r  #Provider._package_uploaded_prior_toN  0     %%1---...rL   c                    V ^8  d   QhRRRR/# )rD   r  r*   rG   r   rH   )rI   s   "rJ   rK   r	  X  s      = V rL   c                j    V P                   e   V P                   # V P                  '       d   R# \        # )zGPer-index upload-time value: a datetime, ``None`` (disabled), or unset.Nr  r  s   &rJ   r  !Provider._index_uploaded_prior_toW  r  rL   c               (    V ^8  d   QhRRRRRRRR/# )	rD   ro  rF   rb  r)   
sets_fieldzCallable[..., object]rG   zPackageOverride | NonerH   )rI   s   "rJ   rK   r	  `  s,      !,3AV	rL   c                    V P                    F<  pVP                  V8w  d   K  W$P                  9  d   K(  V! V4      \        Jg   K:  Vu # 	  R# )zReturn the per-package override for ``version`` that sets the field.

At most one matches because the parse-time non-overlap check
forbids two same-field entries with overlapping ranges.
N)r   r   version_ranger   )r   ro  rb  r  r  s   &&&& rJ   r  #Provider._matching_package_override`  sI     //H}}.444(#61 0 rL   c               4    V ^8  d   QhRRRRRRRRRR	R
RRR/# )rD   ro  rF   rb  r)   rw  r   r  r  z#Callable[[PackageOverride], object]r  z!Callable[[IndexOverride], object]rG   r   rH   )rI   s   "rJ   rK   r	  q  sP     * ** * 	* * ;* 7* 
*rL   c               0   V P                  WV4      pVe   V P                  P                  V4      MRpVe	   V! V4      M\        p	VeA   V	\        Jd7   ^RIHp
 RV RV RV: R\        VP                  4      : RV: R2pV
! V4      hVe	   V! V4      # V	# )	ap  Resolve one policy field for a candidate across both override surfaces.

Returns the per-package value when a range-matching per-package
override sets ``field``, else the per-index value when the serving
index's override sets it, else ``_UNSET`` (the caller substitutes
the global default).  When BOTH surfaces set the field for this
candidate, raises :class:`~nab_python.config.OverrideConflictError`:
the two surfaces are deliberately not ranked.

Each value callable returns ``_UNSET`` when its override does not
set the field, and the actual value (which may be ``None`` for a
disabled upload-time cutoff) when it does.
NOverrideConflictErrorzoverride conflict for ==z served from index z: both a per-package override (z!) and the per-index override set zh.  The per-package and per-index surfaces are not ranked; remove one of the two settings for this field.)r  r!  r   r   configr  rF   r  )r   ro  rb  rw  r  r  r  rc  idx	idx_valuer  ra  s   &&&&$$$     rJ   r  Provider._effective_fieldq  s    . --n}U7A7Md##''
3SW(+K$V	?y65 )(87) D$ (), -9 JJ  (,,? %%rL   c                    V ^8  d   QhRRRR/# )rD   ro  rF   rG   r   rH   )rI   s   "rJ   rK   r	    s     C CC CC CrL   c                :    V P                   P                  V^ 4      # )z:How many times this package has triggered force-backtrack.)r[  r   rs  s   &&rJ   force_backtrack_countProvider.force_backtrack_count  s    ++//BBrL   c               $    V ^8  d   QhRRRRRR/# )rD   ro  rF   rb  r)   rG   r   rH   )rI   s   "rJ   rK   r	    s&     C C3 C CT CrL   c                "    W3V P                   9   # )z?Return True if metadata parsing previously failed for this pin.)r=  r  s   &&&rJ   has_invalid_metadataProvider.has_invalid_metadata  s    (D,B,BBBrL   c               $    V ^8  d   QhRRRRRR/# )rD   re  rF   sourcer9   rG   r   rH   )rI   s   "rJ   rK   r	    s(        
(	rL   c                n    . p\         P                  ! WV4       F  w  rEVP                  WE34       K  	  V# )zBSee :func:`nab_python._provider.sources.materialize_local_source`.)r&  materialize_local_sourceappendr   re  r  r   rb  sdists   &&&   rJ   r  !Provider.materialize_local_source  s=     24&??f
NG MM7*+
 rL   c               $    V ^8  d   QhRRRRRR/# )rD   re  rF   r  rB   rG   r   rH   )rI   s   "rJ   rK   r	    s(     	 		 	 
(		rL   c                n    . p\         P                  ! WV4       F  w  rEVP                  WE34       K  	  V# )z@See :func:`nab_python._provider.sources.materialize_vcs_source`.)r&  materialize_vcs_sourcer  r  s   &&&   rJ   r  Provider.materialize_vcs_source  s8     24&==dPVWNGMM7*+ XrL   c               $    V ^8  d   QhRRRRRR/# )rD   re  rF   r  r0   rG   r   rH   )rI   s   "rJ   rK   r	    s(        
(	rL   c                n    . p\         P                  ! WV4       F  w  rEVP                  WE34       K  	  V# )zDSee :func:`nab_python._provider.sources.materialize_archive_source`.)r&  materialize_archive_sourcer  r  s   &&&   rJ   r  #Provider.materialize_archive_source  s=     24&AAf
NG MM7*+
 rL   c               $    V ^8  d   QhRRRRRR/# rD   re  rF   version_listr   rG   list[Version]rH   )rI   s   "rJ   rK   r	    s-     F FF 5F 
	FrL   c                0    \         P                  ! WV4      # )z7See :func:`nab_python._provider.listing.versions_only`.)ri  versions_onlyr   re  r  s   &&&rJ   r  Provider.versions_only  s     %%dEErL   c               $    V ^8  d   QhRRRRRR/# )rD   re  rF   r  r   rG   dict[Version, DistFile]rH   )rI   s   "rJ   rK   r	    s-     I II 5I 
!	IrL   c                0    \         P                  ! WV4      # )z:See :func:`nab_python._provider.listing.wheel_by_version`.)ri  wheel_by_versionr  s   &&&rJ   _wheel_by_versionProvider._wheel_by_version  s     ((<HHrL   c               $    V ^8  d   QhRRRRRR/# )rD   re  rF   versionsr   rG   r   rH   )rI   s   "rJ   rK   r	    s-     B BB 1B 
	BrL   c                4    \         P                  ! WV4       R# )z>See :func:`nab_python._provider.listing.speculative_prefetch`.N)ri  speculative_prefetchr   re  r  s   &&&rJ   r  Provider.speculative_prefetch  s     	%%dArL   c                    V ^8  d   QhRRRR/# rD   re  rF   rG   r   rH   )rI   s   "rJ   rK   r	    s     Q Qc Qd QrL   c                H    \         P                  ! WV P                  4       R# )z=See :func:`nab_python._provider.listing.prefetch_walk_ahead`.N)ri  prefetch_walk_aheadr   r   re  s   &&rJ   r  Provider.prefetch_walk_ahead  s    $$Tt7O7OPrL   c               $    V ^8  d   QhRRRRRR/# )rD   re  rF   fileszSequence[WheelFile | SdistFile]rG   r   rH   )rI   s   "rJ   rK   r	    s)     F FF&EF	'FrL   c                0    \         P                  ! WV4      # )z>See :func:`nab_python._provider.listing.filter_distributions`.)ri  filter_distributions)r   re  r  s   &&&rJ   r  Provider.filter_distributions  s     ,,TuEErL   c               $    V ^8  d   QhRRRRRR/# )rD   re  rF   r  r   rG   ztuple[Version, DistFile] | NonerH   )rI   s   "rJ   rK   r	    s-     H HH 1H 
)	HrL   c                0    \         P                  ! WV4      # )z=See :func:`nab_python._provider.listing.pick_best_candidate`.)ri  pick_best_candidater  s   &&&rJ   r  Provider.pick_best_candidate  s     ++DhGGrL   c               $    V ^8  d   QhRRRRRR/# )rD   rE   rF   r  RangeProtocol[Version]rG   Version | NonerH   )rI   s   "rJ   rK   r	    s$     -
 -
-
+A-
	-
rL   c                    \        V\        4      '       g   Q hV P                  ;P                  ^,          un        V P	                  V4      w  r4pV P                  WWEV4      pVe   V P                  4        V# Ve   V P                  WWB4      # V P                  V4      pV P                  WW4      p\        VP                  VRR7      4      p	V P                  V4      '       d   V	P                  4        V P                  '       * ;'       d    V P                  '       * p
V
'       g	   V	'       g/   V	'       g   V P!                  WVR7       V	'       d
   V	^ ,          # R# V P#                  WW4      pV P%                  WYWV4      # )zPick a version within the allowed range, respecting the strategy.

A preference another resolve decided wins when it is in range and
usable here; otherwise the strategy picks.
N
descendingassume_sorted)r  )r  r   r   r   r]  _preferred_version_flush_pending_blocks_choose_extra_versionrj  r  r   filterwants_lowestreverser   rN  _record_no_versions_reasonr  _run_full_scan)r   rE   r  rN   rO   re  	preferredr  all_versions
candidatesno_lookaheadr  s   &&&         rJ   choose_versionProvider.choose_version  se    -6666

''1,'"&":":7"CZ++5m
	  &&(--gURR**73))*C  \ J

 Z(( 111QQ$:Q:Q6Qz// 0  %/:a=8D811*K""$4|
 	
rL   c               0    V ^8  d   QhRRRRRRRRRRR	R
/# )rD   rE   rF   rN   rO   r   re  r  r   rG   r  rH   )rI   s   "rJ   rK   r	  #  sF     )- )-)- )- 	)-
 )- $)- 
)-rL   c                   V P                   P                  V4      pVe   V P                  V4      '       d   R# V P                  W@P	                  V4      4      pTpVe(   V P
                  P                  V4      p	V	e	   WY,          pVP                  VRR7      p
Wj9  d   R# Ve   \        P                  ! WW64      MV P                  WFRR7      pV'       d   V# R# )az  Return the preferred version for ``package``, or None to pick fresh.

A preference is honored only when it is in range and usable here: a
base version needs extractable metadata, an extras proxy
additionally needs to declare the extra.  A package the strategy
wants lowest for keeps its own floor, so alignment cannot make the
result depend on the order the targets resolve in.
Nr  r  Tcheck_decisions)
r  r   r$  r  rj  rM  r#  _extrasversion_provides_extra_look_ahead_ok)r   rE   rN   rO   re  r  r(  r)  admit_range
base_rangein_rangeusables   &&&&&&      rJ   r   Provider._preferred_version#  s      %%))*5	 1 1* = =))*6I6I'6RS $--11*=J%+8%%l,%O$   **4uH$$ZD$Q 	
 #y,,rL   c               $    V ^8  d   QhRRRRRR/# )rD   rE   rF   r  r  rG   r   rH   )rI   s   "rJ   rK   r	  N  s.     GC GCGC+AGC	GCrL   c                b   ^RI Hp \        V P                  4      p\        V P                  4      pRV n         V P                  W4      RJRV n        V P                  4        V P                  4        W@n        V P                  P                  V4      pWPn        Ve   W`P                  V&   # #   \        \        \        \        \        T\        \         \"        \$        3
 dg     RT n        T P                  4        T P                  4        Y@n        T P                  P                  T4      pYPn        Te   Y`P                  T&   R# R# i ; i  RT n        T P                  4        T P                  4        Y@n        T P                  P                  T4      pYPn        Te   Y`P                  T&   i i ; i)aP  Report whether a usable version exists, side-effect-free.

Runs the real ``choose_version`` over ``version_range`` so look-ahead
rejections are honored, then rolls back the state it records: the queued
clauses and force-backtrack signal are drained, and the force-backtrack
budget and no-versions reasons are restored to their pre-probe values.
A failed-resolve attribution probe therefore cannot alter a later
decision.

The one exception is ``package``'s own no-versions reason.  When the
un-narrowed range yields no version because a transitive conflict
rejected every candidate, this probe is the only pass that names the
blocker, so its reason is kept rather than rolled back to the generic
no-match the constraint-narrowed pass recorded.  The reason map only
labels a ``NO_VERSIONS`` clause, so keeping it cannot alter a decision.

The probe also suppresses the two look-ahead shortcuts that could
otherwise report a version the decided blocker rejects:
``_probing_satisfiable`` skips the abort and keeps checking decisions
past ``_BROAD_LA_REJECT_CAP``.

The un-narrowed range spans versions the constraint clipped away, so
look-ahead can reach one whose metadata raises a hard error the narrowed
resolve never touched (a failed integrity check, a tie-ranked-wheel
divergence, or an advertised sidecar the index answered it will not
serve).  Each names a fault of that one version, so the probe catches
them and returns ``False`` rather than aborting; the crash still fires
when the version is pinned for real.

A transient transport failure is deliberately not in that tuple.  A 5xx
that outlived the retry budget, or a dropped connection, says nothing
about the version, and swallowing it would report "no satisfying
candidate" for a version that has one and hand back a different
resolution instead of failing.  The ``finally`` restores the snapshot
either way.
r  TNF)r  r  r.  r[  rY  r\  r,  consume_pending_clausesconsume_force_backtrack_targetsr   r
   r   r   r   r7   r?   NotImplementedErrorr	   r   )r   rE   r  r  saved_countssaved_reasonsprobed_reasons   &&&    rJ   has_satisfying_versionProvider.has_satisfying_versionN  s   P 	2D889T667$(!	C&&w>dJ ).D%((*002+7( !5599'BM(5%(5B))'2 )+ &"""!*(
 	 (-D%((*002+7( !5599'BM(5%(5B))'2 )-	 ).D%((*002+7( !5599'BM(5%(5B))'2 )s$   B- -5E"E EE A#F.c               0    V ^8  d   QhRRRRRRRRRRR	R
/# )rD   re  rF   r*  r  r  r  rE   r)  rG   r  rH   )rI   s   "rJ   rK   r	    sF          "  2	 
   $  
 rL   c                   ^ pV P                  W^ ,          RR7      '       d   V P                  4        V^ ,          # V P                  ;P                  ^,          un        V^,          pV P	                  VVR,          VVV^ ,          R7      pVe   V P                  4        V# V P                  V4      pV P                  4        V P                  WEVR7       R# )z7Run the decision-aware look-ahead scan over candidates.Tr0  :   NN)first_candidateN)blockers)r4  r!  r   r   _scan_candidates_pipelined_capture_lookahead_blockersr&  )	r   re  r*  r  rE   r)  broad_rejectionsfoundrH  s	   &&&&&&   rJ   r'  Provider._run_full_scan  s     za=$OO&&(a= 

((A-(A//rN&qM 0 
 &&(L 33J?""$'''QrL   c          
     ,    V ^8  d   QhRRRRRRRRRR/# )	rD   rE   rF   rN   rO   r  r   rG   r  rH   )rI   s   "rJ   rK   r	    s;     W WW"%W.1WBNW	WrL   c                2    \         P                  ! WW#V4      # )z=See :func:`nab_python._provider.extras.choose_extra_version`.)r2  choose_extra_version)r   rE   rN   rO   r  s   &&&&&rJ   r"  Provider._choose_extra_version  s     ++D4VVrL   rG  c               0    V ^8  d   QhRRRRRRRRR	R
RR
/# )rD   re  rF   	remainingr  r  r  rK  r   rG  r  rG   rH   )rI   s   "rJ   rK   r	    sF     9 99 !9 2	9
 9 (9 
9rL   c               x   V P                  V4       \        \        ^ \        V4      V P                  4      4      p\        4       p\        V P                  4       FM  p\        VR4      p	V	f    M<W)WP                  ,            p
V P                  WV4      pVP                  W34       KO  	  V'       d   VP                  4       w  r\        VR4      pVe9   W,WP                  ,            pV P                  WV4      pVP                  W34       V P                  W4       V P                  WWE4      w  rVf   K  V# R# )a  Scan ``remaining`` with ``PREFETCH_DEPTH`` batches in flight.

Returns the first ``_look_ahead_ok`` version, or ``first_candidate``
if the scan trips the monolithic-rejection abort, or ``None`` when
every candidate was rejected.  Caller flushes pending blocks on
every return path.

Abort semantics: when ``broad_rejections`` crosses
``_LOOKAHEAD_ABORT_THRESHOLD`` and every queued rejection for
``normalized`` shares one ``(blocker_pkg, blocker_version)``,
discard the misleading pending decision blocks for
``normalized`` and return ``first_candidate``.  The resolver then
decides that candidate tentatively, ``get_dependencies`` emits the
actual dep-range clause, and pubgrub back-jumps the offending
blocker on its own.  Sound because no clause is emitted by the
abort path.
N)r  iterrangelenr   r   r   next_prefetch_batchr  popleft_await_metadata_batch_scan_batch)r   re  rS  r  rK  rG  starts_iter	in_flightrd  startbatch	submitted
next_start
next_batchnext_submittedoutcomes   &&&&&$          rJ   rI  #Provider._scan_candidates_pipelined  s8   6 	  ,5C	ND4G4GHI G 	 t**+Ad+E}e.A.A&ABE,,Z@PQIe/0 , (002Ek40J%&JATAT4TU
!%!5!5,<"   *!=>&&z=(,(8(8#3)%G "rL   c          
     ,    V ^8  d   QhRRRRRRRRR	R
/# )rD   re  rF   r`  r  rK  r   rG  r  rG   ztuple[Version | None, int]rH   )rI   s   "rJ   rK   r	    s<     !& !&!& !& 	!&
 (!& 
$!&rL   c                   V F  pV P                   ;'       g    W0P                  8  pV P                  WVR7      '       d   WS3u # V P                  ;P                  ^,          un        V'       g   Kp  V^,          pVf   K  W0P
                  8  d   K  V P                   '       d   K  V P                  V4      '       g   K  WC3u # 	  RV3# )zLook-ahead-check each version. Return (winner, new_rejection_count).

Winner is the first compatible candidate, or ``first_candidate``
when the abort fires, or None to keep scanning further batches.
r0  N)r\  r   r4  r   r   _LOOKAHEAD_ABORT_THRESHOLD_try_abort_lookahead)r   re  r`  rK  rG  rb  r1  s   &&&&&  rJ   r\  Provider._scan_batch  s     G)) @ @#&?&??  ""_ #   00JJ,,1,"!&"A"AA(((((44&88) * %%%rL   c                    V ^8  d   QhRRRR/# rD   re  rF   rG   r   rH   )rI   s   "rJ   rK   r	    s      s t rL   c                8   V P                  V4      pVf   R# V P                  V4       Vw  r4V P                  P                  V^ 4      pW0P                  9  dB   WPP
                  8  d2   V P                  P                  V4       V^,           V P                  V&   R# )zRun the monolithic-rejection abort. Return True when it fires.

Firing queues the blocker for force-backtrack, up to the per-blocker
cap; the caller then falls back to its first candidate.
FT)_should_abort_lookahead _discard_pending_decision_blocksr[  r   rZ  _MAX_FORCE_BACKTRACKS_PER_PKGr  )r   re  blockerblocker_pkgrd  prior_firess   &&    rJ   rj  Provider._try_abort_lookahead  s     ..z:?--j9 2266{AF<<<@@@))00=8CaD((5rL   c                    V ^8  d   QhRRRR/# )rD   re  rF   rG   ztuple[str, Version] | NonerH   )rI   s   "rJ   rK   r	  1  s        #  :T  rL   c                j  a \        4       pV P                   F4  w  r4pVS8X  g   K  VP                  WE34       \        V4      ^8  g   K3   R# 	  \        V4      ^8w  d   R# \        ;QJ d)    V3R lV P
                   4       F  '       g   K   RM	  RM! V3R lV P
                   4       4      '       d   R# \        ;QJ d)    V3R lV P                   4       F  '       g   K   RM	  RM! V3R lV P                   4       4      '       d   R# SV P                  9   d   R# \        \        V4      4      # )a  Return the single shared blocker if every rejection blames it.

The trigger is intentionally narrow: only when *every* rejection
for ``normalized`` is a decision block with the same
``(blocker_pkg, blocker_version)`` key and there are no
range / root / metadata blocks.  Returns ``(blocker_pkg,
blocker_version)`` when the condition holds, else ``None``.
Mixed-cause scans keep the per-version clauses because at least
one rejection cause is a real constraint the resolver still
needs to learn.
Nc              3  0   <"   T F  vrVS8H  x  K  	  R # 5ir   rH   r   candrd  re  s   &  rJ   r   3Provider._should_abort_lookahead.<locals>.<genexpr>E  s     L2Khdtz!2K   TFc              3  0   <"   T F  vrVS8H  x  K  	  R # 5ir   rH   ry  s   &  rJ   r   r{  G  s     K2Jhdtz!2Jr|  )
r  rP  addrW  r#  rQ  rW  rX  rX  rU  )r   re  seenrz  rs  blocker_versions   &f    rJ   ro   Provider._should_abort_lookahead1  s     *-262E2E.Dz!+78t9q=	 3F
 t9>3L$2K2KL333L$2K2KLLL3K$2J2JK333K$2J2JKKK555DJrL   c                    V ^8  d   QhRRRR/# r  rH   )rI   s   "rJ   rK   r	  M  s     
 
3 
4 
rL   c           	        \        \        V P                  P                  4        UUu/ uF  w  r#V^ ,          V8w  g   K  W#bK  	  upp4      V n        \        \        P
                  P                  V P                  P                  4        UUu/ uF  w  r#V^ ,          V8w  g   K  W#bK  	  upp4      V n        R# u uppi u uppi )a  Drop decision-block entries for ``normalized`` without emitting clauses.

Used by the look-ahead abort path: the blocker clauses the queue
would otherwise produce are exactly the ones that mislead the
resolver into picking a deep candidate.  Range / root / metadata
blocks are left in place because the abort path only fires when none
exist for this candidate; this helper still scopes its delete to the
matching candidate name for safety.
N)r   r   rP  r  rR  rS  rT  rU  )r   re  kvs   &&  rJ   rp  )Provider._discard_pending_decision_blocksM  s     *"11779P9daQqTZ=OTQT9P
 ,7$$)) !<<BBDDDAQ4:% D,
(	 Qs   B9B9B?$B?c                    V ^8  d   QhRRRR/# rm  rH   )rI   s   "rJ   rK   r	  f  s      s t rL   c                    V P                   \        P                  J d   R# V P                   \        P                  J d   WP                  9   # R# )zWhether the resolver should pick the minimum version for ``normalized``.

Lookup keys are canonical names; extras-proxy callers must
pass the *base* name (the strategy decision is keyed off the
underlying package, not the proxy).
TF)r  r>   r~   r   r  r  s   &&rJ   r$  Provider.wants_lowestf  sC     $$(:(A(AA$$(:(H(HH!6!666rL   rH  r  c          
     ,    V ^8  d   QhRRRRRRRRR	R
/# )rD   rE   rF   r)  r  rH  zlist[str] | Noner  VersionRange | NonerG   r   rH   )rI   s   "rJ   rK   r	  s  sC     g4 g4g4 $g4
 #g4 +g4 
g4rL   c               0   V P                  V4      w   rVV'       Eg   V P                  P                  P                  V4      pV P                  P                  V^ 4      pV'       g`   V P                  P                  P                  V4      '       d   Rp	MV P                  P                  P                  V4      '       d   Rp	MRp	MV'       d   W`P                  9  d   RV R2p	MV'       dB   \        ;QJ d    R V 4       F  '       g   K   RM	  RM! R V 4       4      '       d   RV R	2p	MZR
p	MWV'       d   RP                  V4      p
RV
 2p	M8WP                  9   d   R# Ve!   \        P                  ! WWB4      '       d   Rp	MRp	WP                  V&   R# )a  Record why ``choose_version`` returned ``None`` for ``package``.

``blockers`` carries the look-ahead rejection causes when
every candidate that fell in ``version_range`` was rejected:
either because of an already-decided package, a positive-range
constraint, a root-requirement disagreement, or because the
candidate's metadata could not be read under the current
build policy.  When supplied, the recorded reason names those
causes so the user does not see a bare "no version matches
the requirement", which would suggest the package is
missing from the index when in fact it is the resolver's
transitive constraints (or a too-strict build policy) that
excluded every candidate.

``version_range`` is passed only when no surviving version fell
inside it.  A version the listing filter dropped that does fall
inside it is the release the requirement asked for, so the reason
names the filter rather than reporting no match.

``all_versions`` is post-filter, so an empty one means either the
index served no files or every file it served was dropped by the
wheel-tag filter, requires-python, dist-policy, or the upload-time
cutoff.  The stored listing tells absence from incompatibility
apart, except that it is also empty for an index skipped offline
and for a page of formats nab does not read (``.zip`` sdists,
``.exe`` installers).  Both are marked when stored so the reason
names them instead of absence.
The wheel-tag case (a Windows-only package on a Linux target) is
named only when the base pass dropped nothing, or when the file
it dropped was an sdist: there the reason names both the rejected
tags and the filtered sdist, because the sdist is what the user
can bring back.  A base-filtered wheel alongside a tag-rejected
wheel on another version reports the base-filter reason alone.

A look-ahead rejection emits a clause that removes the rejected
versions from the range, so the resolver asks again over a range
nothing falls in.  That second ask has no blockers of its own, so
its no-match reason must not overwrite the one naming the blocker.
z4offline mode skipped an index with no cached listingzPfound on index but no file is a wheel or a .tar.gz sdist (the formats nab reads)z)package not found on any configured indexzTfound on index but none of the wheel's tags are compatible with the resolve target (z: wheels rejected), and no sdist is available to build fromc              3  B   "   T F  p\        V\        4      x  K  	  R # 5ir   )r  r   )r   fs   & rJ   r   6Provider._record_no_versions_reason.<locals>.<genexpr>  s     %T1jI&>&>s   TFz] wheels rejected), and the sdist was filtered by requires-python, dist-policy, or upload-timezofound on index but no distribution is compatible (all filtered by requires-python, dist-policy, or upload-time)z; z%every version in range was rejected: Nzfound on index but every version matching the requirement was filtered (by requires-python, wheel tags, dist-policy, or upload-time)z"no version matches the requirement)r]  r   rq  get_listingr4  r   is_offline_listing_missis_unreadable_only_listingr6  r#  joinrY  ri  has_filtered_in_range_release)r   rE   r)  rH  r  rd  re  raw_listingtag_excludedreasonjoineds   &&&$$      rJ   r&  #Provider._record_no_versions_reasons  s   ^  33G<1|**00<<ZHK3377
AFL##))AA*MMSF%%++FFzRR3 
 IF*4O4O"O11= ??@ 
 ##%T%T###%T%T"T"T
11= ?34 U   YYx(F<VHEF111&8+Q+Qm,
 ,
#  :F-3!!'*rL   c                    V ^8  d   QhRRRR/# )rD   re  rF   rG   	list[str]rH   )rI   s   "rJ   rK   r	    s     : :c :i :rL   c                r   . pV P                    FV  w  r4pW18w  d   K  V P                  W4V3,          P                  pVP                  RV RV P	                  V4       RV 24       KX  	  V P
                   Fe  w  r4pW18w  d   K  V P                  W4V3,          P                  pVP                  RV RV P	                  V4       RV P	                  V4       24       Kg  	  V P                   FH  w  ppppW18w  d   K  VP                  RV RV P	                  V4       RV P	                  V4       24       KJ  	  V P                  P                  V4      p	V	'       d_   \        V	4      p
\        \        V	P                  4       4      4      pV
^8X  d   VP                  V4       V# VP                  V
 RV R24       V# )zSummarise pending look-ahead rejections for ``normalized``.

Returns one human-readable string per blocker source
(decisions, positive ranges, root disagreements, metadata errors).
z	requires z in z but solution has it at z but solution has it in z but root has it in z- versions failed metadata extraction (first: ))rP  rU  unionr  format_rangerQ  rV  rW  rX  r   rW  rX  rU  r$  )r   re  outrz  rs  r  	dep_range	pos_range
root_rangemetar   	first_msgs   &&          rJ   rJ  $Provider._capture_lookahead_blockers  s    262E2E.D!88O4e 
 JJK=T->->y-I,J*?*;= 3F -1,E,E(Dy!55I.e  JJK=T->->y-I,J*4+<+<Y+G*HJ -F  %%
!JJK=T->->y-I,J&t'8'8'D&EG & ++//
;IET$++-01Iz

9% 
	 

gJ9+UVW 
rL   c                    V ^8  d   QhRRRR/# )rD   rE   rF   rG   r   rH   )rI   s   "rJ   rK   r	    s     6 6c 6j 6rL   c                8    V P                   P                  V4      # )zReturn the recorded reason for ``package``'s NO_VERSIONS clause.

Returns ``None`` if no diagnostic was captured (e.g. the
package was decided successfully or failed for a non-listing
reason such as a metadata parse error).
)rY  r   rk  s   &&rJ   get_no_versions_reasonProvider.get_no_versions_reason  s     ((,,W55rL   c               (    V ^8  d   QhRRRRRRRR/# )	rD   rE   rF   r  r  r  r  rG   /list[tuple[Version, str, str, threading.Event]]rH   )rI   s   "rJ   rK   r	  !  s8     R RR  R 2	R
 
9RrL   c                0    \         P                  ! WW#4      # )z8See :func:`nab_python._provider.listing.prefetch_batch`.)ri  prefetch_batch)r   rE   r  r  s   &&&&rJ   rY  Provider._prefetch_batch!  s     &&thQQrL   c               $    V ^8  d   QhRRRRRR/# )rD   rE   rF   ra  r  rG   r   rH   )rI   s   "rJ   rK   r	  *  s.     @ @@ C@ 
	@rL   c                4    \         P                  ! WV4       R# )z>See :func:`nab_python._provider.listing.await_metadata_batch`.N)ri  await_metadata_batch)r   rE   ra  s   &&&rJ   r[  Provider._await_metadata_batch*  s     	%%dY?rL   c               $    V ^8  d   QhRRRRRR/# )rD   positive_rangesz$Mapping[str, RangeProtocol[Version]]	decisionszMapping[str, Version]rG   r   rH   )rI   s   "rJ   rK   r	  2  s(     , ,=, ), 
	,rL   c                    Wn         W n        R# )a  Accept a snapshot of the resolver's positive-range assignments.

Decision-only forward checking is safer than reasoning over
derivations because backjumping a decision also undoes its derivations.

The caller hands over fresh snapshots it does not retain or mutate, so
we store them directly. We only ever read these maps, never mutate them
in place; both are reassigned wholesale on the next hint.
N)rM  rN  )r   r  r  s   &&&rJ   receive_partial_solution_hint&Provider.receive_partial_solution_hint2  s      /"+rL   r1  Tc               (    V ^8  d   QhRRRRRRRR/# )rD   rE   rF   rb  r)   r1  r   rG   rH   )rI   s   "rJ   rK   r	  C  s,     
 

%,
BF
	
rL   c               2    \         P                  ! WW#R7      # )z9See :func:`nab_python._provider.lookahead.look_ahead_ok`.r0  )rR  look_ahead_ok)r   rE   rb  r1  s   &&&$rJ   r4  Provider._look_ahead_okC  s     ''7
 	
rL   c                   V ^8  d   QhRR/# r   rH   )rI   s   "rJ   rK   r	  K  s     . .t .rL   c                2    \         P                  ! V 4       R# )z@See :func:`nab_python._provider.lookahead.flush_pending_blocks`.N)rR  flush_pending_blocksr   s   &rJ   r!  Provider._flush_pending_blocksK  s    ''-rL   c                   V ^8  d   QhRR/# )rD   rG   z#list[Incompatibility[str, Version]]rH   )rI   s   "rJ   rK   r	  O  s      )L rL   c                ,    V P                   p. V n         V# )z7Drain queued binary clauses for the resolver to absorb.)rO  )r   clausess   & rJ   r<   Provider.consume_pending_clausesO  s    &&!rL   c                   V ^8  d   QhRR/# )rD   rG   r  rH   )rI   s   "rJ   rK   r	  U  s     
 
 
rL   c                ,    V P                   p. V n         V# )a5  Drain blocker packages queued by the look-ahead abort path.

See ``ResolverProvider.consume_force_backtrack_targets`` for the
contract.  Returning a non-empty list asks the resolver to skip
deciding the candidate just returned by ``choose_version`` and
instead targeted-back-track these packages immediately.
)rZ  )r   targetss   & rJ   r=  (Provider.consume_force_backtrack_targetsU  s     //(*%rL   c               $    V ^8  d   QhRRRRRR/# r  rH   )rI   s   "rJ   rK   r	  a  s(       5 
	rL   c                    V P                   P                  V4      pVf2   \        \        V P	                  W4      4      4      pW0P                   V&   V# )a  Return the widening universe for ``normalized``: ascending, cached.

The reversed ``versions_only`` view of the post-filter listing, so
pre-release, dev, post, and local versions all fence widening.
Yanked files are dropped at nab-index parse time and can never be
selected; if that ever moves into a provider-level filter, this
universe must be sourced below it, or widened ranges would span
selectable yanked versions.
)rJ  r   r   reversedr  )r   re  r  cacheds   &&& rJ   _ascending_versionsProvider._ascending_versionsa  sL     //33J?>(4#5#5j#OPQF9?**:6rL   c               $    V ^8  d   QhRRRRRR/# rD   rE   rF   rb  r)   rG   r  rH   )rI   s   "rJ   rK   r	  u  s'     D Dc DG D@S DrL   c                T    V P                  V4      w  r4pV P                  WRVRJ R7      # )a  Return the widened parent range for a decided ``version``, or None.

For a base package the range spans adjacent listed versions whose
cached dependency dicts equal the decided version's, then widens to
the open gap around that span, so every selectable version inside
has exactly the dependencies being recorded (see
``ResolverProvider.widen_decision`` for the contract).  Under a
lowest preference the upward half is capped and that side keeps
the plain neighbor gap (see ``_span_identical_deps``); otherwise
the span runs both ways.  Extras proxies keep the pure neighbor
gap over the base package's universe: their dependency sets are
per-extra-context.  Local, VCS, and archive sources (synthesized
single-version listings) and packages whose listing is not cached
are not widened.

The span is computed once from ``deps_cache`` and memoized.  Later
fetches cannot invalidate it: metadata is immutable and the
universe never grows mid-resolve, so recomputing could only widen
the span.  The cap is not part of the memo key: the strategy and
the direct-package set are both fixed at construction, so
``wants_lowest`` gives one answer per package for the provider's
whole life.
Nspanr]  _widen)r   rE   rb  rd  rO   re  s   &&&   rJ   widen_decisionProvider.widen_decisionu  s0    0  $77@*{{:Ud]{CCrL   c               $    V ^8  d   QhRRRRRR/# r  rH   )rI   s   "rJ   rK   r	    s"     	< 	<# 	< 	<DW 	<rL   c                P    V P                  V4      w   r4V P                  WBRR7      # )a5  Return ``version``'s pure neighbor-gap range, or None.

Contract: the gap contains ``version`` and no other listed version,
so a term built from it names exactly ``version``.  Look-ahead
terms widen through this path: a ``widen_decision`` span does not
meet that contract.  Gating matches ``widen_decision``.
Fr  r  )r   rE   rb  rd  re  s   &&&  rJ   widen_decision_gapProvider.widen_decision_gap  s,      33G<1{{:U{;;rL   c               (    V ^8  d   QhRRRRRRRR/# )	rD   re  rF   rb  r)   r  r   rG   r  rH   )rI   s   "rJ   rK   r	    s,         (/ :> 	 rL   c               p   WP                   9   g!   WP                  9   g   WP                  9   d   R# V P                  P	                  V4      pVf   R# W3pV'       d   V P
                  MV P                  pVP	                  V4      pVf   V P                  W4      p\        P                  ! W4      p	\        P                  ! W4      p
V'       d   V P                  WWV
4      w  rV	'       d   W^,
          ,          MRpV
\        V4      8  d	   W,          MRp\        P                  ! WRRR7      pWvV&   V# )zEWiden ``version`` over ``normalized``'s universe; memoized per shape.NF)include_lowerinclude_upper)r   r   r  r7  r   rK  rL  r  bisectbisect_leftbisect_right_span_identical_depsrW  r   from_bounds)r   re  rb  r  r  keymemowideneduniversebelowaboveprevnxts   &&&$         rJ   r  Provider._widen  s   
 ,,,---111**..z:#'+t##1I1I((3-?//
IH&&x9E'':E#88%  +08AI&TD%*S]%:(/C"..eG  IrL   c               0    V ^8  d   QhRRRRRRRRR	RR
R/# )rD   re  rF   rb  r)   r  r  r  r   r  rG   ztuple[int, int]rH   )rI   s   "rJ   rK   r	    sF     ! !! !  	!
 ! ! 
!rL   c                j   V P                   pVP                  W34      pVf   WE3# V'       d1   VP                  WV^,
          ,          34      V8X  d   V^,          pK8  V P                  V4      '       d   WE3# \        V4      pWX8  d*   VP                  WV,          34      V8X  d   V^,          pK/  WE3# )a  Extend ``[below, above)`` across neighbors with equal cached deps.

Reads ``deps_cache`` only, never fetches.  A neighbor whose cached
dependency dict is missing or differs fences the span; so does a
decided version whose own deps are not cached.

The upward half is capped when ``wants_lowest`` picks the minimum
for this package, the same per-package answer ``choose_version``
orders candidates by.  Under a lowest preference the answer sits
near the floor, so an upward span carries the search away from it
a whole run at a time; capping leaves the plain neighbor gap
there, and the search resumes at the adjacent listed version.
Every other package spans both ways.
)r8  r   r$  rW  )	r   re  rb  r  r  r  r  r  tops	   &&&&&&   rJ   r  Provider._span_identical_deps  s    , zz:/0<<

J0C#DEMQJEZ((<(mkfjj*uo)FG4OQJE|rL   c               $    V ^8  d   QhRRRRRR/# )rD   rE   r   
constraintr  rG   rH   )rI   s   "rJ   rK   r	    s$     0 00+A0	0rL   c                  a \        V\        4      '       g   S# V P                  V4      w   r4V P                  P	                  V4      pVf   S# \        S\
        4      '       g   Q hV P                  WE4      pV'       df   VR,          S9   dX   \        ;QJ d    V3R lV 4       F  '       d   K   RM	  RM! V3R lV 4       4      '       d   \
        P                  ! RR7      # SP                  V4      # )a  Map a possibly-widened ``constraint`` back onto listed versions.

A constraint containing every listed version is promoted to the full
range rather than snapped, so it reads as "any version".  An empty
universe never promotes: that would widen a constraint no version
satisfies.

Render-time only and cache-only: the ROOT sentinel (a non-str
package) and packages whose listing is not cached return
``constraint`` unchanged, and nothing is ever fetched.
c              3  ,   <"   T F	  qS9   x  K  	  R # 5ir   rH   )r   rb  r  s   & rJ   r   .Provider.narrow_for_display.<locals>.<genexpr>  s     Bgz)s   FT)admit_arbitrary)
r  rF   r]  r7  r   r   r  allfullsnap_bounds)r   rE   r  rd  re  r  r  s   &&f    rJ   narrow_for_displayProvider.narrow_for_display  s     '3''33G<1**..z:*l3333++JE
*BBBBBB$$U;;%%h//rL   c                    V ^8  d   QhRRRR/# )rD   r  r  rG   rF   rH   )rI   s   "rJ   rK   r	    s     " "'= "# "rL   c                    \        V\        4      '       g   Q hVP                  '       d   R# V( P                  '       d   R# VP                  4       pVf   \	        V4      # \	        V4      # )a6  Render ``constraint`` for a failure report.

``VersionRange`` has no ``__str__``, so interpolating one gives the
debug repr, including the internal boundary-kind sentinels.  A range a
specifier set can spell reads as that specifier set, so ``==3.0.0``
shows the way a user would have written it.

An unconstrained range renders as nothing, leaving the package name to
carry the line, and the empty range gets a phrase rather than the
``<0`` a specifier set spells it with.  A range with no specifier
spelling, such as a disjunction, keeps the range's own rendering.
z
no version )r  r   is_emptyto_specifier_setrF   )r   r  specifier_sets   && rJ   r  Provider.format_range  s`     *l3333K!!!"335 z?"=!!rL   c               $    V ^8  d   QhRRRRRR/# )rD   rE   rF   rb  r)   rG   dict[str, VersionRange]rH   )rI   s   "rJ   rK   r	    s$     5* 5*5*%,5*	 5*rL   c                   V P                   ;P                  ^,          un        V P                  V4      w  r4pVe   V P                  W4V4      # WR3pW`P                  9   d   V P                  V,          # V P
                  P                  V4      pVe   \        V4      hV P                  P                  V4      pVe   \        V4      hV P                  V4      p	W`P                  9   df   WPP                  9   g!   WPP                  9   g   WPP                  9   d6   V P                  W`P                  V,          4       V P                  V,          # V P!                  WR4      eR   V P                  V\#        WRR7      4       V P%                  V P                  V,          4       V P                  V,          # V P'                  WV4      w  rV P)                  WjVR7       V P+                  WV4       V P                   ;P,                  ^,          un        V P%                  V P                  V,          4       V P                  V,          # )z8Fetch .metadata and return dependencies as VersionRange.)r   rb  
from_sdist)r   r   r]  _get_extra_dependenciesr8  r<  r   rA   r=  r:   rj  r9  r   r   r  _cache_deps_from_metadatar  r   prefetch_new_deps_resolve_metadata!_parse_and_cache_metadata_guarded"_check_sibling_metadata_divergencer   )r   rE   rb  rN   rO   re  	cache_keycached_unsupportedcached_invalidr  metadata_textr
  s   &&&         rJ   get_dependenciesProvider.get_dependencies  s    	

))Q.)"&":":7"CZ//WEE)	'??9--!5599)D)'(:;;//33I>%//&&w/ +++,,,---111**96I6I)6TU??9-- &&z;G**=jJ ""4??9#=>??9--$($:$:8g$V!.. 	/ 	
 	//7K

##q(#ty9:y))rL   c               (    V ^8  d   QhRRRRRRRR/# 	rD   r  tuple[str, Version]r  rF   r
  r   rG   r   rH   )rI   s   "rJ   rK   r	  L  s,     /. /.,/.=@/.QU/.	/.rL   c          	        Vw  rE^RI Hp  V P                  WVR7       R#   \         d   p\	        T4      T P
                  T&   h Rp?i\        \        3 d   p\	        T4      T P                  T&   h Rp?i\        \        \        \        \        \        T3 d    h \         dC   p\         P#                  RTTT4       RT RT RT 2pYP                  T&   \%        T4      ThRp?ii ; i)a  Parse fetched metadata, routing each failure to its own cache.

A disallowed build, a candidate ruled out by its own metadata, and an
unparseable payload each record their own failure kind so a re-query
is answered from cache. Hard errors propagate unrecorded.
r  r	  NzSkipping %s==%s: metadata cannot be parsed (%s). Subsequent lookups for this version reuse the cached failure and do not re-emit this warning.zInvalid metadata for r  z: )r  r  parse_and_cache_metadatarA   rF   r<  r5   r6   r=  r   r
   r   r   r>  r7   	Exceptionloggerwarningr:   )	r   r  r  r
  rE   rb  r  r_  ra  s	   &&&$     rJ   r  *Provider._parse_and_cache_metadata_guardedL  s     %1#	.))Z *  % 	25c(D$$Y/$&=> 	03CD""9-"%"!
 	  	.NN<  *'"WIRuEC03""9-$#-	.s>   ! C(AC(C(A22'C(
C(%C(&=C##C(c                    V ^8  d   QhRRRR/# )rD   r  r  rG   r   rH   )rI   s   "rJ   rK   r	  }  s     / /&= /$ /rL   c                2    \         P                  ! W4       R# )z;See :func:`nab_python._provider.listing.prefetch_new_deps`.N)ri  r  )r   r  s   &&rJ   r  Provider.prefetch_new_deps}  s    ""4.rL   c               (    V ^8  d   QhRRRRRRRR/# )	rD   r  r   rE   rF   rb  r)   rG   ztuple[str, bool]rH   )rI   s   "rJ   rK   r	    s8     U U0U U 	U
 
UrL   c                0    \         P                  ! WW#4      # )zDSee :func:`nab_python._provider.metadata_resolver.resolve_metadata`.)_metadata_resolverresolve_metadatar   r  rE   rb  s   &&&&rJ   r  Provider._resolve_metadata  s     "2247TTrL   c               (    V ^8  d   QhRRRRRRRR/# )	rD   r  r   rE   rF   rb  r)   rG   r   rH   )rI   s   "rJ   rK   r	    s2     
 
0
 
 	

 

rL   c                4    \         P                  ! WW#4       R# )zCheck the version's tie-ranked wheels for divergent target deps.

See :func:`._provider.metadata_resolver.check_sibling_metadata_divergence`.
N)r%  !check_sibling_metadata_divergencer'  s   &&&&rJ   r  +Provider._check_sibling_metadata_divergence  s     	<<G	
rL   r
  c               (    V ^8  d   QhRRRRRRRR/# r  rH   )rI   s   "rJ   rK   r	    s2     

 

&

 


 

 


rL   c               6    \         P                  ! WW#R7       R# )zBSee :func:`._provider.metadata_resolver.parse_and_cache_metadata`.r	  N)r%  r  )r   r  r  r
  s   &&&$rJ   r  !Provider.parse_and_cache_metadata  s     	33]	
rL   c               $    V ^8  d   QhRRRRRR/# )rD   r  r  metadatar   rG   r   rH   )rI   s   "rJ   rK   r	    s-     O O&O  O 
	OrL   c                4    \         P                  ! WV4       R# )zBSee :func:`._provider.metadata_resolver.cache_deps_from_metadata`.N)r%  cache_deps_from_metadata)r   r  r1  s   &&&rJ   r  "Provider._cache_deps_from_metadata  s     	33DXNrL   c               (    V ^8  d   QhRRRRRRRR/# )rD   rN   rF   rO   rb  r)   rG   r  rH   )rI   s   "rJ   rK   r	    s8     J JJ J 	J
 
!JrL   c                0    \         P                  ! WW#4      # )z?See :func:`nab_python._provider.extras.get_extra_dependencies`.)r2  get_extra_dependencies)r   rN   rO   rb  s   &&&&rJ   r   Provider._get_extra_dependencies  s     --d%IIrL   c                    V ^8  d   QhRRRR/# )rD   rE   rF   rG   ztuple[str, str | None, str]rH   )rI   s   "rJ   rK   r	    s     	 	3 	3N 	rL   c                    V P                   P                  V4      pVe   V# \        V4      w  r4\        V4      pW4V3pW`P                   V&   V# )zBReturn ``(base, extra, normalized_base)`` for ``package``, cached.)rF  r   rT   r   )r   rE   r  rN   rO   re  r   s   &&     rJ   r]  Provider.split_and_normalize  sV    $$((1M!'*&t,
z*'-G$rL   c                   V ^8  d   QhRR/# r   rH   )rI   s   "rJ   rK   r	    s     # #T #rL   c                8    V ;P                   ^,          un         R# )zOpen a decision scan, expiring the last one's in-flight answers.

The coming scan re-reads the index, then holds any name it finds still
in flight that way until the next call.
N)r?  r   s   &rJ   begin_decision_scanProvider.begin_decision_scan  s     	"rL   c                    V ^8  d   QhRRRR/# rD   re  rF   rG   zlist[DistFile] | NonerH   )rI   s   "rJ   rK   r	    s      # 2G rL   c                    V P                   P                  V4      V P                  8X  d   R# V P                  P                  P                  V4      pVf   V P                  V P                   V&   V# )a  Return ``normalized``'s listing, or None while it is in flight.

The fetcher thread publishes listings asynchronously, so a bare index
read can answer differently for two packages compared inside one
decision scan, and differently for the two halves of one package's
sort key.  A name first seen in flight stays in flight until the next
``begin_decision_scan``, so one scan sorts against one view of what
has landed.
N)r@  r   r?  r   rq  r  r   re  r   s   && rJ   arrived_listingProvider.arrived_listing  sb     $$((48M8MM""((44Z@?484I4ID%%j1rL   c                    V ^8  d   QhRRRR/# rA  rH   )rI   s   "rJ   rK   r	    s     > ># >2G >rL   c                F   V P                   P                  P                  V4      pVe   V# V P                   P                  P                  V4      e   R# V P                   P	                  V4      P                  4        V P                   P                  P                  V4      # )a  Return ``normalized``'s listing, waiting once for it to land.

The blocking counterpart of :meth:`arrived_listing`, used by the
decision scan under :attr:`DecisionOrder.STABLE`: waiting for the
fetch gives the scan the same version count whatever the HTTP
cache held, where reading what has arrived so far does not.

A listing that already failed is not re-requested, and one wait is
enough because every terminal path in the fetcher sets the event.
``None`` still means there is no listing to count, so a caller must
not spin on it.
N)r   rq  r  get_listing_errorr^  waitrC  s   && rJ   settled_listingProvider.settled_listing  s     ""((44Z@N!!33J?K((499;%%11*==rL   c                    V ^8  d   QhRRRR/# )rD   rE   rF   rG   r   rH   )rI   s   "rJ   rK   r	    s     < < < <rL   c                    V P                  V4      w  r#pVe   W@P                  9   # W@P                  9   d   R# V P                  V4      RJ# )a  Check if a package's listing is available without blocking.

Used by the resolver to prefer packages with cached data,
letting it make progress while other listings are in flight.

Under :attr:`DecisionOrder.STABLE` it needs no blocking half of its
own.  ``prioritize`` runs first in the same sort key and has already
settled the listing into ``versions_cache``; what is left is a
failed listing or a package served from a local, VCS, or archive
source, and no listing is ever requested for those.
NT)r]  r7  rD  )r   rE   rd  rO   re  s   &&   rJ   is_readyProvider.is_ready  sS      $77@*!4!444,,,##J/t;;rL   c          
     ,    V ^8  d   QhRRRRRRRRR	R
/# )rD   rE   rF   r  r  conflict_countszMapping[str, int]culprit_countszMapping[str, int] | NonerG   ztuple[int, int, bool]rH   )rI   s   "rJ   rK   r	  	  s<     
 

 .
 +	

 1
 

rL   c                2    \         P                  ! WW#V4      # )a  Prioritize packages for resolution order.

Returns ``(tier, matching_count, is_base)``.  Affected packages
with high ``conflict_counts`` are promoted to tier 0 so they
decide first inside a conflict cluster; runaway culprits with
high ``culprit_counts`` are demoted to tier 2 (uv's
deprioritise-on-conflict).  Everything else is tier 1.

See :mod:`nab_python._provider.priority` for the implementation.
)	_priority
prioritize)r   rE   r  rQ  rR  s   &&&&&rJ   rU  Provider.prioritize	  s    " ##=>
 	
rL   c                    V ^8  d   QhRRRR/# )rD   ro  rF   rG   zLocalSource | NonerH   )rI   s   "rJ   rK   r	  	  s     I Is I7I IrL   c                J    V P                   P                  \        V4      4      # )zDReturn the local source registered under ``canonical_name`` or None.)r   r   r   rs  s   &&rJ   local_source_forProvider.local_source_for	  s    !!%%&7&GHHrL   c                    V ^8  d   QhRRRR/# )rD   ro  rF   rG   zVcsSource | NonerH   )rI   s   "rJ   rK   r	  	  s     G GS G5E GrL   c                J    V P                   P                  \        V4      4      # )zBReturn the VCS source registered under ``canonical_name`` or None.)r   r   r   rs  s   &&rJ   vcs_source_forProvider.vcs_source_for	  s    ##$5n$EFFrL   c                    V ^8  d   QhRRRR/# )rD   ro  rF   rG   zArchiveSource | NonerH   )rI   s   "rJ   rK   r	  	  s     K K K9M KrL   c                J    V P                   P                  \        V4      4      # )zFReturn the archive source registered under ``canonical_name`` or None.)r  r   r   rs  s   &&rJ   archive_source_forProvider.archive_source_for	  s    ##''(9.(IJJrL   c                    V ^8  d   QhRRRR/# rn  rH   )rI   s   "rJ   rK   r	  "	  s     D D# D* DrL   c                J    V P                   P                  \        V4      4      # )zReturn the post-clone commit SHA for ``canonical_name``, or None.

Written by :func:`~nab_python._provider.sources.materialize_vcs_source`
after the shallow clone resolves the ref to a 40-char SHA.
)r(  r   r   rs  s   &&rJ   vcs_pin_forProvider.vcs_pin_for"	  s     }}  !2>!BCCrL   c               $    V ^8  d   QhRRRRRR/# )rD   ro  rF   rb  r)   rG   zlist[DistFile]rH   )rI   s   "rJ   rK   r	  *	  s!     	= 	=S 	=7 	=~ 	=rL   c                    \        V4      pV P                  P                  V. 4      pV UUu. uF  w  rVWR8X  g   K  VNK  	  upp# u uppi )zReturn every distribution file the resolver saw at ``version``.

Drawn from the cached listing populated during the resolve, so
callers do not pay another fetch.  When the package was never
listed (synthetic / not asked for), returns an empty list.
)r   r7  r   )r   ro  rb  re  r   r  dists   &&&    rJ   dist_files_forProvider.dist_files_for*	  sF     '~6
%%))*b9$+<Gq|G<<<s
   
AAc               $    V ^8  d   QhRRRRRR/# )rD   ro  rF   rb  r)   rG   r   rH   )rI   s   "rJ   rK   r	  5	  s'     Q Qs QW QQT QrL   c                R    \        V4      pV P                  P                  W23^ 4      # )zIReturn how many wheels the tag filter dropped at ``version`` (0 if none).)r   r5  r   )r   ro  rb  re  s   &&& rJ   tag_excluded_wheel_count!Provider.tag_excluded_wheel_count5	  s(    &~6
2266
7LaPPrL   )Fr@  rJ  r  r  r[  rZ  rL  r"  r!  r=  rY  r   rF  r  r\  r  r?  r<  rK  r  r  r6  r  r   r   rB  r   r;  r8  r,  r+  r:  r   r  r   rC  rD  rE  r>  r9  r%  rP  rO  rU  rX  rQ  rV  rW  rG  r   rA  r   r   r  rN  rM  r   r4  r5  r   r   r   r  r   r(  r   r7  rH  rI  r3  rH   r   )jr\   r]   r^   r_   r`   r   r   r   r   r   ri  rq  rT  TIER_AFFECTEDTIER_NORMALTIER_CULPRITCONFLICT_THRESHOLDCULPRIT_DEMOTE_THRESHOLDr4   rg   r3   rr   r1   rx   r>   r}   r2   r   r   rj  rt  r  r  r  r  r  r  r  r  r  r  staticmethodr  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r,  r   rB  r'  r"  rI  r\  rj  ro  rp  r$  r&  rJ  r  rY  r[  r  r4  r!  r<  r=  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r]  r>  rD  rJ  rN  rU  rY  r]  ra  re  rj  rn  ra   rH   rL   rJ   r<   r<     s   !T NC
 NC  "! !##" "#
 %&!++M''K))L"55(AA
 (,<@-1","7"737",";";$/$;$;79>B'+26.2%)6:)-048J8R8R1548:>-c=0 :>1c=2 -23c=4 )6(=(=5c= c=J	6H4!$./>(%*(,'$7:
,    "*XCC	FIBQFH-
^)-VGCR DW9 +/9v!&F( 8
2g4
 &*g4 .2g4R:x6R@,"
IM
.
(D6	< D!F0<".5*n/.b/U



 !

OJ	#">*<&
*IGKD	=Q QrL   )r0   r1   r2   DistFiler3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   r   r   r   rB   rY   rT   )ur`   
__future__r   r  enumloggingrecollectionsr   r   dataclassesr   r   typingr   r   nab_index.clientr	   r
   r   r   r   r   nab_index.errorsr   nab_index.transportr   _conflict_kindr   	_providerr   r2  r   ri  r   rR  r   r%  r   rT  r   r&  _vcs_admissionr   r   r   _vendor.packaging.rangesr   _vendor.packaging.utilsr   r1  r   r   r   	threadingcollections.abcr    r!   r"   r#   pathlibr$   nab_resolver.typesr%   r&   _vendor.packaging.markersr'   _vendor.packaging.requirementsr(   _vendor.packaging.versionr)   r  r*   r+   r,   fetchr-   r2  r.   r/   __all__	getLoggerr\   r  compilerP   rT   rY   r  r;   Enumr4   rj   r3   r1   r>   r2   r9   rB   r0   r:   rA   r5   r6   r7   r?   r@   r=   rv  r   r   r   r8   r   r   r   r<   rH   rL   rJ   <module>r     sf   #    	 * ) &  . 3 1 ( * . > , * 
 3 6 # $;;!A1;2HH'%: 
		8	$JJAB	B1M	 M
= 
=$))   >$$)) $N> >"ODII O $d#$ $ $$& $d#  $ $d#  $?I ?M = m XY XY i  # # #> y  uA6-+@AuuA6-+@AA@
0 0j 
XQ XQrL   