Skip to content

Commit d832521

Browse files
author
Martin Ruefenacht
committed
Started on implementation of constants
1 parent e0f37df commit d832521

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
@@ -18,10 +18,18 @@
1818
import os
1919

2020

21-
from .storage import KINDS, PROCEDURES, CALLBACKS, PREDEFINED_FUNCTIONS, clear_storage
21+
from .storage import (
22+
KINDS,
23+
PROCEDURES,
24+
CALLBACKS,
25+
PREDEFINED_FUNCTIONS,
26+
CONSTANTS,
27+
clear_storage,
28+
)
2229
from .parameter import Direction
2330
from .procedure import Procedure
2431
from .callback import Callback
32+
from .constant import Constant
2533
from .predefined_function import PredefinedFunction
2634
from .kind import Kind, PolyKind
2735
from . import _kinds
@@ -173,6 +181,13 @@ def _load_database_v1(path: Path) -> None:
173181
Find and register all procedures found in the 'apis.json' file with Procedure instances.
174182
"""
175183

184+
# TODO discover which files of our database are in path, apis.json, constants.json
185+
186+
with path.joinpath("constants.json").open() as constants_file:
187+
for name, desc in dataset.items():
188+
const = Constant(name, desc)
189+
CONSTANTS[const.name] = const
190+
176191
with path.open("r") as datafile:
177192
if path.suffix == ".json":
178193
dataset = json.load(datafile)

0 commit comments

Comments
 (0)