Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 22, 2024
1 parent 28b7278 commit 4b4d7a5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
14 changes: 7 additions & 7 deletions src/_gettsim/functions/derived_function.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from typing import Callable
from collections.abc import Callable

from _gettsim.functions.policy_function import PolicyFunction

Expand All @@ -21,12 +21,12 @@ class DerivedFunction(PolicyFunction):
from a data column, this may be None.
"""

def __init__( # noqa: PLR0913
self,
function: Callable,
function_name: str,
*,
derived_from: PolicyFunction | None = None,
def __init__(
self,
function: Callable,
function_name: str,
*,
derived_from: PolicyFunction | None = None,
):
super().__init__(
function,
Expand Down
11 changes: 6 additions & 5 deletions src/_gettsim/policy_environment_postprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ def _create_derived_functions(
environment: PolicyEnvironment,
targets: list[str],
data_cols: list[str],
) -> tuple[dict[str, DerivedFunction], dict[str, DerivedFunction], dict[str, DerivedFunction]]:
) -> tuple[
dict[str, DerivedFunction], dict[str, DerivedFunction], dict[str, DerivedFunction]
]:
"""
Create functions that are derived from the user and internal functions.
Expand All @@ -131,8 +133,7 @@ def _create_derived_functions(

# Create functions for different time units
time_conversion_functions = create_time_conversion_functions(
{**environment.functions, **aggregate_by_p_id_functions},
data_cols
{**environment.functions, **aggregate_by_p_id_functions}, data_cols
)

# Create aggregation functions
Expand Down Expand Up @@ -444,7 +445,7 @@ def _create_aggregate_by_p_id_functions(
agg_by_p_id_col: _create_one_aggregate_by_p_id_func(
agg_col=agg_by_p_id_col,
agg_specs=agg_by_p_id_spec,
user_and_internal_functions=user_and_internal_functions
user_and_internal_functions=user_and_internal_functions,
)
for agg_by_p_id_col, agg_by_p_id_spec in aggregate_by_p_id_dict.items()
if (
Expand All @@ -459,7 +460,7 @@ def _create_aggregate_by_p_id_functions(
def _create_one_aggregate_by_p_id_func(
agg_col: str,
agg_specs: dict[str, str],
user_and_internal_functions: dict[str, PolicyFunction]
user_and_internal_functions: dict[str, PolicyFunction],
) -> DerivedFunction:
"""Create one function that links variables across persons.
Expand Down
6 changes: 2 additions & 4 deletions src/_gettsim/time_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,7 @@ def create_time_conversion_functions(


def _create_time_conversion_functions(
name: str,
func: PolicyFunction | None = None
name: str, func: PolicyFunction | None = None
) -> dict[str, DerivedFunction]:
result: dict[str, DerivedFunction] = {}

Expand Down Expand Up @@ -350,8 +349,7 @@ def _create_time_conversion_functions(


def _create_function_for_time_unit(
function_name: str,
converter: Callable[[float], float]
function_name: str, converter: Callable[[float], float]
) -> Callable[[float], float]:
@rename_arguments(mapper={"x": function_name})
def func(x: float) -> float:
Expand Down

0 comments on commit 4b4d7a5

Please sign in to comment.