@@ -144,11 +144,11 @@ def _resolve_path(given_path: Union[str, Path] = None) -> Path:
144144
145145 # use given path
146146 if given_path is not None :
147- path = given_path / "apis .json"
147+ path = given_path / "mpidb .json"
148148
149149 # use environment variable paths
150150 elif "MPISTANDARD" in os .environ :
151- path = Path (os .environ ["MPISTANDARD" ] + "/apis .json" )
151+ path = Path (os .environ ["MPISTANDARD" ] + "/mpidb .json" )
152152
153153 # else:
154154 # raise RuntimeError(
@@ -158,7 +158,7 @@ def _resolve_path(given_path: Union[str, Path] = None) -> Path:
158158
159159 else :
160160 # fallback to packaged data
161- path = importlib .resources .files ("pympistandard.data" ).joinpath ("apis .json" )
161+ path = importlib .resources .files ("pympistandard.data" ).joinpath ("mpidb .json" )
162162
163163 # require resolved path to exist
164164 path .resolve (True )
@@ -173,11 +173,6 @@ def _load_database_v1(path: Path) -> None:
173173
174174 # TODO discover which files of our database are in path, apis.json, constants.json
175175
176- with path .joinpath ("constants.json" ).open () as constants_file :
177- for name , desc in dataset .items ():
178- const = Constant (name , desc )
179- CONSTANTS [const .name ] = const
180-
181176 with path .open ("r" ) as datafile :
182177 if path .suffix == ".json" :
183178 dataset = json .load (datafile )
@@ -196,7 +191,7 @@ def _load_database_v1(path: Path) -> None:
196191 raise RuntimeError (f"Unrecognized suffix of data file { path } " )
197192
198193 # read in datafile
199- for name , desc in dataset .items ():
194+ for name , desc in dataset [ "procedures" ] .items ():
200195 if desc ["attributes" ]["predefined_function" ]:
201196 predef = PredefinedFunction (name , desc )
202197 PREDEFINED_FUNCTIONS [predef .name ] = predef
@@ -208,3 +203,7 @@ def _load_database_v1(path: Path) -> None:
208203 else :
209204 procedure = Procedure (name , desc )
210205 PROCEDURES [procedure .name ] = procedure
206+
207+ for name , desc in dataset ["constants" ].items ():
208+ const = Constant (name , desc )
209+ CONSTANTS [name ] = const
0 commit comments