Skip to content

Commit bf6cbb9

Browse files
committed
Fix commons type hints
1 parent 1020c25 commit bf6cbb9

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

openfisca_core/commons/imports.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
from types import ModuleType
2+
from typing import Tuple
3+
14
import importlib
25
import os
36
import traceback
@@ -8,7 +11,7 @@
811
from openfisca_core.warnings import LibYAMLWarning
912

1013

11-
def import_country_package(country_package_name):
14+
def import_country_package(country_package_name: str) -> ModuleType:
1215
"""Import a country package."""
1316

1417
try:
@@ -27,7 +30,7 @@ def import_country_package(country_package_name):
2730
raise ImportError(message) from error
2831

2932

30-
def import_yaml():
33+
def import_yaml() -> Tuple[ModuleType, yaml.cyaml.CLoader]:
3134
"""Import the yaml library."""
3235

3336
try:

openfisca_core/indexed_enums/enum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def __init__(self, name: str) -> None:
2121
# When the enum item is initialized, self._member_names_ contains the
2222
# names of the previously initialized items, so its length is the index
2323
# of this item.
24-
self.index = len(self._member_names_)
24+
self.index = len(self._member_names_) # type: ignore
2525

2626
# Bypass the slow Enum.__eq__
2727
__eq__ = object.__eq__

openfisca_core/tracers/trace_node.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import numpy
99

1010
from openfisca_core.indexed_enums import EnumArray
11-
from openfisca_core.periods import Period
1211

1312
Array = typing.Union[EnumArray, numpy.typing.ArrayLike]
1413
Time = typing.Union[float, int]

0 commit comments

Comments
 (0)