|
28 | 28 | import h5py |
29 | 29 | from pathlib import Path |
30 | 30 | import pandas as pd |
31 | | -from typing import Type, Optional |
| 31 | +from typing import Type, Any, Optional |
32 | 32 | from functools import wraps, partial |
33 | 33 | from typing import Callable |
34 | 34 | import importlib |
|
37 | 37 | CountryType = Literal["uk", "us"] |
38 | 38 | ScopeType = Literal["household", "macro"] |
39 | 39 | DataType = ( |
40 | | - str | dict | Dataset | None |
| 40 | + str | dict[Any, Any] | Dataset | None |
41 | 41 | ) # Needs stricter typing. Any==policyengine_core.data.Dataset, but pydantic refuses for some reason. |
42 | 42 | TimePeriodType = int |
43 | 43 | ReformType = ParametricReform | Type[StructuralReform] | None |
@@ -99,7 +99,10 @@ class Simulation: |
99 | 99 | def __init__(self, **options: SimulationOptions): |
100 | 100 | self.options = SimulationOptions(**options) |
101 | 101 | self.check_model_version() |
102 | | - if not isinstance(self.options.data, Dataset): |
| 102 | + if not isinstance(self.options.data, dict) and not isinstance( |
| 103 | + self.options.data, Dataset |
| 104 | + ): |
| 105 | + print(type(self.options.data), sys.stderr) |
103 | 106 | self._set_data(self.options.data) |
104 | 107 | self._initialise_simulations() |
105 | 108 | self.check_data_version() |
|
0 commit comments