11"""Routines related to PyPI, indexes"""
2+ from __future__ import annotations
23
4+ import datetime
35import enum
46import functools
57import itertools
@@ -131,7 +133,7 @@ def __init__(
131133 target_python : TargetPython ,
132134 allow_yanked : bool ,
133135 ignore_requires_python : Optional [bool ] = None ,
134- upload_before : Optional [datetime .datetime ] = None ,
136+ exclude_newer_than : Optional [datetime .datetime ] = None ,
135137 ) -> None :
136138 """
137139 :param project_name: The user supplied package name.
@@ -149,7 +151,7 @@ def __init__(
149151 :param ignore_requires_python: Whether to ignore incompatible
150152 PEP 503 "data-requires-python" values in HTML links. Defaults
151153 to False.
152- :param upload_before : If set, only allow links prior to the given date.
154+ :param exclude_newer_than : If set, only allow links prior to the given date.
153155 """
154156 if ignore_requires_python is None :
155157 ignore_requires_python = False
@@ -159,7 +161,7 @@ def __init__(
159161 self ._ignore_requires_python = ignore_requires_python
160162 self ._formats = formats
161163 self ._target_python = target_python
162- self ._upload_before = upload_before
164+ self ._exclude_newer_than = exclude_newer_than
163165
164166 self .project_name = project_name
165167
@@ -178,9 +180,9 @@ def evaluate_link(self, link: Link) -> tuple[LinkType, str]:
178180 reason = link .yanked_reason or "<none given>"
179181 return (LinkType .yanked , f"yanked for reason: { reason } " )
180182
181- if link .upload_time is not None and self ._upload_before is not None :
182- if link .upload_time > self ._upload_before :
183- reason = f"Upload time { link .upload_time } after { self ._upload_before } "
183+ if link .upload_time is not None and self ._exclude_newer_than is not None :
184+ if link .upload_time > self ._exclude_newer_than :
185+ reason = f"Upload time { link .upload_time } after { self ._exclude_newer_than } "
184186 return (LinkType .upload_too_late , reason )
185187
186188 if link .egg_fragment :
@@ -600,7 +602,7 @@ def __init__(
600602 format_control : Optional [FormatControl ] = None ,
601603 candidate_prefs : Optional [CandidatePreferences ] = None ,
602604 ignore_requires_python : Optional [bool ] = None ,
603- upload_before : Optional [datetime .datetime ] = None ,
605+ exclude_newer_than : Optional [datetime .datetime ] = None ,
604606 ) -> None :
605607 """
606608 This constructor is primarily meant to be used by the create() class
@@ -622,7 +624,7 @@ def __init__(
622624 self ._ignore_requires_python = ignore_requires_python
623625 self ._link_collector = link_collector
624626 self ._target_python = target_python
625- self ._upload_before = upload_before
627+ self ._exclude_newer_than = exclude_newer_than
626628
627629 self .format_control = format_control
628630
@@ -646,7 +648,7 @@ def create(
646648 link_collector : LinkCollector ,
647649 selection_prefs : SelectionPreferences ,
648650 target_python : Optional [TargetPython ] = None ,
649- upload_before : Optional [datetime .datetime ] = None ,
651+ exclude_newer_than : Optional [datetime .datetime ] = None ,
650652 ) -> "PackageFinder" :
651653 """Create a PackageFinder.
652654
@@ -655,7 +657,7 @@ def create(
655657 :param target_python: The target Python interpreter to use when
656658 checking compatibility. If None (the default), a TargetPython
657659 object will be constructed from the running Python.
658- :param upload_before : If set, only find links prior to the given date.
660+ :param exclude_newer_than : If set, only find links prior to the given date.
659661 """
660662 if target_python is None :
661663 target_python = TargetPython ()
@@ -672,7 +674,7 @@ def create(
672674 allow_yanked = selection_prefs .allow_yanked ,
673675 format_control = selection_prefs .format_control ,
674676 ignore_requires_python = selection_prefs .ignore_requires_python ,
675- upload_before = upload_before ,
677+ exclude_newer_than = exclude_newer_than ,
676678 )
677679
678680 @property
@@ -751,7 +753,7 @@ def make_link_evaluator(self, project_name: str) -> LinkEvaluator:
751753 target_python = self ._target_python ,
752754 allow_yanked = self ._allow_yanked ,
753755 ignore_requires_python = self ._ignore_requires_python ,
754- upload_before = self ._upload_before ,
756+ exclude_newer_than = self ._exclude_newer_than ,
755757 )
756758
757759 def _sort_links (self , links : Iterable [Link ]) -> list [Link ]:
0 commit comments