From 5a48767d7ec1e85406e2f1786ef642dec75d093d Mon Sep 17 00:00:00 2001 From: "Anthony V." Date: Mon, 2 Sep 2024 16:18:50 +0200 Subject: [PATCH] Ensure that custom baseline or reform triggers import of Reform class (#1997) * feat: Ensure that custom baseline or reform triggers Reform input in getHeaderCode * chore: Lint --------- Co-authored-by: PolicyEngine[bot] --- package-lock.json | 1 - src/data/reformDefinitionCode.js | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index c852b36da..ca177a21a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20667,7 +20667,6 @@ "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", "dev": true, - "license": "MIT", "bin": { "prettier": "bin/prettier.cjs" }, diff --git a/src/data/reformDefinitionCode.js b/src/data/reformDefinitionCode.js index 101f1abe6..96531633c 100644 --- a/src/data/reformDefinitionCode.js +++ b/src/data/reformDefinitionCode.js @@ -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"); }