MCPcopy Create free account
hub / github.com/PyTables/PyTables / idx2long

Function idx2long

tables/utils.py:91–99  ·  view source on GitHub ↗

Convert a possible index into a long int.

(index: int | float | np.ndarray)

Source from the content-addressed store, hash-verified

89
90
91def 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

Callers 3

_assign_valuesMethod · 0.85
_read_coordinatesMethod · 0.85
_process_rangeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected