Skip to content

Commit 096e640

Browse files
author
Martin Ruefenacht
committed
Started on implementation of constants
1 parent 287e0c3 commit 096e640

File tree

3 files changed

+424
-79
lines changed

3 files changed

+424
-79
lines changed

src/pympistandard/__init__.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,18 @@
2222
MPI_DATABASE_FILE: str = "apis.json"
2323

2424

25-
from .storage import KINDS, PROCEDURES, CALLBACKS, PREDEFINED_FUNCTIONS, clear_storage
25+
from .storage import (
26+
KINDS,
27+
PROCEDURES,
28+
CALLBACKS,
29+
PREDEFINED_FUNCTIONS,
30+
CONSTANTS,
31+
clear_storage,
32+
)
2633
from .parameter import Direction
2734
from .procedure import Procedure
2835
from .callback import Callback
36+
from .constant import Constant
2937
from .predefined_function import PredefinedFunction
3038
from .kind import Kind, PolyKind
3139
from . import _kinds
@@ -181,6 +189,13 @@ def _load_database_v1(path: Path) -> None:
181189
Find and register all procedures found in the 'apis.json' file with Procedure instances.
182190
"""
183191

192+
# TODO discover which files of our database are in path, apis.json, constants.json
193+
194+
with path.joinpath("constants.json").open() as constants_file:
195+
for name, desc in dataset.items():
196+
const = Constant(name, desc)
197+
CONSTANTS[const.name] = const
198+
184199
with path.open("r") as datafile:
185200
if path.suffix == ".json":
186201
dataset = json.load(datafile)

0 commit comments

Comments
 (0)