Convert a possible index into a long int.
(index: int | float | np.ndarray)
| 89 | |
| 90 | |
| 91 | def idx2long(index: int | float | np.ndarray) -> int: |
| 92 | """Convert a possible index into a long int.""" |
| 93 | try: |
| 94 | if hasattr(index, "item"): |
| 95 | return index.item() |
| 96 | else: |
| 97 | return int(index) |
| 98 | except Exception: |
| 99 | raise TypeError("not an integer type.") |
| 100 | |
| 101 | |
| 102 | # This is used in VLArray and EArray to produce NumPy object compliant |
no outgoing calls
no test coverage detected