diff --git a/.agents/plugins/conductor b/.agents/plugins/conductor new file mode 160000 index 00000000..f06add33 --- /dev/null +++ b/.agents/plugins/conductor @@ -0,0 +1 @@ +Subproject commit f06add33b598f4262a190f234828dda551db70d7 diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..08995541 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,5 @@ +[submodule ".agents/plugins/conductor"] + path = .agents/plugins/conductor + url = https://github.com/gemini-cli-extensions/conductor.git + branch = main + diff --git a/converters/fixtures/src/pic_fixture_converters/core.py b/converters/fixtures/src/pic_fixture_converters/core.py index 40373e4b..7712f5e2 100644 --- a/converters/fixtures/src/pic_fixture_converters/core.py +++ b/converters/fixtures/src/pic_fixture_converters/core.py @@ -2,12 +2,12 @@ from __future__ import annotations -from dataclasses import dataclass -from decimal import Decimal, InvalidOperation import hashlib import json -from pathlib import Path import re +from dataclasses import dataclass +from decimal import Decimal, InvalidOperation +from pathlib import Path from typing import Any, Literal import yaml @@ -275,7 +275,7 @@ def _expected_value(value: Any, *, source: str | None) -> dict[str, Any]: return {"value": _pic_value(value), "valueState": "known", "epistemicStatus": "asserted"} -def _pic_value(value: bool | int | float | str) -> bool | int | str: +def _pic_value(value: bool | float | str) -> bool | int | str: if isinstance(value, bool): return value if isinstance(value, int): diff --git a/converters/fixtures/src/pic_fixture_converters/corpus_report.py b/converters/fixtures/src/pic_fixture_converters/corpus_report.py index ce48ea33..ecf4e603 100644 --- a/converters/fixtures/src/pic_fixture_converters/corpus_report.py +++ b/converters/fixtures/src/pic_fixture_converters/corpus_report.py @@ -4,10 +4,10 @@ import argparse import json -from pathlib import Path import subprocess import tempfile -from typing import Callable +from collections.abc import Callable +from pathlib import Path from pic_fixture_converters import openfisca_to_pic, policyengine_to_pic diff --git a/harness/axiom/__init__.py b/harness/axiom/__init__.py index 19408dea..54894ef7 100644 --- a/harness/axiom/__init__.py +++ b/harness/axiom/__init__.py @@ -5,16 +5,16 @@ from axiom.adapter import ( RULESPEC_NZ_ACC_EARNERS_LEVY_TARGET, RULESPEC_NZ_GST_TARGET, - RULESPEC_NZ_KIWISAVER_CONTRIBUTIONS_TARGET, RULESPEC_NZ_INDIVIDUAL_INCOME_TAX_TARGET, + RULESPEC_NZ_KIWISAVER_CONTRIBUTIONS_TARGET, RULESPEC_NZ_NEW_ZEALAND_SUPERANNUATION_CORE_TARGET, RULESPEC_NZ_NEW_ZEALAND_SUPERANNUATION_SPECIAL_RATES_TARGET, AxiomRuleSpecAdapter, RuleSpecTarget, build_rulespec_nz_acc_earners_levy_adapter, build_rulespec_nz_gst_adapter, - build_rulespec_nz_kiwisaver_contributions_adapter, build_rulespec_nz_individual_income_tax_adapter, + build_rulespec_nz_kiwisaver_contributions_adapter, build_rulespec_nz_new_zealand_superannuation_core_adapter, build_rulespec_nz_new_zealand_superannuation_special_rates_adapter, ) @@ -26,10 +26,10 @@ ) __all__ = [ - "RULESPEC_NZ_GST_TARGET", - "RULESPEC_NZ_KIWISAVER_CONTRIBUTIONS_TARGET", "RULESPEC_NZ_ACC_EARNERS_LEVY_TARGET", + "RULESPEC_NZ_GST_TARGET", "RULESPEC_NZ_INDIVIDUAL_INCOME_TAX_TARGET", + "RULESPEC_NZ_KIWISAVER_CONTRIBUTIONS_TARGET", "RULESPEC_NZ_NEW_ZEALAND_SUPERANNUATION_CORE_TARGET", "RULESPEC_NZ_NEW_ZEALAND_SUPERANNUATION_SPECIAL_RATES_TARGET", "AxiomCompiledArtifactExecutor", @@ -39,8 +39,8 @@ "RuleSpecTarget", "build_rulespec_nz_acc_earners_levy_adapter", "build_rulespec_nz_gst_adapter", - "build_rulespec_nz_kiwisaver_contributions_adapter", "build_rulespec_nz_individual_income_tax_adapter", + "build_rulespec_nz_kiwisaver_contributions_adapter", "build_rulespec_nz_new_zealand_superannuation_core_adapter", "build_rulespec_nz_new_zealand_superannuation_special_rates_adapter", "generate_report", diff --git a/harness/axiom/runner.py b/harness/axiom/runner.py index 43ac00cb..0f1ad275 100644 --- a/harness/axiom/runner.py +++ b/harness/axiom/runner.py @@ -11,7 +11,6 @@ from axiom.adapter import AxiomRuleSpecAdapter - ExecutionCallback = Callable[[dict[str, Any]], dict[str, Any]] @@ -41,7 +40,7 @@ def run_case( try: response = active_executor(request) axiom = self.adapter.normalize_response(response) - except Exception as exc: + except Exception as exc: # noqa: BLE001 - adapters may raise arbitrary failures return { "caseId": pic_case["caseId"], "status": "adapter_failure", diff --git a/harness/tests/test_axiom_harness.py b/harness/tests/test_axiom_harness.py index 9e3ac77c..0580c9bd 100644 --- a/harness/tests/test_axiom_harness.py +++ b/harness/tests/test_axiom_harness.py @@ -4,23 +4,20 @@ from typing import Any import pytest - -from pic_contracts.schema_utils import validator_for - from axiom import ( AxiomRuleSpecAdapter, RuleSpecTarget, build_rulespec_nz_acc_earners_levy_adapter, - build_rulespec_nz_kiwisaver_contributions_adapter, build_rulespec_nz_gst_adapter, build_rulespec_nz_individual_income_tax_adapter, + build_rulespec_nz_kiwisaver_contributions_adapter, build_rulespec_nz_new_zealand_superannuation_core_adapter, build_rulespec_nz_new_zealand_superannuation_special_rates_adapter, generate_report, write_reports, ) from axiom.runner import AxiomHarnessRunner - +from pic_contracts.schema_utils import validator_for GST_CASE = { "caseId": "nz-gst/fixture.add_and_remove_gst", diff --git a/harness/tests/test_policyengine_trace_projection.py b/harness/tests/test_policyengine_trace_projection.py index d16df396..1a7e579b 100644 --- a/harness/tests/test_policyengine_trace_projection.py +++ b/harness/tests/test_policyengine_trace_projection.py @@ -4,7 +4,6 @@ from policyengine_trace import project_flat_trace from policyengine_trace.projection import parse_trace_key - SNAP_FLAT_TRACE = { "snap<2024-01, (default)>": { "dependencies": [ diff --git a/studies/snap-divergence/runner/src/snap_divergence/policyengine_runner.py b/studies/snap-divergence/runner/src/snap_divergence/policyengine_runner.py index 58cdaef7..2fd7a542 100644 --- a/studies/snap-divergence/runner/src/snap_divergence/policyengine_runner.py +++ b/studies/snap-divergence/runner/src/snap_divergence/policyengine_runner.py @@ -64,9 +64,9 @@ def build_policyengine_situation(case: dict[str, Any]) -> dict[str, Any]: "is_tax_unit_dependent": {period_year: is_child}, "is_disabled": {period_year: has_elderly_disabled and index == 1}, "immigration_status_str": {period_year: "CITIZEN"}, - "employment_income": {period_year: float(_annualize(earned_income if index == 0 else Decimal("0")))}, + "employment_income": {period_year: float(_annualize(earned_income if index == 0 else Decimal(0)))}, "snap_allowable_medical_expenses": { - period_year: float(_annualize(medical if index == 0 else Decimal("0"))), + period_year: float(_annualize(medical if index == 0 else Decimal(0))), }, } @@ -251,7 +251,7 @@ def _marital_units(members: list[str], ages: list[int]) -> dict[str, Any]: def _annualize(monthly: Decimal) -> Decimal: - return monthly * Decimal("12") + return monthly * Decimal(12) def _scalar(value: Any) -> Any: diff --git a/studies/snap-divergence/runner/src/snap_divergence/prd_runner.py b/studies/snap-divergence/runner/src/snap_divergence/prd_runner.py index 7833413e..3bc07804 100644 --- a/studies/snap-divergence/runner/src/snap_divergence/prd_runner.py +++ b/studies/snap-divergence/runner/src/snap_divergence/prd_runner.py @@ -99,9 +99,9 @@ def run_prd_cases( return [json.loads(line) for line in output_path.read_text().splitlines()] -def format_prd_result(case_id: str, period: str, *, annual_snap_value: float | int | str) -> dict[str, Any]: +def format_prd_result(case_id: str, period: str, *, annual_snap_value: float | str) -> dict[str, Any]: annual = Decimal(str(annual_snap_value)) - monthly = annual / Decimal("12") + monthly = annual / Decimal(12) return { "caseId": case_id, "period": period, @@ -149,7 +149,7 @@ def _parse_ages(value: Any) -> list[int]: def _annualize(monthly: Decimal) -> Decimal: - return monthly * Decimal("12") + return monthly * Decimal(12) def _decimal_string(value: Decimal) -> str: diff --git a/studies/snap-divergence/runner/src/snap_divergence/triangulation.py b/studies/snap-divergence/runner/src/snap_divergence/triangulation.py index 0aff7e11..97b11c96 100644 --- a/studies/snap-divergence/runner/src/snap_divergence/triangulation.py +++ b/studies/snap-divergence/runner/src/snap_divergence/triangulation.py @@ -377,13 +377,13 @@ def _expected_eligibility(fixture: dict[str, Any], assertions: list[SourceAssert return False gross_limit = _decimal(values.get("bbce_gross_limit_percent_fpl")) if gross_limit is not None: - return gross_limit >= Decimal("165") + return gross_limit >= Decimal(165) if fixture_class == "gross_130_above": if values.get("bbce_status") is False: return False gross_limit = _decimal(values.get("bbce_gross_limit_percent_fpl")) if gross_limit is not None: - return gross_limit > Decimal("130") + return gross_limit > Decimal(130) if fixture_class == "gross_130_below": return True return None diff --git a/studies/snap-divergence/runner/tests/test_policyengine_runner.py b/studies/snap-divergence/runner/tests/test_policyengine_runner.py index ce386405..e2ce8d21 100644 --- a/studies/snap-divergence/runner/tests/test_policyengine_runner.py +++ b/studies/snap-divergence/runner/tests/test_policyengine_runner.py @@ -3,7 +3,6 @@ from decimal import Decimal import pytest - from snap_divergence.policyengine_runner import ( PolicyEngineUnavailable, build_policyengine_situation,