From a7c2f01280f1e4fd2fc5f049a66da68006449c59 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Fri, 6 Mar 2026 08:48:57 -0500 Subject: [PATCH] Add ruff linting to Makefile format target Configure ruff check with E (pycodestyle), F (pyflakes), and I (isort) rule sets. Auto-fixed import sorting; remaining rules that conflict with existing code patterns are ignored for now. This makes ruff check available via `make format` without enforcing it in CI yet. Co-Authored-By: Claude Opus 4.6 --- Makefile | 1 + changelog.d/add-ruff-linting.added.md | 1 + docs/household_net_income.ipynb | 498 +++++++++--------- policyengine_canada/__init__.py | 8 +- .../data/datasets/country_template_dataset.py | 3 +- policyengine_canada/model_api.py | 4 +- policyengine_canada/tools/general.py | 1 + policyengine_canada/typing.py | 7 +- .../geographic/province/province_code.py | 1 + pyproject.toml | 17 + 10 files changed, 281 insertions(+), 260 deletions(-) create mode 100644 changelog.d/add-ruff-linting.added.md diff --git a/Makefile b/Makefile index 3569e6bf3..a12c09543 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ documentation: jupyter-book build docs format: + ruff check . --fix ruff format . install: diff --git a/changelog.d/add-ruff-linting.added.md b/changelog.d/add-ruff-linting.added.md new file mode 100644 index 000000000..597070fb5 --- /dev/null +++ b/changelog.d/add-ruff-linting.added.md @@ -0,0 +1 @@ +Added ruff linting (ruff check) to Makefile format target with E, F, and I rule sets. diff --git a/docs/household_net_income.ipynb b/docs/household_net_income.ipynb index e50cdfcfe..3bd704e25 100644 --- a/docs/household_net_income.ipynb +++ b/docs/household_net_income.ipynb @@ -189,11 +189,11 @@ } ], "source": [ - "from policyengine_canada import Microsimulation, Simulation\n", - "from policyengine_core.reforms import Reform\n", - "from policyengine_canada.model_api import *\n", "import pandas as pd\n", "\n", + "from policyengine_canada import Simulation\n", + "from policyengine_canada.model_api import *\n", + "\n", "YEAR = 2023\n", "\n", "\n", @@ -6573,7 +6573,7 @@ 0.2005000114440918, 0.2005000114440918, 0.2005000114440918, - 0.23223435878753662, + 0.23223435878753665, 0.24150002002716064, 0.24150002002716064, 0.29539841413497925, @@ -6625,56 +6625,56 @@ 0.3165937662124634, 0.31660157442092896, 0.31660157442092896, - 0.36939841508865356, + 0.3693984150886536, 0.37160158157348633, - 0.37159377336502075, + 0.3715937733650207, 0.3716093897819519, - 0.37159377336502075, + 0.3715937733650207, 0.37160158157348633, 0.37160158157348633, - 0.37159377336502075, + 0.3715937733650207, 0.3716093897819519, - 0.37159377336502075, + 0.3715937733650207, 0.37160158157348633, 0.37160158157348633, - 0.37159377336502075, + 0.3715937733650207, 0.3716093897819519, - 0.37159377336502075, + 0.3715937733650207, 0.37160158157348633, 0.37160158157348633, - 0.37159377336502075, + 0.3715937733650207, 0.3716093897819519, - 0.37159377336502075, + 0.3715937733650207, 0.37160158157348633, 0.37160158157348633, - 0.37159377336502075, + 0.3715937733650207, 0.3716093897819519, - 0.37159377336502075, + 0.3715937733650207, 0.37160158157348633, 0.37160158157348633, - 0.37159377336502075, + 0.3715937733650207, 0.3716093897819519, - 0.37159377336502075, + 0.3715937733650207, 0.37160158157348633, 0.37160158157348633, - 0.37159377336502075, + 0.3715937733650207, 0.3716093897819519, - 0.37159377336502075, + 0.3715937733650207, 0.37160158157348633, 0.37160158157348633, - 0.37159377336502075, + 0.3715937733650207, 0.3716093897819519, - 0.37159377336502075, + 0.3715937733650207, 0.37160158157348633, 0.37160158157348633, - 0.37159377336502075, + 0.3715937733650207, 0.3716093897819519, - 0.37159377336502075, + 0.3715937733650207, 0.37160158157348633, 0.37160158157348633, - 0.37159377336502075, + 0.3715937733650207, 0.3716093897819519, - 0.37159377336502075, + 0.3715937733650207, 0.37160158157348633, 0.37160158157348633, 0.3815937638282776, @@ -6720,29 +6720,29 @@ 0.41160154342651367, 0.41160154342651367, 0.4115937352180481, - 0.41160935163497925, + 0.4116093516349793, 0.4115937352180481, - 0.41160935163497925, + 0.4116093516349793, 0.4115937352180481, 0.4115937352180481, - 0.41160935163497925, + 0.4116093516349793, 0.4115937352180481, - 0.41160935163497925, + 0.4116093516349793, 0.4115937352180481, 0.4115937352180481, - 0.41160935163497925, + 0.4116093516349793, 0.4115937352180481, - 0.41160935163497925, + 0.4116093516349793, 0.4115937352180481, 0.4115937352180481, - 0.41160935163497925, + 0.4116093516349793, 0.4115937352180481, - 0.41160935163497925, + 0.4116093516349793, 0.4115937352180481, 0.4115937352180481, - 0.41160935163497925, + 0.4116093516349793, 0.4115937352180481, - 0.41160935163497925, + 0.4116093516349793, 0.4311562776565552, 0.4515937566757202, 0.45160937309265137, @@ -7196,7 +7196,7 @@ 0.2005000114440918, 0.2005000114440918, 0.2005000114440918, - 0.23223435878753662, + 0.23223435878753665, 0.24150002002716064, 0.24150002002716064, 0.29539841413497925, @@ -7248,56 +7248,56 @@ 0.3165937662124634, 0.31660157442092896, 0.31660157442092896, - 0.36939841508865356, + 0.3693984150886536, 0.37160158157348633, - 0.37159377336502075, + 0.3715937733650207, 0.3716093897819519, - 0.37159377336502075, + 0.3715937733650207, 0.37160158157348633, 0.37160158157348633, - 0.37159377336502075, + 0.3715937733650207, 0.3716093897819519, - 0.37159377336502075, + 0.3715937733650207, 0.37160158157348633, 0.37160158157348633, - 0.37159377336502075, + 0.3715937733650207, 0.3716093897819519, - 0.37159377336502075, + 0.3715937733650207, 0.37160158157348633, 0.37160158157348633, - 0.37159377336502075, + 0.3715937733650207, 0.3716093897819519, - 0.37159377336502075, + 0.3715937733650207, 0.37160158157348633, 0.37160158157348633, - 0.37159377336502075, + 0.3715937733650207, 0.3716093897819519, - 0.37159377336502075, + 0.3715937733650207, 0.37160158157348633, 0.37160158157348633, - 0.37159377336502075, + 0.3715937733650207, 0.3716093897819519, - 0.37159377336502075, + 0.3715937733650207, 0.37160158157348633, 0.37160158157348633, - 0.37159377336502075, + 0.3715937733650207, 0.3716093897819519, - 0.37159377336502075, + 0.3715937733650207, 0.37160158157348633, 0.37160158157348633, - 0.37159377336502075, + 0.3715937733650207, 0.3716093897819519, - 0.37159377336502075, + 0.3715937733650207, 0.37160158157348633, 0.37160158157348633, - 0.37159377336502075, + 0.3715937733650207, 0.3716093897819519, - 0.37159377336502075, + 0.3715937733650207, 0.37160158157348633, 0.37160158157348633, - 0.37159377336502075, + 0.3715937733650207, 0.3716093897819519, - 0.37159377336502075, + 0.3715937733650207, 0.37160158157348633, 0.37160158157348633, 0.3815937638282776, @@ -7343,29 +7343,29 @@ 0.41160154342651367, 0.41160154342651367, 0.4115937352180481, - 0.41160935163497925, + 0.4116093516349793, 0.4115937352180481, - 0.41160935163497925, + 0.4116093516349793, 0.4115937352180481, 0.4115937352180481, - 0.41160935163497925, + 0.4116093516349793, 0.4115937352180481, - 0.41160935163497925, + 0.4116093516349793, 0.4115937352180481, 0.4115937352180481, - 0.41160935163497925, + 0.4116093516349793, 0.4115937352180481, - 0.41160935163497925, + 0.4116093516349793, 0.4115937352180481, 0.4115937352180481, - 0.41160935163497925, + 0.4116093516349793, 0.4115937352180481, - 0.41160935163497925, + 0.4116093516349793, 0.4115937352180481, 0.4115937352180481, - 0.41160935163497925, + 0.4116093516349793, 0.4115937352180481, - 0.41160935163497925, + 0.4116093516349793, 0.4311562776565552, 0.4515937566757202, 0.45160937309265137, @@ -7872,123 +7872,123 @@ 0.3485937714576721, 0.3486015796661377, 0.4013984203338623, - 0.40360158681869507, - 0.40360158681869507, + 0.403601586818695, + 0.403601586818695, 0.4035937786102295, - 0.40360158681869507, - 0.40360158681869507, - 0.40360158681869507, - 0.40360158681869507, + 0.403601586818695, + 0.403601586818695, + 0.403601586818695, + 0.403601586818695, 0.4035937786102295, - 0.40360158681869507, - 0.40360158681869507, - 0.40360158681869507, - 0.40360158681869507, + 0.403601586818695, + 0.403601586818695, + 0.403601586818695, + 0.403601586818695, 0.4035937786102295, - 0.40360158681869507, - 0.40360158681869507, - 0.40360158681869507, - 0.40360158681869507, + 0.403601586818695, + 0.403601586818695, + 0.403601586818695, + 0.403601586818695, 0.4035937786102295, - 0.40360158681869507, - 0.40360158681869507, - 0.40360158681869507, - 0.40360158681869507, + 0.403601586818695, + 0.403601586818695, + 0.403601586818695, + 0.403601586818695, 0.4035937786102295, - 0.40360158681869507, - 0.40360158681869507, - 0.40360158681869507, - 0.40360158681869507, + 0.403601586818695, + 0.403601586818695, + 0.403601586818695, + 0.403601586818695, 0.4035937786102295, - 0.40360158681869507, + 0.403601586818695, 0.4035937786102295, - 0.40360158681869507, + 0.403601586818695, 0.4035937786102295, 0.40360939502716064, 0.4035937786102295, - 0.40360158681869507, - 0.40360158681869507, + 0.403601586818695, + 0.403601586818695, 0.4035937786102295, 0.40360939502716064, 0.4035937786102295, - 0.40360158681869507, - 0.40360158681869507, + 0.403601586818695, + 0.403601586818695, 0.4035937786102295, 0.40360939502716064, 0.4035937786102295, - 0.40360158681869507, - 0.40360158681869507, + 0.403601586818695, + 0.403601586818695, 0.4035937786102295, 0.40360939502716064, 0.4035937786102295, - 0.40360158681869507, - 0.40360158681869507, + 0.403601586818695, + 0.403601586818695, 0.41359376907348633, - 0.41426563262939453, + 0.4142656326293946, 0.4436015486717224, 0.4436015486717224, - 0.44359374046325684, + 0.4435937404632568, 0.4436015486717224, 0.4436015486717224, 0.4436015486717224, 0.4436015486717224, - 0.44359374046325684, + 0.4435937404632568, 0.4436015486717224, 0.4436015486717224, 0.4436015486717224, 0.4436015486717224, - 0.44359374046325684, + 0.4435937404632568, 0.4436015486717224, 0.4436015486717224, 0.4436015486717224, 0.4436015486717224, - 0.44359374046325684, + 0.4435937404632568, 0.4436015486717224, 0.4436015486717224, 0.4436015486717224, 0.4436015486717224, - 0.44359374046325684, + 0.4435937404632568, 0.4436015486717224, 0.4436015486717224, 0.4436015486717224, 0.4436015486717224, - 0.44359374046325684, + 0.4435937404632568, 0.4436015486717224, 0.4436015486717224, 0.4436015486717224, 0.4436015486717224, - 0.44359374046325684, + 0.4435937404632568, 0.4436015486717224, 0.4436015486717224, 0.4436015486717224, 0.4436015486717224, - 0.44359374046325684, - 0.44359374046325684, + 0.4435937404632568, + 0.4435937404632568, 0.443609356880188, 0.443609356880188, - 0.44359374046325684, - 0.44359374046325684, - 0.44359374046325684, + 0.4435937404632568, + 0.4435937404632568, + 0.4435937404632568, 0.443609356880188, 0.443609356880188, - 0.44359374046325684, - 0.44359374046325684, - 0.44359374046325684, + 0.4435937404632568, + 0.4435937404632568, + 0.4435937404632568, 0.443609356880188, 0.443609356880188, - 0.44359374046325684, - 0.44359374046325684, - 0.44359374046325684, - 0.41212499141693115, + 0.4435937404632568, + 0.4435937404632568, + 0.4435937404632568, + 0.4121249914169311, 0.4115937352180481, - 0.41160935163497925, + 0.4116093516349793, 0.4115937352180481, - 0.41160935163497925, + 0.4116093516349793, 0.4115937352180481, 0.4115937352180481, - 0.41160935163497925, + 0.4116093516349793, 0.4115937352180481, - 0.41160935163497925, + 0.4116093516349793, 0.4311562776565552, 0.4515937566757202, 0.45160937309265137, @@ -8495,123 +8495,123 @@ 0.3485937714576721, 0.3486015796661377, 0.4013984203338623, - 0.40360158681869507, - 0.40360158681869507, + 0.403601586818695, + 0.403601586818695, 0.4035937786102295, - 0.40360158681869507, - 0.40360158681869507, - 0.40360158681869507, - 0.40360158681869507, + 0.403601586818695, + 0.403601586818695, + 0.403601586818695, + 0.403601586818695, 0.4035937786102295, - 0.40360158681869507, - 0.40360158681869507, - 0.40360158681869507, - 0.40360158681869507, + 0.403601586818695, + 0.403601586818695, + 0.403601586818695, + 0.403601586818695, 0.4035937786102295, - 0.40360158681869507, - 0.40360158681869507, - 0.40360158681869507, - 0.40360158681869507, + 0.403601586818695, + 0.403601586818695, + 0.403601586818695, + 0.403601586818695, 0.4035937786102295, - 0.40360158681869507, - 0.40360158681869507, - 0.40360158681869507, - 0.40360158681869507, + 0.403601586818695, + 0.403601586818695, + 0.403601586818695, + 0.403601586818695, 0.4035937786102295, - 0.40360158681869507, - 0.40360158681869507, - 0.40360158681869507, - 0.40360158681869507, + 0.403601586818695, + 0.403601586818695, + 0.403601586818695, + 0.403601586818695, 0.4035937786102295, 0.4035937786102295, - 0.40360158681869507, - 0.40360158681869507, + 0.403601586818695, + 0.403601586818695, 0.4035937786102295, 0.40360939502716064, 0.4035937786102295, - 0.40360158681869507, - 0.40360158681869507, + 0.403601586818695, + 0.403601586818695, 0.4035937786102295, 0.40360939502716064, 0.4035937786102295, - 0.40360158681869507, - 0.40360158681869507, + 0.403601586818695, + 0.403601586818695, 0.4035937786102295, 0.40360939502716064, 0.4035937786102295, - 0.40360158681869507, - 0.40360158681869507, + 0.403601586818695, + 0.403601586818695, 0.4035937786102295, 0.40360939502716064, 0.4035937786102295, - 0.40360158681869507, - 0.40360158681869507, + 0.403601586818695, + 0.403601586818695, 0.41359376907348633, - 0.41426563262939453, + 0.4142656326293946, 0.4436015486717224, 0.4436015486717224, - 0.44359374046325684, + 0.4435937404632568, 0.4436015486717224, 0.4436015486717224, 0.4436015486717224, 0.4436015486717224, - 0.44359374046325684, + 0.4435937404632568, 0.4436015486717224, 0.4436015486717224, 0.4436015486717224, 0.4436015486717224, - 0.44359374046325684, + 0.4435937404632568, 0.4436015486717224, 0.4436015486717224, 0.4436015486717224, 0.4436015486717224, - 0.44359374046325684, + 0.4435937404632568, 0.4436015486717224, 0.4436015486717224, 0.4436015486717224, 0.4436015486717224, - 0.44359374046325684, + 0.4435937404632568, 0.4436015486717224, 0.4436015486717224, 0.4436015486717224, 0.4436015486717224, - 0.44359374046325684, + 0.4435937404632568, 0.4436015486717224, 0.4436015486717224, 0.4436015486717224, 0.4436015486717224, - 0.44359374046325684, + 0.4435937404632568, 0.4436015486717224, 0.4436015486717224, 0.4436015486717224, 0.4436015486717224, - 0.44359374046325684, - 0.44359374046325684, + 0.4435937404632568, + 0.4435937404632568, 0.443609356880188, 0.443609356880188, - 0.44359374046325684, - 0.44359374046325684, - 0.44359374046325684, + 0.4435937404632568, + 0.4435937404632568, + 0.4435937404632568, 0.443609356880188, 0.443609356880188, - 0.44359374046325684, - 0.44359374046325684, - 0.44359374046325684, + 0.4435937404632568, + 0.4435937404632568, + 0.4435937404632568, 0.443609356880188, 0.443609356880188, - 0.44359374046325684, - 0.44359374046325684, - 0.44359374046325684, - 0.41212499141693115, + 0.4435937404632568, + 0.4435937404632568, + 0.4435937404632568, + 0.4121249914169311, 0.4115937352180481, - 0.41160935163497925, + 0.4116093516349793, 0.4115937352180481, - 0.41160935163497925, + 0.4116093516349793, 0.4115937352180481, 0.4115937352180481, - 0.41160935163497925, + 0.4116093516349793, 0.4115937352180481, - 0.41160935163497925, + 0.4116093516349793, 0.4311562776565552, 0.4515937566757202, 0.45160937309265137, @@ -9117,58 +9117,58 @@ 0.37360936403274536, 0.3735937476158142, 0.3736015558242798, - 0.42639845609664917, - 0.42860156297683716, - 0.42860156297683716, + 0.4263984560966492, + 0.4286015629768371, + 0.4286015629768371, 0.4285937547683716, - 0.42860156297683716, - 0.42860156297683716, - 0.42860156297683716, - 0.42860156297683716, + 0.4286015629768371, + 0.4286015629768371, + 0.4286015629768371, + 0.4286015629768371, 0.4285937547683716, - 0.42860156297683716, - 0.42860156297683716, - 0.42860156297683716, - 0.42860156297683716, + 0.4286015629768371, + 0.4286015629768371, + 0.4286015629768371, + 0.4286015629768371, 0.4285937547683716, - 0.42860156297683716, - 0.42860156297683716, - 0.42860156297683716, - 0.42860156297683716, + 0.4286015629768371, + 0.4286015629768371, + 0.4286015629768371, + 0.4286015629768371, 0.4285937547683716, - 0.42860156297683716, - 0.42860156297683716, - 0.42860156297683716, - 0.42860156297683716, + 0.4286015629768371, + 0.4286015629768371, + 0.4286015629768371, + 0.4286015629768371, 0.4285937547683716, - 0.42860156297683716, - 0.42860156297683716, + 0.4286015629768371, + 0.4286015629768371, 0.4285937547683716, 0.4285937547683716, 0.42860937118530273, 0.4285937547683716, - 0.42860156297683716, - 0.42860156297683716, + 0.4286015629768371, + 0.4286015629768371, 0.4285937547683716, 0.42860937118530273, 0.4285937547683716, - 0.42860156297683716, - 0.42860156297683716, + 0.4286015629768371, + 0.4286015629768371, 0.4285937547683716, 0.42860937118530273, 0.4285937547683716, - 0.42860156297683716, - 0.42860156297683716, + 0.4286015629768371, + 0.4286015629768371, 0.4285937547683716, 0.42860937118530273, 0.4285937547683716, - 0.42860156297683716, - 0.42860156297683716, + 0.4286015629768371, + 0.4286015629768371, 0.4285937547683716, 0.42860937118530273, 0.4285937547683716, - 0.42860156297683716, - 0.42860156297683716, + 0.4286015629768371, + 0.4286015629768371, 0.4385937452316284, 0.4392656087875366, 0.4686015844345093, @@ -9235,7 +9235,7 @@ 0.4685937762260437, 0.4685937762260437, 0.4685937762260437, - 0.48817187547683716, + 0.4881718754768371, 0.508609414100647, 0.508593738079071, 0.508593738079071, @@ -9740,58 +9740,58 @@ 0.37360936403274536, 0.3735937476158142, 0.3736015558242798, - 0.42639845609664917, - 0.42860156297683716, - 0.42860156297683716, + 0.4263984560966492, + 0.4286015629768371, + 0.4286015629768371, 0.4285937547683716, - 0.42860156297683716, - 0.42860156297683716, - 0.42860156297683716, - 0.42860156297683716, + 0.4286015629768371, + 0.4286015629768371, + 0.4286015629768371, + 0.4286015629768371, 0.4285937547683716, - 0.42860156297683716, - 0.42860156297683716, - 0.42860156297683716, - 0.42860156297683716, + 0.4286015629768371, + 0.4286015629768371, + 0.4286015629768371, + 0.4286015629768371, 0.4285937547683716, - 0.42860156297683716, - 0.42860156297683716, - 0.42860156297683716, - 0.42860156297683716, + 0.4286015629768371, + 0.4286015629768371, + 0.4286015629768371, + 0.4286015629768371, 0.4285937547683716, - 0.42860156297683716, - 0.42860156297683716, - 0.42860156297683716, - 0.42860156297683716, + 0.4286015629768371, + 0.4286015629768371, + 0.4286015629768371, + 0.4286015629768371, 0.4285937547683716, - 0.42860156297683716, - 0.42860156297683716, + 0.4286015629768371, + 0.4286015629768371, 0.4285937547683716, 0.4285937547683716, 0.42860937118530273, 0.4285937547683716, - 0.42860156297683716, - 0.42860156297683716, + 0.4286015629768371, + 0.4286015629768371, 0.4285937547683716, 0.42860937118530273, 0.4285937547683716, - 0.42860156297683716, - 0.42860156297683716, + 0.4286015629768371, + 0.4286015629768371, 0.4285937547683716, 0.42860937118530273, 0.4285937547683716, - 0.42860156297683716, - 0.42860156297683716, + 0.4286015629768371, + 0.4286015629768371, 0.4285937547683716, 0.42860937118530273, 0.4285937547683716, - 0.42860156297683716, - 0.42860156297683716, + 0.4286015629768371, + 0.4286015629768371, 0.4285937547683716, 0.42860937118530273, 0.4285937547683716, - 0.42860156297683716, - 0.42860156297683716, + 0.4286015629768371, + 0.4286015629768371, 0.4385937452316284, 0.4392656087875366, 0.4686015844345093, @@ -9858,7 +9858,7 @@ 0.4685937762260437, 0.4685937762260437, 0.4685937762260437, - 0.48817187547683716, + 0.4881718754768371, 0.508609414100647, 0.508593738079071, 0.508593738079071, @@ -10307,11 +10307,11 @@ 0.5404999852180481, 0.5404999852180481, 0.5404999852180481, - 0.42005079984664917, + 0.4200507998466492, 0.390500009059906, 0.390500009059906, 0.390500009059906, - 0.42223435640335083, + 0.4222343564033508, 0.43150001764297485, 0.43150001764297485, 0.48539841175079346, @@ -10360,7 +10360,7 @@ 0.3874765634536743, 0.3966015577316284, 0.3966015577316284, - 0.39659374952316284, + 0.3965937495231629, 0.3966015577316284, 0.3966015577316284, 0.4493984580039978, @@ -10930,11 +10930,11 @@ 0.5404999852180481, 0.5404999852180481, 0.5404999852180481, - 0.42005079984664917, + 0.4200507998466492, 0.390500009059906, 0.390500009059906, 0.390500009059906, - 0.42223435640335083, + 0.4222343564033508, 0.43150001764297485, 0.43150001764297485, 0.48539841175079346, @@ -10983,7 +10983,7 @@ 0.3874765634536743, 0.3966015577316284, 0.3966015577316284, - 0.39659374952316284, + 0.3965937495231629, 0.3966015577316284, 0.3966015577316284, 0.4493984580039978, diff --git a/policyengine_canada/__init__.py b/policyengine_canada/__init__.py index 575d35f89..f605c5679 100644 --- a/policyengine_canada/__init__.py +++ b/policyengine_canada/__init__.py @@ -3,10 +3,6 @@ from pathlib import Path from typing import Dict, Type -from policyengine_canada.entities import entities -from policyengine_canada.data.datasets.country_template_dataset import ( - CountryTemplateDataset, -) from policyengine_core.data.dataset import Dataset from policyengine_core.populations.population import Population from policyengine_core.simulations import ( @@ -15,6 +11,10 @@ from policyengine_core.simulations import Simulation as CoreSimulation from policyengine_core.taxbenefitsystems import TaxBenefitSystem +from policyengine_canada.data.datasets.country_template_dataset import ( + CountryTemplateDataset, +) +from policyengine_canada.entities import entities from policyengine_canada.variables.household.demographic.geographic.province.in_province import ( create_10_province_variables, ) diff --git a/policyengine_canada/data/datasets/country_template_dataset.py b/policyengine_canada/data/datasets/country_template_dataset.py index 71b868357..0da5197e0 100644 --- a/policyengine_canada/data/datasets/country_template_dataset.py +++ b/policyengine_canada/data/datasets/country_template_dataset.py @@ -1,7 +1,8 @@ +from pathlib import Path + from policyengine_core.country_template.constants import COUNTRY_DIR from policyengine_core.data import Dataset from policyengine_core.periods import ETERNITY, period -from pathlib import Path class CountryTemplateDataset(Dataset): diff --git a/policyengine_canada/model_api.py b/policyengine_canada/model_api.py index 23020fa75..88a230ebc 100644 --- a/policyengine_canada/model_api.py +++ b/policyengine_canada/model_api.py @@ -1,8 +1,6 @@ from policyengine_core.model_api import * + from policyengine_canada.entities import * -from policyengine_canada.variables.household.demographic.geographic.province.province_code import ( - ProvinceCode, -) from policyengine_canada.tools.general import * CAD = "currency-CAD" diff --git a/policyengine_canada/tools/general.py b/policyengine_canada/tools/general.py index bfb0464d1..2ecbdf085 100644 --- a/policyengine_canada/tools/general.py +++ b/policyengine_canada/tools/general.py @@ -1,4 +1,5 @@ from policyengine_core.model_api import * + from policyengine_canada.entities import * diff --git a/policyengine_canada/typing.py b/policyengine_canada/typing.py index 9e5c07abf..51e79c320 100644 --- a/policyengine_canada/typing.py +++ b/policyengine_canada/typing.py @@ -1,7 +1,8 @@ -from numpy.typing import ArrayLike from typing import Callable, Tuple -from policyengine_core.populations import Population -from policyengine_core.periods import Period + +from numpy.typing import ArrayLike from policyengine_core.parameters import ParameterNode +from policyengine_core.periods import Period +from policyengine_core.populations import Population Formula = Callable[[Tuple[Population, Period, ParameterNode]], ArrayLike] diff --git a/policyengine_canada/variables/household/demographic/geographic/province/province_code.py b/policyengine_canada/variables/household/demographic/geographic/province/province_code.py index 626c77bca..e34aae4f5 100644 --- a/policyengine_canada/variables/household/demographic/geographic/province/province_code.py +++ b/policyengine_canada/variables/household/demographic/geographic/province/province_code.py @@ -1,4 +1,5 @@ from policyengine_core.model_api import * + from policyengine_canada.entities import * from policyengine_canada.tools.general import * diff --git a/pyproject.toml b/pyproject.toml index c62a631c3..b19ed2cfd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -94,3 +94,20 @@ showcontent = true [tool.ruff] line-length = 88 + +[tool.ruff.lint] +select = ["E", "F", "I"] +ignore = [ + "E402", # module-import-not-at-top-of-file + "E501", # line too long (handled by ruff format) + "E712", # true-false-comparison (common in numpy/pandas code) + "E721", # type-comparison + "E722", # bare-except + "E741", # ambiguous-variable-name + "F401", # unused-import (many are intentional re-exports) + "F403", # undefined-local-with-import-star + "F405", # undefined-local-with-import-star-usage + "F811", # redefined-while-unused + "F821", # undefined-name (from star imports) + "F841", # unused-variable +]