File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 1
1
** /__pycache__
2
2
** /make.bat
3
3
** /_build
4
+ ** /* .json
Original file line number Diff line number Diff line change @@ -145,8 +145,23 @@ def _load_database_v1(path: Path) -> None:
145
145
"""
146
146
147
147
with path .open ("r" ) as datafile :
148
- dataset = json .load (datafile )
148
+ if path .suffix == ".json" :
149
+ dataset = json .load (datafile )
149
150
151
+ elif path .suffix == ".yaml" :
152
+ try :
153
+ import yaml
154
+
155
+ dataset = yaml .load (datafile )
156
+
157
+ except Exception as error :
158
+ print ("yaml may not be installed" )
159
+ raise error
160
+
161
+ else :
162
+ raise RuntimeError (f"Unrecognized suffix of data file { path } " )
163
+
164
+ # read in datafile
150
165
for name , desc in dataset .items ():
151
166
if desc ["attributes" ]["predefined_function" ]:
152
167
predef = PredefinedFunction (name , desc )
You can’t perform that action at this time.
0 commit comments