@@ -144,11 +144,11 @@ def _resolve_path(given_path: Union[str, Path] = None) -> Path:
144
144
145
145
# use given path
146
146
if given_path is not None :
147
- path = given_path / "apis .json"
147
+ path = given_path / "mpidb .json"
148
148
149
149
# use environment variable paths
150
150
elif "MPISTANDARD" in os .environ :
151
- path = Path (os .environ ["MPISTANDARD" ] + "/apis .json" )
151
+ path = Path (os .environ ["MPISTANDARD" ] + "/mpidb .json" )
152
152
153
153
# else:
154
154
# raise RuntimeError(
@@ -158,7 +158,7 @@ def _resolve_path(given_path: Union[str, Path] = None) -> Path:
158
158
159
159
else :
160
160
# fallback to packaged data
161
- path = importlib .resources .files ("pympistandard.data" ).joinpath ("apis .json" )
161
+ path = importlib .resources .files ("pympistandard.data" ).joinpath ("mpidb .json" )
162
162
163
163
# require resolved path to exist
164
164
path .resolve (True )
@@ -173,11 +173,6 @@ def _load_database_v1(path: Path) -> None:
173
173
174
174
# TODO discover which files of our database are in path, apis.json, constants.json
175
175
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
-
181
176
with path .open ("r" ) as datafile :
182
177
if path .suffix == ".json" :
183
178
dataset = json .load (datafile )
@@ -196,7 +191,7 @@ def _load_database_v1(path: Path) -> None:
196
191
raise RuntimeError (f"Unrecognized suffix of data file { path } " )
197
192
198
193
# read in datafile
199
- for name , desc in dataset .items ():
194
+ for name , desc in dataset [ "procedures" ] .items ():
200
195
if desc ["attributes" ]["predefined_function" ]:
201
196
predef = PredefinedFunction (name , desc )
202
197
PREDEFINED_FUNCTIONS [predef .name ] = predef
@@ -208,3 +203,7 @@ def _load_database_v1(path: Path) -> None:
208
203
else :
209
204
procedure = Procedure (name , desc )
210
205
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