1
1
"""Routines related to PyPI, indexes"""
2
+ from __future__ import annotations
2
3
4
+ import datetime
3
5
import enum
4
6
import functools
5
7
import itertools
@@ -131,7 +133,7 @@ def __init__(
131
133
target_python : TargetPython ,
132
134
allow_yanked : bool ,
133
135
ignore_requires_python : Optional [bool ] = None ,
134
- upload_before : Optional [datetime .datetime ] = None ,
136
+ exclude_newer_than : Optional [datetime .datetime ] = None ,
135
137
) -> None :
136
138
"""
137
139
:param project_name: The user supplied package name.
@@ -149,7 +151,7 @@ def __init__(
149
151
:param ignore_requires_python: Whether to ignore incompatible
150
152
PEP 503 "data-requires-python" values in HTML links. Defaults
151
153
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.
153
155
"""
154
156
if ignore_requires_python is None :
155
157
ignore_requires_python = False
@@ -159,7 +161,7 @@ def __init__(
159
161
self ._ignore_requires_python = ignore_requires_python
160
162
self ._formats = formats
161
163
self ._target_python = target_python
162
- self ._upload_before = upload_before
164
+ self ._exclude_newer_than = exclude_newer_than
163
165
164
166
self .project_name = project_name
165
167
@@ -178,9 +180,9 @@ def evaluate_link(self, link: Link) -> tuple[LinkType, str]:
178
180
reason = link .yanked_reason or "<none given>"
179
181
return (LinkType .yanked , f"yanked for reason: { reason } " )
180
182
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 } "
184
186
return (LinkType .upload_too_late , reason )
185
187
186
188
if link .egg_fragment :
@@ -600,7 +602,7 @@ def __init__(
600
602
format_control : Optional [FormatControl ] = None ,
601
603
candidate_prefs : Optional [CandidatePreferences ] = None ,
602
604
ignore_requires_python : Optional [bool ] = None ,
603
- upload_before : Optional [datetime .datetime ] = None ,
605
+ exclude_newer_than : Optional [datetime .datetime ] = None ,
604
606
) -> None :
605
607
"""
606
608
This constructor is primarily meant to be used by the create() class
@@ -622,7 +624,7 @@ def __init__(
622
624
self ._ignore_requires_python = ignore_requires_python
623
625
self ._link_collector = link_collector
624
626
self ._target_python = target_python
625
- self ._upload_before = upload_before
627
+ self ._exclude_newer_than = exclude_newer_than
626
628
627
629
self .format_control = format_control
628
630
@@ -646,7 +648,7 @@ def create(
646
648
link_collector : LinkCollector ,
647
649
selection_prefs : SelectionPreferences ,
648
650
target_python : Optional [TargetPython ] = None ,
649
- upload_before : Optional [datetime .datetime ] = None ,
651
+ exclude_newer_than : Optional [datetime .datetime ] = None ,
650
652
) -> "PackageFinder" :
651
653
"""Create a PackageFinder.
652
654
@@ -655,7 +657,7 @@ def create(
655
657
:param target_python: The target Python interpreter to use when
656
658
checking compatibility. If None (the default), a TargetPython
657
659
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.
659
661
"""
660
662
if target_python is None :
661
663
target_python = TargetPython ()
@@ -672,7 +674,7 @@ def create(
672
674
allow_yanked = selection_prefs .allow_yanked ,
673
675
format_control = selection_prefs .format_control ,
674
676
ignore_requires_python = selection_prefs .ignore_requires_python ,
675
- upload_before = upload_before ,
677
+ exclude_newer_than = exclude_newer_than ,
676
678
)
677
679
678
680
@property
@@ -751,7 +753,7 @@ def make_link_evaluator(self, project_name: str) -> LinkEvaluator:
751
753
target_python = self ._target_python ,
752
754
allow_yanked = self ._allow_yanked ,
753
755
ignore_requires_python = self ._ignore_requires_python ,
754
- upload_before = self ._upload_before ,
756
+ exclude_newer_than = self ._exclude_newer_than ,
755
757
)
756
758
757
759
def _sort_links (self , links : Iterable [Link ]) -> list [Link ]:
0 commit comments