Данила Ковтун, 428 группа InitParam 14207
Кравченко Роман, 420 InitParam 14524
n1from types import FunctionType, GenericAliasn1from types import FunctionType
2import inspect2import inspect
33
4class init(type):4class init(type):
55
n6    def __new__(metacls, name, parents, ns):n6    def __new__(metaclass, name, parents, ns):
7        for (i, j) in ns.items():7        for (i, j) in ns.items():
8            if isinstance(j, FunctionType):8            if isinstance(j, FunctionType):
n9                default = []n9                lst = []
10                for (l, m) in inspect.signature(j).parameters.items():10                for (l, m) in inspect.signature(j).parameters.items():
11                    if not inspect._empty is m.annotation:11                    if not inspect._empty is m.annotation:
12                        try:12                        try:
n13                            default.append(m.annotation())n13                            lst.append(m.annotation())
14                        except:14                        except:
n15                            default.append(None)n15                            lst.append(None)
16                if j.__defaults__ is not None:16                if j.__defaults__ is not None:
t17                    length = len(j.__defaults__)t17                    l = len(j.__defaults__)
18                    default[-length:] = j.__defaults__18                    lst[-l:] = j.__defaults__
19                j.__defaults__ = tuple(default)19                j.__defaults__ = tuple(lst)
20        return super().__new__(metacls, name, parents, ns)20        return super().__new__(metaclass, name, parents, ns)
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op