Skip to content

Commit c20a1f6

Browse files
committed
Cosmetics.
1 parent 6a437a1 commit c20a1f6

File tree

4 files changed

+17
-16
lines changed

4 files changed

+17
-16
lines changed

src/ttsim/compute_taxes_and_transfers.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
merge_trees,
3838
partition_by_reference_dict,
3939
)
40-
from ttsim.time_conversion import _TIME_UNITS
40+
from ttsim.time_conversion import TIME_UNITS
4141
from ttsim.typing import (
4242
check_series_has_expected_type,
4343
convert_series_to_internal_type,
@@ -49,6 +49,7 @@
4949
NestedTargetDict,
5050
QualNameDataDict,
5151
QualNameTargetList,
52+
QualNameTTSIMFunctionDict,
5253
QualNameTTSIMObjectDict,
5354
)
5455

@@ -94,8 +95,8 @@ def compute_taxes_and_transfers(
9495
# Transform functions tree to qualified names dict with qualified arguments
9596
top_level_namespace = _get_top_level_namespace(
9697
environment=environment,
97-
supported_time_conversions=list(_TIME_UNITS.keys()),
98-
supported_groupings=list(SUPPORTED_GROUPINGS.keys()),
98+
supported_time_conversions=tuple(TIME_UNITS.keys()),
99+
supported_groupings=tuple(SUPPORTED_GROUPINGS.keys()),
99100
)
100101
functions = dt.functions_without_tree_logic(
101102
functions=environment.functions_tree, top_level_namespace=top_level_namespace
@@ -137,7 +138,7 @@ def compute_taxes_and_transfers(
137138

138139
# Remove unnecessary elements from user-provided data.
139140
input_data = _create_input_data_for_concatenated_function(
140-
data=data_with_correct_types,
141+
data=data,
141142
functions=functions_with_partialled_parameters,
142143
targets=targets,
143144
)
@@ -174,8 +175,8 @@ def compute_taxes_and_transfers(
174175

175176
def _get_top_level_namespace(
176177
environment: PolicyEnvironment,
177-
supported_time_conversions: list[str],
178-
supported_groupings: list[str],
178+
supported_time_conversions: tuple[str, ...],
179+
supported_groupings: tuple[str, ...],
179180
) -> set[str]:
180181
"""Get the top level namespace.
181182

src/ttsim/shared.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def validate_date_range(start: datetime.date, end: datetime.date):
3838

3939

4040
def get_re_pattern_for_time_units_and_groupings(
41-
supported_groupings: list[str], supported_time_units: list[str]
41+
supported_groupings: tuple[str, ...], supported_time_units: tuple[str, ...]
4242
) -> re.Pattern:
4343
"""Get a regex pattern for time units and groupings.
4444

src/ttsim/time_conversion.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
from ttsim.typing import QualNameDataDict, QualNameTTSIMObjectDict
2121

22-
_TIME_UNITS = {
22+
TIME_UNITS = {
2323
"y": "year",
2424
"q": "quarter",
2525
"m": "month",
@@ -421,7 +421,7 @@ def create_time_conversion_functions(
421421
converted_ttsim_objects = {}
422422

423423
for source_name, ttsim_object in ttsim_objects.items():
424-
all_time_units = list(_TIME_UNITS)
424+
all_time_units = tuple(TIME_UNITS)
425425
time_unit_pattern = get_re_pattern_for_time_units_and_groupings(
426426
supported_groupings=SUPPORTED_GROUPINGS,
427427
supported_time_units=all_time_units,

tests/ttsim/test_shared.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -355,13 +355,13 @@ def test_all_variations_of_base_name(
355355
"expected_aggregation",
356356
),
357357
[
358-
("foo", ["m", "y"], ["hh"], "foo", None, None),
359-
("foo_m_hh", ["m", "y"], ["hh"], "foo", "m", "hh"),
360-
("foo_y_hh", ["m", "y"], ["hh"], "foo", "y", "hh"),
361-
("foo_m", ["m", "y"], ["hh"], "foo", "m", None),
362-
("foo_y", ["m", "y"], ["hh"], "foo", "y", None),
363-
("foo_hh", ["m", "y"], ["hh"], "foo", None, "hh"),
364-
("foo_hh_bar", ["m", "y"], ["hh"], "foo_hh_bar", None, None),
358+
("foo", ("m", "y"), ["hh"], "foo", None, None),
359+
("foo_m_hh", ("m", "y"), ["hh"], "foo", "m", "hh"),
360+
("foo_y_hh", ("m", "y"), ["hh"], "foo", "y", "hh"),
361+
("foo_m", ("m", "y"), ["hh"], "foo", "m", None),
362+
("foo_y", ("m", "y"), ["hh"], "foo", "y", None),
363+
("foo_hh", ("m", "y"), ["hh"], "foo", None, "hh"),
364+
("foo_hh_bar", ("m", "y"), ["hh"], "foo_hh_bar", None, None),
365365
],
366366
)
367367
def test_get_re_pattern_for_time_units_and_groupings(

0 commit comments

Comments
 (0)