Skip to content

Commit b5a8b3b

Browse files
committed
Fixed flake8 errors and add docstrings
1 parent 22b394a commit b5a8b3b

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

versions.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env python
22

33
import argparse
4-
from urllib import request
54
import re
5+
from urllib import request
66

77
import pandas as pd
88
from packaging.specifiers import SpecifierSet
@@ -169,19 +169,7 @@ def get_min_scipy_version(min_python, min_numpy):
169169

170170
def get_minor_versions_between(start_version_str, end_version_str):
171171
"""
172-
Returns a list of all minor Python versions between two specified minor versions.
173-
Assumes semantic versioning (MAJOR.MINOR.PATCH) and only considers minor versions
174-
within the same major version.
175-
176-
Args:
177-
start_version_str (str): The starting version string (e.g., "3.6.0").
178-
end_version_str (str): The ending version string (e.g., "3.9.5").
179-
180-
Returns:
181-
list: A list of strings representing the minor versions in between,
182-
including the start and end minor versions if they are distinct.
183-
Returns an empty list if the start version is greater than or equal
184-
to the end version, or if major versions differ.
172+
Returns a list of all minor Python versions between two specified minor versions
185173
"""
186174
try:
187175
start_parts = [int(x) for x in start_version_str.split(".")]
@@ -201,7 +189,8 @@ def get_minor_versions_between(start_version_str, end_version_str):
201189

202190
if start_minor >= end_minor:
203191
print(
204-
"Warning: Start minor version is not less than end minor version. Returning an empty list."
192+
"Warning: Start minor version is not less than end minor version."
193+
"Returning an empty list."
205194
)
206195
return []
207196

@@ -213,6 +202,9 @@ def get_minor_versions_between(start_version_str, end_version_str):
213202

214203

215204
def get_latest_numpy_version():
205+
"""
206+
Retrieve the latest NumPy version
207+
"""
216208
url = "https://pypi.org/project/numpy/"
217209
req = request.Request(url, data=None, headers=HEADERS)
218210
html = request.urlopen(req).read().decode("utf-8")
@@ -221,6 +213,9 @@ def get_latest_numpy_version():
221213

222214

223215
def check_python_version(row):
216+
"""
217+
Ensure that the Python version is compatible with Numba and SciPy
218+
"""
224219
versions = get_minor_versions_between(
225220
row.START_PYTHON_VERSION, row.END_PYTHON_VERSION
226221
)
@@ -233,6 +228,9 @@ def check_python_version(row):
233228

234229

235230
def check_numpy_version(row):
231+
"""
232+
Ensure that the NumPy version is compatible with the NumPy Specs
233+
"""
236234
if row.NUMPY in row.NUMPY_SPEC:
237235
return row.NUMPY
238236
else:

0 commit comments

Comments
 (0)