| 1363 | |
| 1364 | |
| 1365 | def _swap_method_fallback(method_type, swap_with): |
| 1366 | # type: (str, str) -> bool |
| 1367 | if str(METHOD_CACHE[method_type]) == swap_with: |
| 1368 | return True |
| 1369 | |
| 1370 | found = None # type: Optional[Method] |
| 1371 | for f_meth in FALLBACK_CACHE[method_type]: |
| 1372 | if str(f_meth) == swap_with: |
| 1373 | found = f_meth |
| 1374 | break |
| 1375 | |
| 1376 | if not found: |
| 1377 | return False |
| 1378 | |
| 1379 | curr = METHOD_CACHE[method_type] |
| 1380 | FALLBACK_CACHE[method_type].remove(found) |
| 1381 | METHOD_CACHE[method_type] = found |
| 1382 | FALLBACK_CACHE[method_type].insert(0, curr) # noqa: T484 |
| 1383 | |
| 1384 | return True |
| 1385 | |
| 1386 | |
| 1387 | def _warn_critical(err_msg): |