Check whether calling a function raised a ``TypeError`` because the call failed or because something in the factory raised the error. :param f: The function that was called. :return: ``True`` if the call failed.
(f: Callable)
| 38 | |
| 39 | |
| 40 | def _called_with_wrong_args(f: Callable) -> bool: |
| 41 | """Check whether calling a function raised a ``TypeError`` because |
| 42 | the call failed or because something in the factory raised the |
| 43 | error. |
| 44 | :param f: The function that was called. |
| 45 | :return: ``True`` if the call failed. |
| 46 | """ |
| 47 | tb = sys.exc_info()[2] |
| 48 | |
| 49 | try: |
| 50 | while tb is not None: |
| 51 | if tb.tb_frame.f_code is f.__code__: |
| 52 | # In the function, it was called successfully. |
| 53 | return False |
| 54 | |
| 55 | tb = tb.tb_next |
| 56 | |
| 57 | # Didn't reach the function. |
| 58 | return True |
| 59 | finally: |
| 60 | # Delete tb to break a circular reference. |
| 61 | # https://docs.python.org/2/library/sys.html#sys.exc_info |
| 62 | del tb |
| 63 | |
| 64 | |
| 65 | def find_best_app(module: ModuleType) -> Quart: |
no outgoing calls
no test coverage detected
searching dependent graphs…