Skip to content

Commit

Permalink
Ensure that custom baseline or reform triggers import of Reform class (
Browse files Browse the repository at this point in the history
…#1997)

* feat: Ensure that custom baseline or reform triggers Reform input in getHeaderCode

* chore: Lint

---------

Co-authored-by: PolicyEngine[bot] <[email protected]>
  • Loading branch information
anth-volk and PolicyEngine[bot] authored Sep 2, 2024
1 parent 7166ed4 commit 5a48767
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions src/data/reformDefinitionCode.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@ export function getHeaderCode(type, metadata, policy) {
lines.push("from " + metadata.package + " import Microsimulation");
}

// If there is a reform, add the following Python imports
if (Object.keys(policy.reform.data).length > 0) {
// If either baseline or reform is custom, add the following Python imports
if (
Object.keys(policy.reform.data).length > 0 ||
Object.keys(policy.baseline.data).length > 0
) {
lines.push("from policyengine_core.reforms import Reform");
}

Expand Down

0 comments on commit 5a48767

Please sign in to comment.