Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/generated/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Every rule that governs `policyengine-sim-api` is listed here with how it is enf
- `sim.ci.multiline-run-is-script`: 13 remaining in `rules/baselines/ci-multiline-run.txt`
- `sim.microdata.weight-stripping-confined`: 0 remaining in `rules/baselines/sim-microdata-weight-stripping.txt`
- `sim.quality.pyright-apis-integ`: 4 remaining in `rules/baselines/pyright-apis-integ.txt`
- `sim.quality.pyright-executor`: 68 remaining in `rules/baselines/pyright-executor.txt`
- `sim.quality.pyright-executor`: 66 remaining in `rules/baselines/pyright-executor.txt`
- `sim.quality.pyright-gateway`: 0 remaining in `rules/baselines/pyright-gateway.txt`

### Exceptions and review dates
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def setup_gcp_credentials(
with contextlib.ExitStack() as credentials_file_stack:
try:
credential_span = (
runtime.span(ANNUAL_IMPACT_STAGES.name(Stage.CREDENTIAL_SETUP))
scopes.span(runtime, ANNUAL_IMPACT_STAGES.name(Stage.CREDENTIAL_SETUP))
if runtime is not None
else contextlib.nullcontext()
)
Expand Down Expand Up @@ -314,6 +314,9 @@ def _compile_interval_policy(
)

compiled = compile_reform(policy, year=year, model_version=country_module.model)
if compiled is None:
# compile_reform returns None only for an empty policy, returned above.
return policy
parameter_values = []
for path, periods in compiled.items():
dated_values = [
Expand Down Expand Up @@ -690,6 +693,11 @@ def _build_simulation(
policy: dict[str, Any] | None,
region: RegionResolution,
) -> StageReportingSimulation:
"""Build a simulation that reports when its calculation starts.

A run with a deterministic baseline id gets an ArtifactBaselineSimulation,
which is a StageReportingSimulation that can load a precomputed baseline.
"""
from policyengine_simulation_executor.baseline_artifacts import (
ArtifactBaselineSimulation,
BaselineIdentityRequest,
Expand All @@ -707,7 +715,7 @@ def _build_simulation(
spm_kwargs: dict[str, Any] = {"spm": selection} if selection is not None else {}
country = params.get("country", "us")
country_module = _country_module(country)
policy = _compile_interval_policy(
runtime_policy = _compile_interval_policy(
policy, country_module=country_module, year=_parse_year(params)
)
scoping_strategy = region.scoping_strategy
Expand All @@ -716,7 +724,7 @@ def _build_simulation(
params,
country=country,
dataset_is_default=dataset_selection.is_default,
policy=policy,
policy=runtime_policy,
region_code=region.code,
scoping_strategy=scoping_strategy,
year=_parse_year(params),
Expand All @@ -731,14 +739,14 @@ def _build_simulation(
id=simulation_id,
dataset=dataset,
tax_benefit_model_version=country_module.model,
policy=policy,
policy=runtime_policy,
scoping_strategy=scoping_strategy,
)
return StageReportingSimulation(
**spm_kwargs,
dataset=dataset,
tax_benefit_model_version=country_module.model,
policy=policy,
policy=runtime_policy,
scoping_strategy=scoping_strategy,
)

Expand Down
2 changes: 0 additions & 2 deletions rules/baselines/pyright-executor.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ projects/policyengine-simulation-executor/src/policyengine_simulation_executor/s
projects/policyengine-simulation-executor/src/policyengine_simulation_executor/simulation_output_common.py :: reportArgumentType :: Argument of type "Unknown | Any | Series" cannot be assigned to parameter "x" of type "ConvertibleToFloat" in function "__new__"
projects/policyengine-simulation-executor/src/policyengine_simulation_executor/simulation_output_common.py :: reportAttributeAccessIssue :: Cannot access attribute "model_dump" for class "object"
projects/policyengine-simulation-executor/src/policyengine_simulation_executor/simulation_output_common.py :: reportOptionalMemberAccess :: "data" is not a known attribute of "None"
projects/policyengine-simulation-executor/src/policyengine_simulation_executor/simulation_runtime.py :: reportAssignmentType :: Type "dict[str, Any] | Policy | None" is not assignable to declared type "dict[str, Any] | None"
projects/policyengine-simulation-executor/src/policyengine_simulation_executor/simulation_runtime.py :: reportOptionalMemberAccess :: "items" is not a known attribute of "None"
projects/policyengine-simulation-executor/src/policyengine_simulation_executor/spm.py :: reportArgumentType :: Argument of type "object" cannot be assigned to parameter "defaults" of type "SPMSelection" in function "__init__"
projects/policyengine-simulation-executor/src/policyengine_simulation_executor/stage12_parity.py :: reportArgumentType :: Argument of type "Series | Unknown | Self@DataFrame" cannot be assigned to parameter "actual_values" of type "Series" in function "_compare_column"
projects/policyengine-simulation-executor/src/policyengine_simulation_executor/stage12_parity.py :: reportArgumentType :: Argument of type "Series | Unknown | Self@DataFrame" cannot be assigned to parameter "expected_values" of type "Series" in function "_compare_column"
Expand Down
2 changes: 1 addition & 1 deletion rules/registry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,7 @@ job = "pyright"
invocation = "python -m scripts.rules pyright"
[rule.baseline]
file = "rules/baselines/pyright-executor.txt"
count = 68
count = 66
[rule.proof]
bad_fixture = "rules/fixtures/sim.quality.pyright-executor/bad"
good_fixture = "rules/fixtures/sim.quality.pyright-executor/good"
Expand Down
Loading