fix(ex4): add wraps to every functions;

mypy compliance
This commit is contained in:
2026-03-29 13:33:56 +02:00
parent 1dfeee81e3
commit 1cf669e6f8
6 changed files with 60 additions and 268 deletions
+3 -3
View File
@@ -1,6 +1,5 @@
from functools import lru_cache, reduce, partial, singledispatch
import operator as op
import re
from typing import Callable, Any
@@ -27,6 +26,7 @@ def partial_enchanter(base_enchantment: Callable) -> dict[str, Callable]:
}
@lru_cache
def memoized_fibonacci(n: int) -> int:
if n < 2:
return n
@@ -35,7 +35,7 @@ def memoized_fibonacci(n: int) -> int:
def spell_dispatcher() -> Callable:
@singledispatch
def basic(arg: Any) -> str:
def basic(arg: Any) -> Any:
return arg
@basic.register(int)
@@ -47,7 +47,7 @@ def spell_dispatcher() -> Callable:
return f"apply {arg}"
@basic.register(list)
def basic_list(arg: list) -> str:
def basic_list(arg: list[Any]) -> str:
res = ""
for cast in arg:
res += f"cast {cast}\n"