Skip to content

Fix variable method type annotations - #544

Merged
anth-volk merged 1 commit into
masterfrom
fix/variable-method-typing
Sep 4, 2026
Merged

Fix variable method type annotations#544
anth-volk merged 1 commit into
masterfrom
fix/variable-method-typing

Conversation

@anth-volk

Copy link
Copy Markdown
Collaborator

Fixes #327

Summary

  • annotate variable registration methods as accepting Type[Variable] subclasses rather than strings or instances
  • correct replace_variable() to declare its existing None return behavior
  • correct the add_variables() positional-argument annotation and clarify the affected docstrings

Validation

  • uv run --frozen pytest -q tests/core/test_reforms.py tests/core/test_countries.py (40 passed)
  • uv run --frozen --extra dev ruff check policyengine_core/taxbenefitsystems/tax_benefit_system.py
  • uv run --frozen --extra dev ruff format --check policyengine_core/taxbenefitsystems/tax_benefit_system.py
  • inspected resolved annotations with typing.get_type_hints()

No tests were added, per the requested scope.

Documentation review

External documentation changes are not required because runtime behavior is unchanged. The affected method docstrings now explicitly describe class arguments. Impact is low, confidence is high, and there are no known documentation gaps.

@anth-volk
anth-volk marked this pull request as ready for review September 4, 2026 22:47
@anth-volk
anth-volk merged commit e1ea019 into master Sep 4, 2026
18 checks passed
@anth-volk
anth-volk deleted the fix/variable-method-typing branch September 4, 2026 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TaxBenefitSystem.load_variable() and TaxBenefitSystem.update_variable() are improperly typehinted

1 participant