-
Notifications
You must be signed in to change notification settings - Fork 548
Upgrading mypy #4062
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
base: develop
Are you sure you want to change the base?
Upgrading mypy #4062
Changes from all commits
a9b7cc5
c6eca5b
a03eed9
110ac12
b8427b4
177cf19
1b8fabc
40e6863
cc69062
816f25d
87a6377
a15279c
3bd02ec
41630c3
269a824
37afe57
2b0c016
b3b0a11
0b35982
1799a27
d042e7b
d46fa87
2c7b42d
ac01ca9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -232,7 +232,7 @@ def substitute_string(value: V, substitution_func: Callable[[str], str]) -> V: | |
|
||
model_values[k] = new_value | ||
|
||
return cast(V, type(value).model_validate(model_values)) | ||
return cast(V, type(value).model_validate(model_values)) # type: ignore[redundant-cast] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm assuming we can't get rid of the cast entirely because this doesn't work on all python versions? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not really. If that would be the case, it would lead to an As for your question, I was a bit hesitant to remove the redundant casts. We used to do a few tricks with the way we handled pydantic objects and I thought removing the cast might mess up |
||
elif isinstance(value, Dict): | ||
return cast( | ||
V, {substitute_(k): substitute_(v) for k, v in value.items()} | ||
|
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 was this necessary? This seems like not just a linting adjustment
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.
is_dataclass
returns True ifobj
is a dataclass itself or if it's an instance of a dataclass. However, theasdict
in the next line only accepts instances and mypy raises:Even in python 3.11, providing a type would lead to an error, so I doubt this changes the functionality. WDYT?