(self, bases)
| 1242 | return result |
| 1243 | |
| 1244 | def __mro_entries__(self, bases): |
| 1245 | res = [] |
| 1246 | if self.__origin__ not in bases: |
| 1247 | res.append(self.__origin__) |
| 1248 | |
| 1249 | # Check if any base that occurs after us in `bases` is either itself a |
| 1250 | # subclass of Generic, or something which will add a subclass of Generic |
| 1251 | # to `__bases__` via its `__mro_entries__`. If not, add Generic |
| 1252 | # ourselves. The goal is to ensure that Generic (or a subclass) will |
| 1253 | # appear exactly once in the final bases tuple. If we let it appear |
| 1254 | # multiple times, we risk "can't form a consistent MRO" errors. |
| 1255 | i = bases.index(self) |
| 1256 | for b in bases[i+1:]: |
| 1257 | if isinstance(b, _BaseGenericAlias): |
| 1258 | break |
| 1259 | if not isinstance(b, type): |
| 1260 | meth = getattr(b, "__mro_entries__", None) |
| 1261 | new_bases = meth(bases) if meth else None |
| 1262 | if ( |
| 1263 | isinstance(new_bases, tuple) and |
| 1264 | any( |
| 1265 | isinstance(b2, type) and issubclass(b2, Generic) |
| 1266 | for b2 in new_bases |
| 1267 | ) |
| 1268 | ): |
| 1269 | break |
| 1270 | elif issubclass(b, Generic): |
| 1271 | break |
| 1272 | else: |
| 1273 | res.append(Generic) |
| 1274 | return tuple(res) |
| 1275 | |
| 1276 | def __getattr__(self, attr): |
| 1277 | if attr in {'__name__', '__qualname__'}: |
nothing calls this directly
no test coverage detected