policyengine-core 3.38.0__tar.gz → 3.40.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/CHANGELOG.md +18 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/PKG-INFO +1 -1
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/python_api/errors.md +13 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/python_api/simulations.md +27 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/usage/branches.md +28 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/data_storage/in_memory_storage.py +40 -0
- policyengine_core-3.40.0/policyengine_core/data_storage/non_writable.py +20 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/data_storage/on_disk_storage.py +24 -2
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/errors/__init__.py +1 -0
- policyengine_core-3.40.0/policyengine_core/errors/read_only_simulation_error.py +23 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/holders/helpers.py +7 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/holders/holder.py +29 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/parameters/parameter.py +8 -2
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/parameters/parameter_node.py +49 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/parameters/parameter_scale.py +3 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/simulations/simulation.py +333 -6
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/simulations/simulation_builder.py +11 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/taxbenefitsystems/tax_benefit_system.py +13 -1
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/pyproject.toml +1 -1
- policyengine_core-3.40.0/tests/core/test_read_only_simulation.py +998 -0
- policyengine_core-3.40.0/tests/core/test_temporary_branch.py +292 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/.github/ISSUE_TEMPLATE.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/.github/actionlint.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/.github/bump_version.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/.github/changelog_template.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/.github/get-changelog-diff.sh +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/.github/has-functional-changes.sh +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/.github/is-version-number-acceptable.sh +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/.github/publish-git-tag.sh +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/.github/requirements/legacy-country-smoke.txt +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/.github/workflows/pr.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/.github/workflows/push.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/.gitignore +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/.python-version +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/AGENTS.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/CLAUDE.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/CONTRIBUTING.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/LICENSE +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/MANIFEST.in +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/Makefile +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/README.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/_build/logs/myst.build.json +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/changelog.d/.gitkeep +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/_config.yml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/_static/style.css +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/_toc.yml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/add_plotly_to_book.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/contributing/intro.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/engineering/skills/README.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/engineering/skills/documentation_review.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/engineering/skills/github-prs.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/engineering/skills/testing.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/intro.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/logo.png +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/python_api/commons.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/python_api/country_template.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/python_api/data.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/python_api/data_storage.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/python_api/entities.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/python_api/enums.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/python_api/experimental.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/python_api/extension_template.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/python_api/holders.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/python_api/parameters.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/python_api/periods.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/python_api/populations.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/python_api/projectors.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/python_api/reforms.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/python_api/scripts.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/python_api/taxbenefitsystems.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/python_api/taxscales.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/python_api/tools.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/python_api/tracers.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/python_api/types.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/python_api/variables.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/python_api/warnings.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/usage/country.ipynb +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/usage/datasets.ipynb +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/usage/parameters.md +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/usage/reforms.ipynb +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/docs/usage/simulation.ipynb +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/mypy.ini +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/build_metadata.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/charts/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/charts/bar.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/charts/formatting.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/commons/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/commons/formulas.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/commons/misc.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/commons/rates.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/constants.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/data/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/data/datasets/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/data/datasets/country_template_dataset.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/entities.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/modelled_policies.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/parameters/benefits/basic_income.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/parameters/benefits/housing_allowance.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/parameters/benefits/index.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/parameters/benefits/parenting_allowance/amount.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/parameters/benefits/parenting_allowance/income_threshold.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/parameters/general/age_of_majority.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/parameters/general/age_of_retirement.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/parameters/taxes/housing_tax.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/parameters/taxes/income_tax_rate.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/parameters/taxes/social_security_contribution.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/reforms/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/reforms/add_dynamic_variable.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/reforms/add_new_tax.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/reforms/flat_social_security_contribution.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/reforms/modify_social_security_taxation.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/reforms/removal_basic_income.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/situation_examples/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/situation_examples/couple.json +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/situation_examples/housing.json +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/situation_examples/single.json +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/tests/age.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/tests/basic_income.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/tests/disposable_income.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/tests/housing_allowance.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/tests/housing_tax.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/tests/income_tax.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/tests/reforms/add_dynamic_variable.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/tests/reforms/add_new_tax.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/tests/reforms/modify_social_security_taxation.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/tests/situations/income_tax.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/tests/situations/parenting_allowance.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/tests/social_security_contribution.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/tests/test_microsimulation.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/variables/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/variables/benefits.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/variables/demographics.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/variables/housing.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/variables/ids.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/variables/income.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/variables/stats.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/country_template/variables/taxes.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/data/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/data/dataset.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/data_storage/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/data_storage/storage_directory.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/data_storage/storage_keys.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/data_storage/store_history.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/data_structures/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/data_structures/parameter_metadata.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/data_structures/parameter_node_metadata.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/data_structures/reference.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/data_structures/unit.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/entities/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/entities/entity.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/entities/group_entity.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/entities/helpers.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/entities/role.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/enums/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/enums/config.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/enums/enum.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/enums/enum_array.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/errors/cycle_error.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/errors/empty_argument_error.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/errors/nan_creation_error.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/errors/non_deterministic_formula_error.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/errors/parameter_not_found_error.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/errors/parameter_parsing_error.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/errors/period_mismatch_error.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/errors/situation_parsing_error.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/errors/spiral_error.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/errors/variable_name_conflict_error.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/errors/variable_not_found_error.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/experimental/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/experimental/memory_config.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/extension_template/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/extension_template/local_benefit.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/extension_template/parameters/local_town/child_allowance/amount.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/extension_template/parameters/local_town/child_allowance/index.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/extension_template/parameters/local_town/index.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/extension_template/tests/local_benefit.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/holders/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/model_api.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/parameters/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/parameters/at_instant_like.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/parameters/config.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/parameters/helpers.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/parameters/operations/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/parameters/operations/get_parameter.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/parameters/operations/homogenize_parameters.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/parameters/operations/interpolate_parameters.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/parameters/operations/propagate_parameter_metadata.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/parameters/operations/uprate_parameters.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/parameters/parameter_at_instant.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/parameters/parameter_node_at_instant.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/parameters/parameter_scale_bracket.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/parameters/vectorial_parameter_node_at_instant.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/periods/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/periods/config.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/periods/helpers.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/periods/instant_.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/periods/period_.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/populations/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/populations/config.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/populations/group_population.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/populations/population.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/projectors/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/projectors/entity_to_person_projector.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/projectors/first_person_to_entity_projector.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/projectors/helpers.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/projectors/projector.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/projectors/unique_role_to_entity_projector.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/reforms/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/reforms/reform.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/scripts/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/scripts/assets/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/scripts/assets/index.html +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/scripts/policyengine_command.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/scripts/run_data.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/scripts/run_test.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/scripts/simulation_generator.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/simulations/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/simulations/helpers.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/simulations/individual_sim.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/simulations/microsimulation.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/simulations/simulation_macro_cache.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/taxbenefitsystems/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/taxscales/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/taxscales/abstract_rate_tax_scale.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/taxscales/abstract_tax_scale.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/taxscales/amount_tax_scale_like.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/taxscales/helpers.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/taxscales/linear_average_rate_tax_scale.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/taxscales/marginal_amount_tax_scale.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/taxscales/marginal_rate_tax_scale.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/taxscales/rate_tax_scale_like.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/taxscales/single_amount_tax_scale.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/taxscales/tax_scale_like.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/tools/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/tools/dependency_map.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/tools/google_cloud.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/tools/hugging_face.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/tools/simulation_dumper.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/tools/test_from_situation.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/tools/test_runner.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/tools/win_file_manager.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/tracers/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/tracers/computation_log.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/tracers/flat_trace.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/tracers/full_tracer.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/tracers/performance_log.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/tracers/simple_tracer.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/tracers/trace_node.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/tracers/tracing_parameter_node_at_instant.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/tracers/variable_graph.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/types/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/types/data_types/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/types/data_types/arrays.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/variables/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/variables/config.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/variables/defined_for.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/variables/formula_randomness.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/variables/helpers.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/variables/typing.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/variables/variable.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/warnings/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/warnings/libyaml_warning.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/warnings/memory_config_warning.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/warnings/parameter_key_warning.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/warnings/tempfile_warning.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/pytest.ini +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/conftest.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/commons/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/commons/test_between_function.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/commons/test_formulas.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/commons/test_is_in_function.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/commons/test_random_seed.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/commons/test_rates.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/data/test_dataset.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/enums/test_enum.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/model_api/test_index_.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameter_validation/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameter_validation/array_type.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameter_validation/duplicate_key.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameter_validation/filesystem_hierarchy/empty_index_file/index.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameter_validation/filesystem_hierarchy/node1/param.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameter_validation/indentation.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameter_validation/missing_value.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameter_validation/parameter_for_unit_propagation.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameter_validation/test_parameter_clone.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameter_validation/test_parameter_validation.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameter_validation/test_propagate_units.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameter_validation/test_unknown_keys.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameter_validation/unexpected_key_in_parameter.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameter_validation/unexpected_key_in_scale.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameter_validation/unexpected_key_in_value_at_instant.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameter_validation/unexpected_key_in_value_history.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameter_validation/unknown_key_beside_values.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameter_validation/uprating_under_metadata.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameter_validation/wrong_date.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameter_validation/wrong_scale.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameter_validation/wrong_type_in_bracket.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameter_validation/wrong_type_in_brackets.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameter_validation/wrong_type_in_parameter.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameter_validation/wrong_type_in_scale.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameter_validation/wrong_type_in_value_history.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameter_validation/wrong_value.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameter_validation/yaml_hierarchy/node1.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameters/operations/test_base_uprating.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameters/operations/test_base_uprating_property.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameters/operations/test_homogenization_parent_links.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameters/operations/test_interpolation.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameters/operations/test_nesting.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameters/operations/test_propagation.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameters/operations/test_scale_threshold_uprating.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameters/operations/test_uprating.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameters/test_numpy2_structured_arrays.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameters/test_parameter_metadata_clone.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameters/test_parameter_metadata_clone_property.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameters/test_parameter_node_add_child_caches.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameters/test_parameter_node_at_instant_copies.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameters/test_parameter_node_at_instant_lazy.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameters/test_parameter_node_at_instant_property.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameters/test_parameter_node_at_instant_systems.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameters/test_parameter_tree_parent_links.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameters/test_vectorial_parameter_node_copy.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameters/test_vectorial_parameter_node_copy_property.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameters_fancy_indexing/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameters_fancy_indexing/bareme.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameters_fancy_indexing/local_tax.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameters_fancy_indexing/rate.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameters_fancy_indexing/test_fancy_indexing.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/parameters_fancy_indexing/test_fancy_indexing_property.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/simulations/test_formula_randomness_concurrency.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/tax_scales/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/tax_scales/test_abstract_rate_tax_scale.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/tax_scales/test_abstract_tax_scale.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/tax_scales/test_linear_average_rate_tax_scale.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/tax_scales/test_linear_average_rate_tax_scale_property.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/tax_scales/test_marginal_amount_tax_scale.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/tax_scales/test_marginal_rate_tax_scale.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/tax_scales/test_rate_scale_conversion_property.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/tax_scales/test_rate_tax_scale_like.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/tax_scales/test_single_amount_tax_scale.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/tax_scales/test_tax_scales_commons.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_apply_reform_holders.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_apply_reform_holders_property.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_apply_reform_invalidates_cache.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_apply_reform_preserves_user_inputs.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_assert_near_precision.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_axes.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_bincount_minlength.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_branch_helper_invalidation.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_branch_input_fixed_point.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_branch_input_fixed_point_property.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_branch_input_invalidation.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_branch_input_invalidation_property.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_branch_scoped_delete_arrays.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_branch_shared_arrays.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_branch_shared_arrays_differential.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_build_metadata.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_calculate_output.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_carry_over_order.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_carry_over_order_property.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_clone_invalidated_caches.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_clone_rebinding.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_clone_rebinding_property.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_clone_reform_baseline.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_clone_reform_baseline_property.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_countries.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_cycles.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_data_storage_dir.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_data_storage_dir_property.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_dataset_default_role.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_dataset_default_role_property.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_dataset_getattr.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_dataset_unknown_column_warning.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_default_simulation_count_property.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_disk_period_filenames.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_disk_storage_delete_contained_periods.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_disk_storage_delete_property.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_disk_storage_differential.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_disk_storage_ownership.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_docs_deployment.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_dump_restore.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_dump_restore_property.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_entities.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_eternity_subperiods.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_extensions.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_fast_cache.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_fast_cache_contained_periods.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_fast_cache_contained_periods_property.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_fast_cache_guards.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_formulas.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_group_population_empty.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_group_population_reductions_property.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_holder_branch_fallback.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_holder_write_fast_cache.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_holder_write_fast_cache_property.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_holders.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_input_tier_invalidation.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_join_with_persons_identity.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_join_with_persons_identity_property.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_known_periods_branch_visibility.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_known_periods_branch_visibility_property.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_macro_cache_not_singleton.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_medium_fixes.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_microsimulation_calculate_signatures.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_microsimulation_internal_calls.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_microsimulation_option_reads.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_microsimulation_option_reads_property.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_microsimulation_person_accessor.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_microsimulation_weights.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_on_disk_storage_clones.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_opt_out_cache.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_option_result_cache.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_option_result_cache_property.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_option_result_input_provenance.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_own_period_input_overlapping_cache.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_pandas3_compatibility.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_parameter_security.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_parameters.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_periods.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_projectors.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_reform_baseline_system.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_reform_parameter_isolation.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_reform_period_keys.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_reforms.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_registered_input_deletion.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_release_tagging.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_rerun_fixture_isolation.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_restore_input_provenance.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_restore_input_registry.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_restore_input_registry_property.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_set_input_helper_order.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_set_input_helper_order_property.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_simulation_builder.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_simulation_copy_pickle.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_simulation_copy_pickle_property.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_simulations.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_stable_hash_seed.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_stale_frame_cache.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_storage_anchored_periods.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_storage_delete_branch.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_storage_input_index.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_storage_shared_index.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_storage_shared_index_differential.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_subsample_baseline_branch.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_subsample_computed_values.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_subsample_computed_values_property.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_subsample_deleted_inputs.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_subsample_entity_weight_totals.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_subsample_inputs_only.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_subsample_inputs_only_property.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_subsample_invalidates_cache.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_subsample_membership_ids.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_subsample_restore_inputs.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_subsample_sampling_period.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_subsample_sampling_period_property.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_subsample_structural_ids.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_subsample_weight_fallback.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_tax_benefit_system_cache_identity.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_tracer_parameter_reads.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_tracers.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_tracing_parameter_isolation.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_tracing_parameter_isolation_properties.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_uprating_order.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_uprating_order_property.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_user_input_keys.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_user_input_keys_property.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_user_input_keys_soundness.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_variable_code_sharing.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_variable_code_sharing_property.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/test_yaml.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/tools/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/tools/test_assert_near.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/tools/test_dependency_map.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/tools/test_google_cloud.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/tools/test_hugging_face.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/tools/test_runner/test_gc_pause.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/tools/test_runner/test_yaml_runner.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/variables/test_adds.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/variables/test_annualize.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/variables/test_bounds.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/variables/test_defined_for.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/variables/test_formula_randomness.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/variables/test_non_numeric_uprating_and_defined_for.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/variables/test_subtracts.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/variables/test_subtracts_sign.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/variables/test_variable_clone.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/variables/test_variable_formula_determinism.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/variables/test_variable_uprating.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/core/variables/test_variables.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/appclient.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/branch_input_invalidation.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/branch_shared_arrays.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/carry_over.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/chained_uprating_reference.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/data_storage_dir.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/disk_storage.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/entities.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/fast_cache_contained_periods.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/microsimulation_internal_calls.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/microsimulation_option_reads.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/option_caches.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/parameter_metadata_clones.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/parameter_nodes_at_instant.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/reform_holders.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/set_input_helper_order.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/simulation_copy.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/simulations.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/subsample_inputs.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/taxbenefitsystems.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/tracing.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/uprated_inputs.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/uprating_order.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/variables.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/vectorial_parameter_nodes.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/yaml_tests/__init__.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/yaml_tests/directory/subdirectory/test_4.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/yaml_tests/directory/test_1.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/yaml_tests/directory/test_2.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/yaml_tests/failing_test_absolute_error_margin.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/yaml_tests/failing_test_relative_error_margin.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/yaml_tests/test_absolute_error_margin.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/yaml_tests/test_failure.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/yaml_tests/test_name_filter.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/yaml_tests/test_relative_error_margin.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/yaml_tests/test_success.yml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/yaml_tests/test_with_anchors.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/yaml_tests/test_with_extension.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/yaml_tests/test_with_reform.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/fixtures/yaml_tests/test_with_reform_2.yaml +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/smoke/test_country_init.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/tests/smoke/test_us.py +0 -0
- {policyengine_core-3.38.0 → policyengine_core-3.40.0}/uv.lock +0 -0
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## [3.40.0] - 2026-12-02
|
|
2
|
+
|
|
3
|
+
### Added
|
|
4
|
+
|
|
5
|
+
- Added `Simulation.temporary_branch`, a context manager that gives a new branch for one `with` block and removes it from `branches` when the block ends or raises; a read-only simulation never keeps it.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## [3.39.0] - 2026-12-01
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Added `Simulation.make_read_only()`: a read-only simulation still calculates and keeps new values, refuses changes to its inputs, stored arrays and tax-benefit system with `ReadOnlySimulationError`, raises on its next calculation after a parameter change, stores only non-writable arrays, and makes private branches that are never kept in its `branches`.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- `clone()` of a parameter node, scale or parameter now returns a copy with no parent, so changes made in a cloned part of a parameter tree no longer mark the tree it was cloned from as modified or clear that tree's caches.
|
|
17
|
+
|
|
18
|
+
|
|
1
19
|
## [3.38.0] - 2026-11-27
|
|
2
20
|
|
|
3
21
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: policyengine-core
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.40.0
|
|
4
4
|
Summary: Core microsimulation engine enabling country-specific policy models.
|
|
5
5
|
Project-URL: Homepage, https://github.com/policyengine/policyengine-core
|
|
6
6
|
Author-email: PolicyEngine <hello@policyengine.org>
|
|
@@ -38,6 +38,19 @@
|
|
|
38
38
|
:show-inheritance:
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
+
## ReadOnlySimulationError
|
|
42
|
+
|
|
43
|
+
Raised when an operation would change a simulation made read-only with
|
|
44
|
+
`Simulation.make_read_only()`, and by its next calculation once its parameters
|
|
45
|
+
have changed.
|
|
46
|
+
|
|
47
|
+
```{eval-rst}
|
|
48
|
+
.. autoclass:: policyengine_core.errors.read_only_simulation_error.ReadOnlySimulationError
|
|
49
|
+
:members:
|
|
50
|
+
:undoc-members:
|
|
51
|
+
:show-inheritance:
|
|
52
|
+
```
|
|
53
|
+
|
|
41
54
|
## SituationParsingError
|
|
42
55
|
|
|
43
56
|
```{eval-rst}
|
|
@@ -12,6 +12,33 @@ The `policyengine_core.simulations` module contains the definition of `Simulatio
|
|
|
12
12
|
:show-inheritance:
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
+
### Read-only simulations
|
|
16
|
+
|
|
17
|
+
`Simulation.make_read_only()` makes a simulation refuse every change to its
|
|
18
|
+
inputs, stored values and tax-benefit system, while it still calculates and
|
|
19
|
+
keeps values it does not hold yet.
|
|
20
|
+
|
|
21
|
+
- `set_input` and `delete_arrays` (on the simulation or a holder),
|
|
22
|
+
`drop_computed_arrays`, `invalidate_cache_entry`, `apply_reform`,
|
|
23
|
+
`subsample`, `build_from_dataset`, `build_from_populations`,
|
|
24
|
+
`SimulationBuilder` building into it, the `set_input_dispatch_by_period` and
|
|
25
|
+
`set_input_divide_by_period` helpers, and assigning or deleting
|
|
26
|
+
`tax_benefit_system` raise `ReadOnlySimulationError`.
|
|
27
|
+
- Every array it stores, reads back from disk storage or reads from the macro
|
|
28
|
+
cache is non-writable, so a formula that writes in place into an array it
|
|
29
|
+
read raises numpy's `ValueError`.
|
|
30
|
+
- A parameter change after `make_read_only()` is not refused, since other
|
|
31
|
+
simulations may share the parameter tree; the read-only simulation's next
|
|
32
|
+
calculation raises `ReadOnlySimulationError` instead.
|
|
33
|
+
- `get_branch` with a new name returns a branch that is not kept in `branches`
|
|
34
|
+
and is not read-only itself.
|
|
35
|
+
- `temporary_branch` gives a new branch for each `with` block and never keeps
|
|
36
|
+
it in `branches`. As on any simulation, it refuses the simulation's own branch
|
|
37
|
+
name and the name of a branch it holds (one registered before
|
|
38
|
+
`make_read_only`).
|
|
39
|
+
|
|
40
|
+
The method's docstring lists what is not detected.
|
|
41
|
+
|
|
15
42
|
## Microsimulation
|
|
16
43
|
|
|
17
44
|
```{eval-rst}
|
|
@@ -20,6 +20,34 @@ the branch is created does not reach the branch, and what the branch stores
|
|
|
20
20
|
does not reach the parent. A branch of a branch reads its own values first,
|
|
21
21
|
then its parent's, then those of the simulation at the root.
|
|
22
22
|
|
|
23
|
+
## Temporary branches
|
|
24
|
+
|
|
25
|
+
A formula that needs a branch only while it calculates, and should leave
|
|
26
|
+
nothing behind, uses `temporary_branch`:
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
with simulation.temporary_branch("raised_earnings") as branch:
|
|
30
|
+
branch.set_input("employment_income", 2026, raised_earnings)
|
|
31
|
+
raised_net_income = branch.calculate("household_net_income", 2026)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The branch is made by `get_branch`, so it starts with everything described
|
|
35
|
+
above. The simulation holds it in `branches` only while the block runs: when
|
|
36
|
+
the block ends, normally or by raising, the branch is removed, unless the block
|
|
37
|
+
already removed it or put another branch under its name. A read-only
|
|
38
|
+
simulation (see `make_read_only`) never keeps it, so each block gets a new
|
|
39
|
+
branch and there is nothing to remove.
|
|
40
|
+
|
|
41
|
+
Without `clone_system=True` the branch shares the simulation's tax-benefit
|
|
42
|
+
system, so a change to the system or its parameters made through the branch
|
|
43
|
+
also changes the simulation, and stays after the block. Use
|
|
44
|
+
`clone_system=True` for such changes, as described under "Dropping calculated
|
|
45
|
+
values" below.
|
|
46
|
+
|
|
47
|
+
A name the simulation already holds, or its own branch name, raises
|
|
48
|
+
`ValueError` before the block runs, because `get_branch` would return that
|
|
49
|
+
branch or the simulation itself.
|
|
50
|
+
|
|
23
51
|
## Inputs set on a branch
|
|
24
52
|
|
|
25
53
|
`set_input` on a branch stores the new value and drops every value the branch
|
|
@@ -4,6 +4,7 @@ import numpy
|
|
|
4
4
|
from numpy.typing import ArrayLike
|
|
5
5
|
|
|
6
6
|
from policyengine_core import periods
|
|
7
|
+
from policyengine_core.data_storage.non_writable import make_non_writable
|
|
7
8
|
from policyengine_core.data_storage.storage_keys import check_storable
|
|
8
9
|
from policyengine_core.data_storage.store_history import (
|
|
9
10
|
_period_from_storage_key,
|
|
@@ -85,6 +86,10 @@ class InMemoryStorage:
|
|
|
85
86
|
# every holder, so copying at each clone would cost a set per input
|
|
86
87
|
# holder per branch for inputs most branches never change.
|
|
87
88
|
_inputs: Union[Set[str], FrozenSet[str]] = _NO_INPUTS
|
|
89
|
+
# Whether every array this storage holds is non-writable: set by
|
|
90
|
+
# ``make_read_only`` for a read-only simulation's holders (see
|
|
91
|
+
# ``Simulation.make_read_only``). A clone is not read-only.
|
|
92
|
+
read_only: bool = False
|
|
88
93
|
is_eternal: bool
|
|
89
94
|
|
|
90
95
|
def __init__(self, is_eternal: bool):
|
|
@@ -117,6 +122,26 @@ class InMemoryStorage:
|
|
|
117
122
|
# those of stores made after unpickling it.
|
|
118
123
|
if self._sequence_numbers:
|
|
119
124
|
advance_sequence_past(max(self._sequence_numbers.values()))
|
|
125
|
+
# Unpickled arrays are writable again.
|
|
126
|
+
if self.read_only:
|
|
127
|
+
self.make_read_only()
|
|
128
|
+
|
|
129
|
+
def make_read_only(self) -> None:
|
|
130
|
+
"""Mark every array this storage holds non-writable, and every array
|
|
131
|
+
it stores or copies from here on (see ``put`` and ``get``).
|
|
132
|
+
|
|
133
|
+
An array still shared with the storage this one was cloned from (see
|
|
134
|
+
``clone``) is copied first: the other storage can write into its own
|
|
135
|
+
array in place, which would change what this one reads.
|
|
136
|
+
"""
|
|
137
|
+
self.read_only = True
|
|
138
|
+
shared = self._shared
|
|
139
|
+
for key, array in list(self._arrays.items()):
|
|
140
|
+
if key in shared:
|
|
141
|
+
array = self._arrays[key] = array.copy()
|
|
142
|
+
make_non_writable(array)
|
|
143
|
+
# Nothing is shared any more (see ``_release_if_empty``).
|
|
144
|
+
self.__dict__.pop("_shared", None)
|
|
120
145
|
|
|
121
146
|
def clone(self, share_arrays: bool = False) -> "InMemoryStorage":
|
|
122
147
|
"""Copy this storage.
|
|
@@ -130,6 +155,10 @@ class InMemoryStorage:
|
|
|
130
155
|
it in place does not change this storage. (Masked arrays are copied
|
|
131
156
|
straight away: a view would share their mask.)
|
|
132
157
|
|
|
158
|
+
The clone is not read-only, even when this storage is (see
|
|
159
|
+
``make_read_only``): what it copies is writable, and what it shares
|
|
160
|
+
is copied on first read, as usual.
|
|
161
|
+
|
|
133
162
|
The clone has its own index in both cases: ``put`` and ``delete`` on
|
|
134
163
|
either storage replace or drop index entries without touching the
|
|
135
164
|
arrays, so neither storage sees what the other stores, replaces or
|
|
@@ -183,6 +212,11 @@ class InMemoryStorage:
|
|
|
183
212
|
# First read of an array shared by ``clone``: from here on the
|
|
184
213
|
# caller may write into it, so it needs to be this storage's own.
|
|
185
214
|
values = values.copy()
|
|
215
|
+
# Not reached today, since ``make_read_only`` copies every shared
|
|
216
|
+
# array and only ``clone`` shares them, in a storage that is not
|
|
217
|
+
# read-only; kept so the rule holds if that changes.
|
|
218
|
+
if self.read_only:
|
|
219
|
+
make_non_writable(values)
|
|
186
220
|
self._arrays[key] = values
|
|
187
221
|
self._stop_sharing(key)
|
|
188
222
|
return values
|
|
@@ -284,6 +318,10 @@ class InMemoryStorage:
|
|
|
284
318
|
``derived`` marks a value the simulation calculated rather than took
|
|
285
319
|
as input (see ``_inputs``), and ``sequence_number`` records when the
|
|
286
320
|
value was stored (a new number by default); see :meth:`drop_computed`.
|
|
321
|
+
|
|
322
|
+
In a read-only storage (see ``make_read_only``) ``value`` itself is
|
|
323
|
+
marked non-writable, so a caller still holding it cannot write into
|
|
324
|
+
the stored value either.
|
|
287
325
|
"""
|
|
288
326
|
if self.is_eternal:
|
|
289
327
|
period = periods.period(periods.ETERNITY)
|
|
@@ -293,6 +331,8 @@ class InMemoryStorage:
|
|
|
293
331
|
# would be ambiguous to parse back, as ``OnDiskStorage.put`` does.
|
|
294
332
|
check_storable(branch_name, period)
|
|
295
333
|
key = f"{branch_name}:{period}"
|
|
334
|
+
if self.read_only:
|
|
335
|
+
make_non_writable(value)
|
|
296
336
|
self._arrays[key] = value
|
|
297
337
|
self._stop_sharing(key)
|
|
298
338
|
if derived:
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import numpy
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def make_non_writable(value) -> None:
|
|
5
|
+
"""Mark ``value``'s data non-writable, if it is a numpy array.
|
|
6
|
+
|
|
7
|
+
The flag is set on the array object itself, so it holds for every holder
|
|
8
|
+
of that object: a later in-place write through it raises ``ValueError``.
|
|
9
|
+
A masked array's mask is a separate array, so it is marked too, after
|
|
10
|
+
giving an array with no mask an all-false one of its own: otherwise
|
|
11
|
+
masking an entry in place would make a new, writable mask. Values that
|
|
12
|
+
are not numpy arrays are left as they are.
|
|
13
|
+
"""
|
|
14
|
+
if not isinstance(value, numpy.ndarray):
|
|
15
|
+
return
|
|
16
|
+
value.flags.writeable = False
|
|
17
|
+
if isinstance(value, numpy.ma.MaskedArray):
|
|
18
|
+
if value._mask is numpy.ma.nomask:
|
|
19
|
+
value.mask = numpy.ma.make_mask_none(value.shape, value.dtype)
|
|
20
|
+
value._mask.flags.writeable = False
|
|
@@ -9,6 +9,7 @@ import numpy
|
|
|
9
9
|
from numpy.typing import ArrayLike
|
|
10
10
|
|
|
11
11
|
from policyengine_core import periods
|
|
12
|
+
from policyengine_core.data_storage.non_writable import make_non_writable
|
|
12
13
|
from policyengine_core.data_storage.store_history import (
|
|
13
14
|
_period_from_storage_key,
|
|
14
15
|
advance_sequence_past,
|
|
@@ -112,6 +113,10 @@ class OnDiskStorage:
|
|
|
112
113
|
# Whether this storage writes only new files (see ``_path_to_write``).
|
|
113
114
|
_detached = False
|
|
114
115
|
_own_epoch = None
|
|
116
|
+
# Whether ``get`` returns, and ``put`` leaves, only non-writable arrays:
|
|
117
|
+
# set by ``make_read_only`` for a read-only simulation's holders (see
|
|
118
|
+
# ``Simulation.make_read_only``). A clone is not read-only.
|
|
119
|
+
read_only = False
|
|
115
120
|
|
|
116
121
|
def __init__(
|
|
117
122
|
self,
|
|
@@ -290,6 +295,17 @@ class OnDiskStorage:
|
|
|
290
295
|
self._own_paths = {}
|
|
291
296
|
return clone
|
|
292
297
|
|
|
298
|
+
def make_read_only(self) -> None:
|
|
299
|
+
"""Make ``get`` return non-writable arrays from here on, and ``put``
|
|
300
|
+
mark the arrays it stores non-writable.
|
|
301
|
+
|
|
302
|
+
Each ``get`` reads its file into a new array, so writing into one in
|
|
303
|
+
place never changed the stored value; the flag makes that write raise
|
|
304
|
+
all the same, as it does for a read-only ``InMemoryStorage``. The
|
|
305
|
+
files themselves are left as they are.
|
|
306
|
+
"""
|
|
307
|
+
self.read_only = True
|
|
308
|
+
|
|
293
309
|
def _decode_file(self, file: str) -> ArrayLike:
|
|
294
310
|
enum = self._enums.get(file)
|
|
295
311
|
if enum is not None:
|
|
@@ -305,7 +321,10 @@ class OnDiskStorage:
|
|
|
305
321
|
values = self._files.get(f"{branch_name}_{period}")
|
|
306
322
|
if values is None:
|
|
307
323
|
return None
|
|
308
|
-
|
|
324
|
+
array = self._decode_file(values)
|
|
325
|
+
if self.read_only:
|
|
326
|
+
make_non_writable(array)
|
|
327
|
+
return array
|
|
309
328
|
|
|
310
329
|
def has(self, period: Period, branch_name: str = "default") -> bool:
|
|
311
330
|
"""Whether a value is stored for ``period`` under ``branch_name``.
|
|
@@ -335,7 +354,8 @@ class OnDiskStorage:
|
|
|
335
354
|
"""Store ``value`` for ``period`` on ``branch_name``.
|
|
336
355
|
|
|
337
356
|
``derived`` and ``sequence_number`` are as in
|
|
338
|
-
:meth:`InMemoryStorage.put`.
|
|
357
|
+
:meth:`InMemoryStorage.put`. In a read-only storage ``value`` is
|
|
358
|
+
marked non-writable, as there.
|
|
339
359
|
"""
|
|
340
360
|
if self.is_eternal:
|
|
341
361
|
period = periods.period(periods.ETERNITY)
|
|
@@ -345,6 +365,8 @@ class OnDiskStorage:
|
|
|
345
365
|
# ``InMemoryStorage.put`` rejects. A month anchored mid-month, say,
|
|
346
366
|
# would be stored under the key of the calendar month.
|
|
347
367
|
check_storable(branch_name, period)
|
|
368
|
+
if self.read_only:
|
|
369
|
+
make_non_writable(value)
|
|
348
370
|
|
|
349
371
|
filename = f"{branch_name}_{period}"
|
|
350
372
|
path = self._path_to_write(filename)
|
|
@@ -5,6 +5,7 @@ from .non_deterministic_formula_error import NonDeterministicFormulaError
|
|
|
5
5
|
from .parameter_not_found_error import ParameterNotFoundError
|
|
6
6
|
from .parameter_parsing_error import ParameterParsingError
|
|
7
7
|
from .period_mismatch_error import PeriodMismatchError
|
|
8
|
+
from .read_only_simulation_error import ReadOnlySimulationError
|
|
8
9
|
from .situation_parsing_error import SituationParsingError
|
|
9
10
|
from .spiral_error import SpiralError
|
|
10
11
|
from .variable_name_conflict_error import VariableNameConflictError
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
class ReadOnlySimulationError(RuntimeError):
|
|
2
|
+
"""An operation would change a simulation made read-only.
|
|
3
|
+
|
|
4
|
+
Raised by an operation that would change the inputs, stored values or
|
|
5
|
+
tax-benefit system of a simulation after ``Simulation.make_read_only()``,
|
|
6
|
+
and by its next calculation once its parameters have changed (see
|
|
7
|
+
``Simulation.make_read_only``).
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def refuse_on_read_only(simulation, operation: str) -> None:
|
|
12
|
+
"""Raise :class:`ReadOnlySimulationError` if ``simulation`` is read-only.
|
|
13
|
+
|
|
14
|
+
``operation`` names what was refused, for the message. ``simulation`` may
|
|
15
|
+
be ``None``, or a stand-in object without the flag: neither is read-only.
|
|
16
|
+
"""
|
|
17
|
+
if getattr(simulation, "read_only", False):
|
|
18
|
+
raise ReadOnlySimulationError(
|
|
19
|
+
f"{operation} would change a read-only simulation. "
|
|
20
|
+
"make_read_only() was called on it, so it refuses changes to its "
|
|
21
|
+
"inputs, stored values and tax-benefit system. Make the change on "
|
|
22
|
+
"a branch (get_branch) or a clone instead."
|
|
23
|
+
)
|
|
@@ -6,6 +6,7 @@ from numpy.typing import ArrayLike
|
|
|
6
6
|
|
|
7
7
|
from policyengine_core import periods
|
|
8
8
|
from policyengine_core.data_storage.store_history import _period_from_storage_key
|
|
9
|
+
from policyengine_core.errors.read_only_simulation_error import refuse_on_read_only
|
|
9
10
|
from policyengine_core.holders.holder import Holder
|
|
10
11
|
from policyengine_core.periods import Period
|
|
11
12
|
|
|
@@ -76,8 +77,10 @@ def _store_input(
|
|
|
76
77
|
The value is added to the simulation's record of inputs even when the
|
|
77
78
|
helper is called directly instead of through ``Holder.set_input``, and
|
|
78
79
|
``calculate``'s fast cache drops the value it held for the period.
|
|
80
|
+
Raises ``ReadOnlySimulationError`` for a read-only simulation's holder.
|
|
79
81
|
"""
|
|
80
82
|
simulation = getattr(holder, "simulation", None)
|
|
83
|
+
refuse_on_read_only(simulation, "set_input")
|
|
81
84
|
input_keys = getattr(simulation, "_user_input_keys", None)
|
|
82
85
|
# Let the holder normalize and record the supplied-input tier, including
|
|
83
86
|
# direct helper calls. Keep a legacy holder without an input record in
|
|
@@ -261,6 +264,8 @@ def set_input_dispatch_by_period(holder: Holder, period: Period, array: ArrayLik
|
|
|
261
264
|
|
|
262
265
|
To read more about ``set_input`` attributes, check the `documentation <https://openfisca.org/doc/coding-the-legislation/35_periods.html#set-input-automatically-process-variable-inputs-defined-for-periods-not-matching-the-definition-period>`_.
|
|
263
266
|
"""
|
|
267
|
+
# Before anything is dropped or stored (see ``Simulation.make_read_only``).
|
|
268
|
+
refuse_on_read_only(getattr(holder, "simulation", None), "set_input")
|
|
264
269
|
array = holder._to_array(array, validate_nan=True)
|
|
265
270
|
|
|
266
271
|
period_size = period.size
|
|
@@ -307,6 +312,8 @@ def set_input_divide_by_period(holder: Holder, period: Period, array: ArrayLike)
|
|
|
307
312
|
|
|
308
313
|
To read more about ``set_input`` attributes, check the `documentation <https://openfisca.org/doc/coding-the-legislation/35_periods.html#set-input-automatically-process-variable-inputs-defined-for-periods-not-matching-the-definition-period>`_.
|
|
309
314
|
"""
|
|
315
|
+
# Before anything is dropped or stored (see ``Simulation.make_read_only``).
|
|
316
|
+
refuse_on_read_only(getattr(holder, "simulation", None), "set_input")
|
|
310
317
|
if not isinstance(array, numpy.ndarray):
|
|
311
318
|
array = numpy.array(array)
|
|
312
319
|
array = holder._to_array(array, validate_nan=True)
|
|
@@ -12,6 +12,7 @@ from policyengine_core.data_storage import InMemoryStorage, OnDiskStorage
|
|
|
12
12
|
from policyengine_core.data_storage.store_history import next_sequence_number
|
|
13
13
|
from policyengine_core.enums import Enum
|
|
14
14
|
from policyengine_core.errors import PeriodMismatchError
|
|
15
|
+
from policyengine_core.errors.read_only_simulation_error import refuse_on_read_only
|
|
15
16
|
from policyengine_core.periods import Period
|
|
16
17
|
|
|
17
18
|
if TYPE_CHECKING:
|
|
@@ -47,6 +48,15 @@ class Holder:
|
|
|
47
48
|
self._on_disk_storable = True
|
|
48
49
|
if self.variable.name in self.simulation.memory_config.variables_to_drop:
|
|
49
50
|
self._do_not_store = True
|
|
51
|
+
if getattr(self.simulation, "read_only", False):
|
|
52
|
+
self._make_read_only()
|
|
53
|
+
|
|
54
|
+
def _make_read_only(self) -> None:
|
|
55
|
+
"""Make every array this holder stores non-writable, now and from
|
|
56
|
+
here on (see ``Simulation.make_read_only``)."""
|
|
57
|
+
self._memory_storage.make_read_only()
|
|
58
|
+
if self._disk_storage is not None:
|
|
59
|
+
self._disk_storage.make_read_only()
|
|
50
60
|
|
|
51
61
|
def _follow_definition(self, variable: "Variable") -> None:
|
|
52
62
|
"""Take ``variable`` as this holder's definition when its storage fits.
|
|
@@ -147,6 +157,21 @@ class Holder:
|
|
|
147
157
|
|
|
148
158
|
A deleted value set with ``set_input`` stops counting as an input, so
|
|
149
159
|
a value calculated later for the same period is not taken for one.
|
|
160
|
+
|
|
161
|
+
Raises ``ReadOnlySimulationError`` for a read-only simulation's
|
|
162
|
+
holder (see ``Simulation.make_read_only``).
|
|
163
|
+
"""
|
|
164
|
+
refuse_on_read_only(getattr(self, "simulation", None), "delete_arrays")
|
|
165
|
+
self._delete_arrays(period, branch_name)
|
|
166
|
+
|
|
167
|
+
def _delete_arrays(
|
|
168
|
+
self, period: Period = None, branch_name: str = "default"
|
|
169
|
+
) -> None:
|
|
170
|
+
""":meth:`delete_arrays`, for a read-only simulation too.
|
|
171
|
+
|
|
172
|
+
Core calls this when the deletion is part of a calculation: after a
|
|
173
|
+
spiral, it deletes the values calculated from the default the spiral
|
|
174
|
+
returned (``Simulation.purge_cache_of_invalid_values``).
|
|
150
175
|
"""
|
|
151
176
|
simulation = getattr(self, "simulation", None)
|
|
152
177
|
user_input_keys = getattr(simulation, "_user_input_keys", None)
|
|
@@ -616,7 +641,11 @@ class Holder:
|
|
|
616
641
|
Custom handlers store replayable inputs with ``holder._set`` or
|
|
617
642
|
``holder.set_input``. Values written through ``put_in_cache`` are
|
|
618
643
|
excluded from input export and reform replay.
|
|
644
|
+
|
|
645
|
+
Raises ``ReadOnlySimulationError`` for a read-only simulation's
|
|
646
|
+
holder (see ``Simulation.make_read_only``).
|
|
619
647
|
"""
|
|
648
|
+
refuse_on_read_only(getattr(self, "simulation", None), "set_input")
|
|
620
649
|
|
|
621
650
|
period = periods.period(period)
|
|
622
651
|
if (
|
{policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/parameters/parameter.py
RENAMED
|
@@ -127,8 +127,11 @@ class Parameter(AtInstantLike):
|
|
|
127
127
|
return (self.name == other.name) and (self.values_list == other.values_list)
|
|
128
128
|
|
|
129
129
|
def clone(self):
|
|
130
|
+
"""Copy this parameter and its values, with no parent (see
|
|
131
|
+
``ParameterNode.clone``)."""
|
|
130
132
|
clone = empty_clone(self)
|
|
131
133
|
clone.__dict__ = self.__dict__.copy()
|
|
134
|
+
clone.parent = None
|
|
132
135
|
|
|
133
136
|
# Own dict, shared values: see ParameterAtInstant.clone.
|
|
134
137
|
clone.metadata = copy.copy(self.metadata)
|
|
@@ -214,7 +217,9 @@ class Parameter(AtInstantLike):
|
|
|
214
217
|
|
|
215
218
|
self.values_list = new_values
|
|
216
219
|
|
|
217
|
-
|
|
220
|
+
# A parameter cloned on its own has no parent (see ``clone``).
|
|
221
|
+
if getattr(self, "parent", None) is not None:
|
|
222
|
+
self.parent.clear_parent_cache()
|
|
218
223
|
|
|
219
224
|
self.mark_as_modified()
|
|
220
225
|
|
|
@@ -222,7 +227,8 @@ class Parameter(AtInstantLike):
|
|
|
222
227
|
|
|
223
228
|
def mark_as_modified(self):
|
|
224
229
|
self.modified = True
|
|
225
|
-
self
|
|
230
|
+
if getattr(self, "parent", None) is not None:
|
|
231
|
+
self.parent.mark_as_modified()
|
|
226
232
|
|
|
227
233
|
def get_descendants(self):
|
|
228
234
|
return iter(())
|
{policyengine_core-3.38.0 → policyengine_core-3.40.0}/policyengine_core/parameters/parameter_node.py
RENAMED
|
@@ -93,6 +93,36 @@ def _clear_at_instant_caches_upward(node) -> None:
|
|
|
93
93
|
node = getattr(node, "parent", None)
|
|
94
94
|
|
|
95
95
|
|
|
96
|
+
def change_counting_nodes(parameters) -> tuple:
|
|
97
|
+
"""The nodes whose ``_change_count`` count the changes made in the tree
|
|
98
|
+
under ``parameters``.
|
|
99
|
+
|
|
100
|
+
``mark_as_modified`` adds one to the count of every node it passes on its
|
|
101
|
+
way up the ``parent`` links, so the node at the top of those links counts
|
|
102
|
+
every change made below it. For each child of ``parameters`` this follows
|
|
103
|
+
its ``parent`` links to the top, and returns each node reached once, in
|
|
104
|
+
the order of the children. That is normally just ``parameters``. But a
|
|
105
|
+
shallow copy of a tree's top node (policyengine-us makes one for each
|
|
106
|
+
traced simulation) shares the original's children, whose ``parent`` is
|
|
107
|
+
still the original, while a child added through the copy has the copy as
|
|
108
|
+
its parent. Empty when ``parameters`` has no children (or is not a
|
|
109
|
+
parameter node): such a tree holds no parameter values.
|
|
110
|
+
"""
|
|
111
|
+
children = getattr(parameters, "children", None)
|
|
112
|
+
if not children:
|
|
113
|
+
return ()
|
|
114
|
+
counting_nodes = []
|
|
115
|
+
for child in children.values():
|
|
116
|
+
node = child
|
|
117
|
+
visited = set()
|
|
118
|
+
while getattr(node, "parent", None) is not None and id(node) not in visited:
|
|
119
|
+
visited.add(id(node))
|
|
120
|
+
node = node.parent
|
|
121
|
+
if not any(node is counting_node for counting_node in counting_nodes):
|
|
122
|
+
counting_nodes.append(node)
|
|
123
|
+
return tuple(counting_nodes)
|
|
124
|
+
|
|
125
|
+
|
|
96
126
|
class _AtInstantCache(dict):
|
|
97
127
|
"""A parameter node's nodes at instant, by instant.
|
|
98
128
|
|
|
@@ -130,6 +160,16 @@ class ParameterNode(AtInstantLike):
|
|
|
130
160
|
parent: "ParameterNode" = None
|
|
131
161
|
"""The parent of the node, or None if the node is the root of the tree."""
|
|
132
162
|
|
|
163
|
+
_change_count: int = 0
|
|
164
|
+
"""How many times a change below this node was recorded: each
|
|
165
|
+
``mark_as_modified`` that reaches the node (``Parameter.update`` calls it,
|
|
166
|
+
and so do the scale and node equivalents) adds one, as does
|
|
167
|
+
``TaxBenefitSystem.modify_parameters`` for the tree it passes on. A
|
|
168
|
+
read-only simulation compares the counts on the nodes
|
|
169
|
+
``change_counting_nodes`` finds with the ones it recorded (see
|
|
170
|
+
``Simulation.make_read_only``). An edit that bypasses those, such as
|
|
171
|
+
assigning ``values_list`` or calling ``add_child`` directly, adds nothing."""
|
|
172
|
+
|
|
133
173
|
def __init__(
|
|
134
174
|
self,
|
|
135
175
|
name: str = "",
|
|
@@ -344,8 +384,16 @@ class ParameterNode(AtInstantLike):
|
|
|
344
384
|
yield from child.get_descendants()
|
|
345
385
|
|
|
346
386
|
def clone(self) -> "ParameterNode":
|
|
387
|
+
"""Copy this node and everything below it.
|
|
388
|
+
|
|
389
|
+
The copy has no parent: it is the top node of a tree of its own, so
|
|
390
|
+
changes made in it do not mark the tree this node is in modified, nor
|
|
391
|
+
clear its caches. Cloning the node holding this one sets the parent
|
|
392
|
+
of the copy it makes.
|
|
393
|
+
"""
|
|
347
394
|
clone = commons.empty_clone(self)
|
|
348
395
|
clone.__dict__ = self.__dict__.copy()
|
|
396
|
+
clone.parent = None
|
|
349
397
|
|
|
350
398
|
# Own dict, shared values: see ParameterAtInstant.clone.
|
|
351
399
|
clone.metadata = copy.copy(self.metadata)
|
|
@@ -391,6 +439,7 @@ class ParameterNode(AtInstantLike):
|
|
|
391
439
|
|
|
392
440
|
def mark_as_modified(self):
|
|
393
441
|
self.modified = True
|
|
442
|
+
self._change_count += 1
|
|
394
443
|
if self.parent is not None:
|
|
395
444
|
self.parent.mark_as_modified()
|
|
396
445
|
|
|
@@ -117,8 +117,11 @@ class ParameterScale(AtInstantLike):
|
|
|
117
117
|
self.parent.mark_as_modified()
|
|
118
118
|
|
|
119
119
|
def clone(self) -> "ParameterScale":
|
|
120
|
+
"""Copy this scale and its brackets, with no parent (see
|
|
121
|
+
``ParameterNode.clone``)."""
|
|
120
122
|
clone = commons.empty_clone(self)
|
|
121
123
|
clone.__dict__ = self.__dict__.copy()
|
|
124
|
+
clone.parent = None
|
|
122
125
|
|
|
123
126
|
clone.brackets = [bracket.clone() for bracket in self.brackets]
|
|
124
127
|
for bracket in clone.brackets:
|