Skip to content

Commit f891ec7

Browse files
committed
chore: Fix ruff build failures
1 parent ac05f12 commit f891ec7

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

machine_learning/linear_discriminant_analysis.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
from math import log
4848
from os import name, system
4949
from random import gauss, seed
50-
from typing import TypeVar
5150

5251

5352
# Make a training dataset drawn from a gaussian distribution
@@ -249,10 +248,7 @@ def accuracy(actual_y: list, predicted_y: list) -> float:
249248
return (correct / len(actual_y)) * 100
250249

251250

252-
num = TypeVar("num")
253-
254-
255-
def valid_input(
251+
def valid_input[num](
256252
input_type: Callable[[object], num], # Usually float or int
257253
input_msg: str,
258254
err_msg: str,

searches/jump_search.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,14 @@
1010

1111
import math
1212
from collections.abc import Sequence
13-
from typing import Any, Protocol, TypeVar
13+
from typing import Any, Protocol
1414

1515

1616
class Comparable(Protocol):
1717
def __lt__(self, other: Any, /) -> bool: ...
1818

1919

20-
T = TypeVar("T", bound=Comparable)
21-
22-
23-
def jump_search(arr: Sequence[T], item: T) -> int:
20+
def jump_search[T: Comparable](arr: Sequence[T], item: T) -> int:
2421
"""
2522
Python implementation of the jump search algorithm.
2623
Return the index if the `item` is found, otherwise return -1.

0 commit comments

Comments
 (0)