MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / generate_stubs

Function generate_stubs

external/ggml/examples/python/stubs.py:111–128  ·  view source on GitHub ↗

Generates a .pyi Python stub file for the GGML API using C header files.

(header: str)

Source from the content-addressed store, hash-verified

109 self.sigs[fun_name] = '\n'.join(lines)
110
111def generate_stubs(header: str):
112 """
113 Generates a .pyi Python stub file for the GGML API using C header files.
114 """
115
116 v = PythonStubFuncDeclVisitor()
117 v.visit(CParser().parse(header, "<input>"))
118
119 keys = list(v.sigs.keys())
120 keys.sort()
121
122 return '\n'.join([
123 '# auto-generated file',
124 'import ggml.ffi as ffi',
125 'import numpy as np',
126 'class lib:',
127 *[v.sigs[k] for k in keys]
128 ])

Callers 1

regenerate.pyFile · 0.90

Calls 2

parseMethod · 0.45

Tested by

no test coverage detected