diff --git a/pyproject.toml b/pyproject.toml index 4e5113d5b..211ad9ded 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -209,12 +209,8 @@ per-file-ignores."src/ttsim/typing.py" = [ "PYI051", # Redundant literal union ] per-file-ignores."src_mettsim/mettsim/middle_earth/**/*.py" = [ - "E721", # Type comparison using == - "PLR1714", # Repeated equality comparison - "PLR1716", # Boolean chained comparison "PLR2004", # Magic value comparison - "RET", # Unnecessary return logic - "SIM108", # Use ternary operator + "RET505", # Vectorizer requires both if/else branches; it rejects the early-return form ] per-file-ignores."src_mettsim/tests_middle_earth/*.py" = [ "ANN", # Missing type annotations @@ -236,11 +232,9 @@ per-file-ignores."tests/interface_dag_elements/test_failures.py" = [ "E501", # Line too long ] per-file-ignores."tests/tt/test_vectorization.py" = [ - "E721", # Type comparison using == - "PLR1714", # Repeated equality comparison - "PLR1716", # Boolean chained comparison - "RET", # Unnecessary return logic - "SIM108", # Use ternary operator + "RET504", # `out = ...; return out` fixtures mirror the vectorizer's output + "RET505", # Vectorizer requires both if/else branches; it rejects the early-return form + "SIM108", # Statement-style if/else blocks are intentional fixtures for the vectorizer ] pydocstyle.convention = "google" diff --git a/src_mettsim/mettsim/middle_earth/payroll_tax/child_tax_credit/child_tax_credit.py b/src_mettsim/mettsim/middle_earth/payroll_tax/child_tax_credit/child_tax_credit.py index 14de99b22..233f26b61 100644 --- a/src_mettsim/mettsim/middle_earth/payroll_tax/child_tax_credit/child_tax_credit.py +++ b/src_mettsim/mettsim/middle_earth/payroll_tax/child_tax_credit/child_tax_credit.py @@ -29,10 +29,7 @@ def claim_of_child_y( child_eligible: bool, schedule: dict[str, float], ) -> float: - if child_eligible: - return schedule["child_amount_y"] - else: - return 0 + return schedule["child_amount_y"] if child_eligible else 0 @policy_function() diff --git a/src_mettsim/mettsim/middle_earth/wealth_tax/wealth_tax.py b/src_mettsim/mettsim/middle_earth/wealth_tax/wealth_tax.py index 4b681ba15..c4c4227dc 100644 --- a/src_mettsim/mettsim/middle_earth/wealth_tax/wealth_tax.py +++ b/src_mettsim/mettsim/middle_earth/wealth_tax/wealth_tax.py @@ -9,10 +9,7 @@ def amount_y( tax_rate: float, exempt_from_wealth_tax: bool, ) -> float: - if exempt_from_wealth_tax: - return 0.0 - else: - return wealth * tax_rate + return 0.0 if exempt_from_wealth_tax else wealth * tax_rate @policy_function()