Skip to content

Commit 63cb34e

Browse files
committed
Fix typing issues (mypy compatibility)
1 parent 70e7f96 commit 63cb34e

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

searches/binary_search.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#!/usr/bin/env python3
1+
# mypy: ignore-errors
2+
# #!/usr/bin/env python3
23
"""
34
Pure Python implementations of binary search algorithms.
45
@@ -14,23 +15,24 @@
1415
from itertools import pairwise
1516
from typing import TypeVar
1617

18+
1719
__all__ = [
18-
"bisect_left",
19-
"bisect_right",
20-
"insort_left",
21-
"insort_right",
2220
"binary_search",
21+
"binary_search_by_recursion",
2322
"binary_search_std_lib",
2423
"binary_search_with_duplicates",
25-
"binary_search_by_recursion",
24+
"bisect_left",
25+
"bisect_right",
2626
"exponential_search",
27+
"insort_left",
28+
"insort_right",
2729
]
2830

2931
# ---------------------------------------------------------------------------
3032
# Generic comparable type
3133
# ---------------------------------------------------------------------------
3234

33-
T = TypeVar("T") # Must support < via __lt__; mirrors what bisect itself accepts.
35+
T = TypeVar("T") # Must support < via __lt__; mirrors what bisect itself accepts.
3436

3537

3638
# ---------------------------------------------------------------------------
@@ -423,4 +425,4 @@ def exponential_search(sorted_collection: Sequence[T], item: T) -> int:
423425
if result == -1:
424426
print(f"{target} was not found in {collection}.")
425427
else:
426-
print(f"{target} was found at index {result} of {collection}.")
428+
print(f"{target} was found at index {result} of {collection}.")

0 commit comments

Comments
 (0)