Skip to content

Commit 403a99f

Browse files
committed
Add wide type hints
Just enough to pass typing checks. This should be more precise.
1 parent aab235b commit 403a99f

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

openfisca_core/parameters/parameter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ class Parameter(AtInstantLike):
4545

4646
def __init__(self, name: str, data: dict, file_path: Optional[str] = None) -> None:
4747
self.name: str = name
48-
self.file_path: str = file_path
48+
self.file_path: Optional[str] = file_path
4949
helpers._validate_parameter(self, data, data_type = dict)
50-
self.description: str = None
50+
self.description: Optional[str] = None
5151
self.metadata: Dict = {}
52-
self.documentation: str = None
52+
self.documentation: Optional[str] = None
5353
self.values_history = self # Only for backward compatibility
5454

5555
# Normal parameter declaration: the values are declared under the 'values' key: parse the description and metadata.

openfisca_core/taxbenefitsystems/tax_benefit_system.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from typing import Optional, Sequence
3+
from typing import Any, Dict, Optional, Sequence
44

55
import copy
66
import glob
@@ -39,7 +39,7 @@ class TaxBenefitSystem:
3939
4040
"""
4141
_base_tax_benefit_system = None
42-
_parameters_at_instant_cache = None
42+
_parameters_at_instant_cache: Optional[Dict[Any, Any]] = None
4343
person_key_plural = None
4444
preprocess_parameters = None
4545
baseline = None # Baseline tax-benefit system. Used only by reforms. Note: Reforms can be chained.
@@ -50,8 +50,8 @@ def __init__(self, entities: Sequence[Entity]) -> None:
5050
# TODO: Currently: Don't use a weakref, because they are cleared by Paste (at least) at each call.
5151
self.parameters: Optional[ParameterNode] = None
5252
self._parameters_at_instant_cache = {} # weakref.WeakValueDictionary()
53-
self.variables = {}
54-
self.open_api_config = {}
53+
self.variables: Dict[Any, Any] = {}
54+
self.open_api_config: Dict[Any, Any] = {}
5555
# Tax benefit systems are mutable, so entities (which need to know about our variables) can't be shared among them
5656
if entities is None or len(entities) == 0:
5757
raise Exception("A tax and benefit sytem must have at least an entity.")

0 commit comments

Comments
 (0)