From b8b0d2efad7e4a0071cd13acc993360be5806134 Mon Sep 17 00:00:00 2001 From: Mister Lobster Date: Sat, 2 May 2026 21:57:36 -0400 Subject: [PATCH 1/2] refactor: improve type hints in linear_search.py - Add typing import for Any type - Update linear_search parameter types from list/int to list[Any]/Any - Update rec_linear_search parameter types from list/int to list[Any]/Any - Improves type safety and IDE support while maintaining functionality Fixes #14592 --- searches/linear_search.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/searches/linear_search.py b/searches/linear_search.py index 8adb4a7015f0..4c371b71fb97 100644 --- a/searches/linear_search.py +++ b/searches/linear_search.py @@ -9,7 +9,10 @@ """ -def linear_search(sequence: list, target: int) -> int: +from typing import Any + + +def linear_search(sequence: list[Any], target: Any) -> int: """A pure Python implementation of a linear search algorithm :param sequence: a collection with comparable items (sorting is not required for @@ -33,7 +36,7 @@ def linear_search(sequence: list, target: int) -> int: return -1 -def rec_linear_search(sequence: list, low: int, high: int, target: int) -> int: +def rec_linear_search(sequence: list[Any], low: int, high: int, target: Any) -> int: """ A pure Python implementation of a recursive linear search algorithm From 9e0ae92f1210051c084cee5fd6abf4e56043f287 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 3 May 2026 02:11:22 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- searches/linear_search.py | 1 - 1 file changed, 1 deletion(-) diff --git a/searches/linear_search.py b/searches/linear_search.py index 4c371b71fb97..b8d7d0a58094 100644 --- a/searches/linear_search.py +++ b/searches/linear_search.py @@ -8,7 +8,6 @@ python3 linear_search.py """ - from typing import Any