Return a binary method that always raises a TypeError. Parameters ---------- name : str Returns ------- invalid_op : function
(name: str)
| 57 | |
| 58 | |
| 59 | def make_invalid_op(name: str) -> Callable[..., NoReturn]: |
| 60 | """ |
| 61 | Return a binary method that always raises a TypeError. |
| 62 | |
| 63 | Parameters |
| 64 | ---------- |
| 65 | name : str |
| 66 | |
| 67 | Returns |
| 68 | ------- |
| 69 | invalid_op : function |
| 70 | """ |
| 71 | |
| 72 | def invalid_op(self: object, other: object = None) -> NoReturn: |
| 73 | typ = type(self).__name__ |
| 74 | raise TypeError(f"cannot perform {name} with this index type: {typ}") |
| 75 | |
| 76 | invalid_op.__name__ = name |
| 77 | return invalid_op |
no outgoing calls
no test coverage detected