(c, scope)
| 85 | cls = obj.__origin__ |
| 86 | |
| 87 | def inner(c, scope): |
| 88 | if isinstance(c, type): |
| 89 | cls = c |
| 90 | new_scope = {} |
| 91 | else: |
| 92 | cls = getattr(c, "__origin__", None) |
| 93 | if cls in (None, object, typing.Generic) or cls in mapping: |
| 94 | return |
| 95 | params = cls.__parameters__ |
| 96 | args = tuple(_apply_params(a, scope) for a in c.__args__) |
| 97 | assert len(params) == len(args) |
| 98 | mapping[cls] = new_scope = dict(zip(params, args)) |
| 99 | |
| 100 | if issubclass(cls, typing.Generic): |
| 101 | bases = getattr(cls, "__orig_bases__", cls.__bases__) |
| 102 | for b in bases: |
| 103 | inner(b, new_scope) |
| 104 | |
| 105 | inner(obj, {}) |
| 106 | return cls.__mro__, mapping |
searching dependent graphs…