From 6110a32715dcd7c6295f5aacb784a73605031189 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 22 Oct 2024 12:15:29 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/_gettsim/functions/derived_function.py | 14 +++++++------- src/_gettsim/policy_environment_postprocessor.py | 11 ++++++----- src/_gettsim/time_conversion.py | 6 ++---- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/_gettsim/functions/derived_function.py b/src/_gettsim/functions/derived_function.py index 3b7c0d6ed..21d9411dd 100644 --- a/src/_gettsim/functions/derived_function.py +++ b/src/_gettsim/functions/derived_function.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Callable +from collections.abc import Callable from _gettsim.functions.policy_function import PolicyFunction @@ -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, diff --git a/src/_gettsim/policy_environment_postprocessor.py b/src/_gettsim/policy_environment_postprocessor.py index dc14f405d..db0363289 100644 --- a/src/_gettsim/policy_environment_postprocessor.py +++ b/src/_gettsim/policy_environment_postprocessor.py @@ -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. @@ -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 @@ -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 ( @@ -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. diff --git a/src/_gettsim/time_conversion.py b/src/_gettsim/time_conversion.py index 0d9d08916..c60a70b03 100644 --- a/src/_gettsim/time_conversion.py +++ b/src/_gettsim/time_conversion.py @@ -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] = {} @@ -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: