""" Compatibility shim so that imgaug (written for numpy<2) keeps working with numpy>=2. Must be imported before `imgaug`. """ import numpy as np if not hasattr(np, "sctypes"): np.sctypes = { "int": [np.int8, np.int16, np.int32, np.int64], "uint": [np.uint8, np.uint16, np.uint32, np.uint64], "float": [np.float16, np.float32, np.float64], "complex": [np.complex64, np.complex128], "others": [bool, object, bytes, str, np.void], } for _name, _alias in [ ("bool", np.bool_), ("float", float), ("int", int), ("object", object), ("str", str), ("unicode", np.str_), ("string_", np.bytes_), ("unicode_", np.str_), ]: if _name not in np.__dict__: setattr(np, _name, _alias)