Deltares / Deltares/imod-python

remove type: ignore comment statements

Open
#999 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
41
Forks
12
Avg merge
21h 8m
Merged PRs (30d)
1

Description

wile working on issue #990 many type-checking errors were removed, but some could not be, and in those cases a #type: ignore
statement was added.
Ideally, those should be fixed as well.
Some #type: ignore cannot be removed as they form part of the type-dispatched code.
The places where #type: ignore was added that may e can be fixed come from here:


Pixi task (default): mypy
imod\typing\structured.py:58: error: Argument 1 to "check_sizes" has incompatible type "defaultdict[Hashable, set[int]]"; expected "defaultdict[str, set[int]]"  [arg-type]
imod\typing\structured.py:67: error: Incompatible return value type (got "Coordinates", expected "dict[str, Any]")  [return-value]
imod\typing\structured.py:94: error: Argument 2 to "zip" has incompatible type "tuple[tuple[int, ...], ...] | None"; expected "Iterable[tuple[int, ...]]"  [arg-type]
imod\typing\structured.py:96: error: Argument 1 to "check_sizes" has incompatible type "defaultdict[Hashable, set[tuple[int, ...]]]"; expected "defaultdict[str, set[int]]"  [arg-type]
imod\typing\structured.py:247: error: List comprehension has incompatible type List[DataArray | Dataset]; expected List[DataArray]  [misc]
imod\typing\structured.py:252: error: Argument 1 to "_merge_partitions" has incompatible type "list[DataArray | Dataset]"; expected "list[DataArray]"  [arg-type]
imod\util\spatial.py:233: error: Argument 1 to "drop_vars" of "Dataset" has incompatible type "Hashable | Any"; expected "str | Iterable[Hashable] | Callable[[Dataset], str | Iterable[Hashable]]"  [arg-type]
imod\util\spatial.py:340: error: Item "None" of "Match[str] | None" has no attribute "groups"  [union-attr]
imod\prepare\wells.py:82: error: Value of type "float" is not indexable  [index]
imod\mf6\simulation.py:177: error: Argument 1 to "timestep_duration" has incompatible type "list[datetime64 | Any]"; expected "ndarray[Any, Any]"  [arg-type]
Found 10 errors in 4 files (checked 103 source files)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the default Pixi task, mypy, and compare its output with the listed errors. Inspect imod/typing/structured.py, imod/util/spatial.py, imod/prepare/wells.py, and imod/mf6/simulation.py at the reported lines. Done means the fixable type errors and their #type: ignore comments are removed, while comments required for type-dispatched code remain.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.