Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion machine_learning/sequential_minimum_optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ def test_cancer_data():
print("Hello!\nStart test SVM using the SMO algorithm!")
# 0: download dataset and load into pandas' dataframe
if not os.path.exists(r"cancer_data.csv"):
request = urllib.request.Request(
request = urllib.request.Request( # noqa: S310, RUF100
Comment thread
cclauss marked this conversation as resolved.
Outdated
CANCER_DATASET_URL,
headers={"User-Agent": "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)"},
)
Expand Down
10 changes: 10 additions & 0 deletions sorts/radix_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,17 @@ def radix_sort(list_of_ints: list[int]) -> list[int]:
True
>>> radix_sort([1,100,10,1000]) == sorted([1,100,10,1000])
True
>>> radix_sort([-1, 2, 3])
Traceback (most recent call last):
...
ValueError: All elements in list_of_ints must be non-negative integers
"""
if not list_of_ints:
return []

if any(i < 0 for i in list_of_ints):
raise ValueError("All elements in list_of_ints must be non-negative integers")

placement = 1
max_digit = max(list_of_ints)
while placement <= max_digit:
Expand Down