Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds mypy checks to scripts/lint.sh
Runs mypy over
ossdbtoolsservice
andtests_v2
directories, except forossdbtoolsservice.language.completion
module. That module proved very hard to type without breaking the code, so it's left untyped for now. Other modules likesmo
andpgsmo
are left untyped, as well astests
.Generally, the goal here was to leave functionality unchanged. However in order to fix types I did need to refactor a number of things. However this should be transparent to the consumer, except that error messages in cases where required values are not sent should be more clear.
One functionality change made was that the SaveAsJsonWriter was serializing all values as strings; I modified to check if it's a serializable type and if so serialize the direct value.
Another strategy was to de-abstract the project away from supporting multiple open source DBs when convenient. There is no actual implementation for other DBs, and this is a PG specific project; the concept of different provider types in the codebase is simply a maintenance burden.
A lot of changes were due to the way the message models were created, with
Serializable
objects needing a parameterless__init__
. This required a lot of validation around if properties were None throughout the handler code. Going forward we should only usepydantic.BaseModel
models to ensure validation happens up front and we can write code against the intended property types. Pydantic model support is already implemented in the MessageServer.There's a lot of
# noqa
comments around the codebase without a good reason to no QA; this PR removes a lot of them and we should keep deleting those whenever we see them without justification.