MCPcopy Create free account
hub / github.com/Xilinx/Vitis_Libraries / get_api_spec

Function get_api_spec

dsp/scripts/instance_generator.py:32–58  ·  view source on GitHub ↗
(spec_file, api_name)

Source from the content-addressed store, hash-verified

30 return fn(*args)
31
32def get_api_spec(spec_file, api_name):
33 with open(spec_file, "r") as fd:
34 d = json.load(fd)
35 if d["schema"] == "vitis_libraries_api_list_schema-1.0":
36 x = None
37 for t in d["api_list"]:
38 if t["api_name"] == api_name:
39 x = t
40 break
41 if not x:
42 print(f"ERROR: {api_name} not in {spec_file}")
43 return None
44 if "spec" in x:
45 return x["spec"]
46 elif "spec_file" in x:
47 with open(os.path.join(os.path.dirname(spec_file), x["spec_file"]), "r") as fdx:
48 dx = json.load(fdx)
49 d = dx
50 else:
51 print(f"ERROR: ill formated spec file {spec_file}")
52 return None
53 if d["schema"] == "vitis_library_api_spec_schema-1.0":
54 if d["api_name"] == api_name:
55 return d
56 else:
57 print(f"ERROR: {spec_file} is not for {api_name}")
58 return None
59
60def get_params(param_file, param_name):
61 with open(param_file, "r") as fd:

Callers 1

__init__Method · 0.70

Calls 2

printFunction · 0.50
loadMethod · 0.45

Tested by

no test coverage detected