-
Notifications
You must be signed in to change notification settings - Fork 3
Issue #783 Fix all remaining MyPy errors #784
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
Conversation
a3a26f7
to
9d3f70b
Compare
9d3f70b
to
48d0261
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good
imod/mf6/boundary_condition.py
Outdated
def write( | ||
self, | ||
pkgname: str, | ||
globaltimes: Union[List, np.ndarray], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you specify that it must be a list of Datetimes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -333,6 +334,7 @@ def to_mf6_pkg( | |||
top: GridDataArray, | |||
bottom: GridDataArray, | |||
k: GridDataArray, | |||
validate: bool = False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ïs this a mypy fix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is part of the wel fix. I realized that the wel package is written the same was as the hfb package. I therefor written the write method of the wel package in the same way as the hfb package.
Except for the validate method. The wel package had a validate flag that the hfb was missing. By adding it to the hfb package both packages have the same kind of behavior and can be threaten the same
active, top, bottom, k, False, write_context.is_partitioned | ||
) | ||
mf6_pkg.write("packagename", globaltimes, write_context) | ||
mf6_pkg.write("packagename", globaltimes, write_context) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why twice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ow that is a mistake.
Removed it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, some comments.
I see we use a mix of List
as well as list
. I see List
and Dict
are on the list of deprecated aliases since python 3.9, so we can replace them with list
and dict
respectively.
https://docs.python.org/3/library/typing.html#deprecated-aliases
imod/mf6/mf6_wel_adapter.py
Outdated
validate: bool = True, | ||
): | ||
super().__init__() | ||
self.dataset["cellid"] = cellid | ||
self.dataset["rate"] = rate | ||
self.dataset["save_flows"] = save_flows |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, related to this issue I think: #652
# Conflicts: # imod/mf6/buy.py # imod/mf6/dis.py # imod/mf6/mf6_wel_adapter.py # imod/mf6/regridding_utils.py
bbbdf90
to
f9e4f7e
Compare
Replaced List/Dict by list/dict. There are other deprecated types but i consider it out of scope (mainly because it doesn't cause a mypy error with the current settings). |
Fixes #783
This commit fixes all remaining MyPy errors in the mf6 module
The PR is split in several commits, each commit contains a certain file in which the mypy errors are fixes or exist of a type of error that crosses multiple files. I suggest reviewing this PR commit by commit.
Checklist
Issue #nr
, e.g.Issue #737