Skip to content

Commit 82b2f9e

Browse files
Fix UP047: use PEP 695 type parameter syntax in jump_search
1 parent 599353b commit 82b2f9e

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

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)