|
44 | 44 |
|
45 | 45 | category_to_funcs: Dict[str, List[FunctionType]] = {}
|
46 | 46 | for name, mod in name_to_mod.items():
|
47 |
| - if name.endswith("_functions") or name == "info": # info functions file just named info.py |
| 47 | + if name.endswith("_functions"): |
48 | 48 | category = name.replace("_functions", "")
|
49 | 49 | objects = [getattr(mod, name) for name in mod.__all__]
|
50 | 50 | assert all(isinstance(o, FunctionType) for o in objects) # sanity check
|
|
55 | 55 | all_funcs.extend(funcs)
|
56 | 56 | name_to_func: Dict[str, FunctionType] = {f.__name__: f for f in all_funcs}
|
57 | 57 |
|
| 58 | +info_funcs = [] |
| 59 | +if api_version >= "2023.12": |
| 60 | + # The info functions in the stubs are in info.py, but this is not a name |
| 61 | + # in the standard. |
| 62 | + info_mod = name_to_mod["info"] |
| 63 | + |
| 64 | + # Note that __array_namespace_info__ is in info.__all__ but it is in the |
| 65 | + # top-level namespace, not the info namespace. |
| 66 | + info_funcs = [getattr(info_mod, name) for name in info_mod.__all__ |
| 67 | + if name != '__array_namespace_info__'] |
| 68 | + assert all(isinstance(f, FunctionType) for f in info_funcs) |
| 69 | + name_to_func.update({f.__name__: f for f in info_funcs}) |
| 70 | + |
| 71 | + all_funcs.append(info_mod.__array_namespace_info__) |
| 72 | + name_to_func['__array_namespace_info__'] = info_mod.__array_namespace_info__ |
| 73 | + category_to_funcs['info'] = [info_mod.__array_namespace_info__] |
| 74 | + |
58 | 75 | EXTENSIONS: List[str] = ["linalg"]
|
59 | 76 | if api_version >= "2022.12":
|
60 | 77 | EXTENSIONS.append("fft")
|
|
0 commit comments