Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support mypy 1.12 #882

Merged
merged 4 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repos:
language: python
entry: bash -c ". ${PRE_COMMIT_MYPY_VENV:-/dev/null}/bin/activate 2>/dev/null; mypy $0 $@"
additional_dependencies:
- mypy >= 1.9.0
- mypy >= 1.12.0
- asyncssh
- git+https://github.com/iiasa/ixmp.git@main
- importlib_resources
Expand All @@ -22,7 +22,7 @@ repos:
- types-requests
args: ["."]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.4
rev: v0.6.9
hooks:
- id: ruff
- id: ruff-format
Expand Down
4 changes: 2 additions & 2 deletions message_ix/tools/add_year/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,9 @@ def add_year(
cat_year_new: pd.DataFrame = sc_new.set("cat_year")
firstmodelyear_new = cat_year_new.query("type_year == 'firstmodelyear'")
firstyr_new: int = (
min(cat_year_new["year"])
int(min(cat_year_new["year"]))
if firstmodelyear_new.empty
else firstmodelyear_new["year"]
else int(firstmodelyear_new["year"].item())
) # type: ignore
# assert isinstance(firstyear_new, int)

Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ omit = [

[tool.mypy]
exclude = ["doc/"]
# TODO Remove this once it has become default with mypy 2.0:
local_partial_types = true

[[tool.mypy.overrides]]
# Packages/modules for which no type hints are available.
Expand Down
3 changes: 3 additions & 0 deletions tutorial/westeros/westeros_report.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,12 @@
"rep.add(\"A\", 1)\n",
"rep.add(\"B\", 2)\n",
"\n",
"\n",
"# Add one node and two edges\n",
"def add(*inputs):\n",
" return sum(inputs)\n",
"\n",
"\n",
"rep.add(\"C\", add, \"A\", \"B\")"
]
},
Expand Down Expand Up @@ -284,6 +286,7 @@
"def ratio(a, b):\n",
" return a / b\n",
"\n",
"\n",
"# Add your code here:"
]
},
Expand Down
Loading