TypeCast/s9160605122 | TypeCast/Aleksyav | ||||
---|---|---|---|---|---|
f | 1 | from functools import wraps | f | 1 | from functools import wraps |
2 | 2 | ||||
3 | 3 | ||||
n | 4 | def cast(target_type): | n | 4 | def cast(t): |
5 | def decarator(f): | 5 | def decorator(f): | ||
6 | @wraps(f) | 6 | @wraps(f) | ||
7 | def newfun(*args, **kwargs): | 7 | def newfun(*args, **kwargs): | ||
n | 8 | return target_type(f(*args, **kwargs)) | n | 8 | return t(f(*args, **kwargs)) |
9 | return newfun | 9 | return newfun | ||
t | 10 | return decarator | t | 10 | return decorator |
11 | 11 |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|