-
Notifications
You must be signed in to change notification settings - Fork 0
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
Fix mypy warnings #221
Comments
I found some classes initializing some of their attributes after Class BackgroundListenerThread
Class QueryHandlerRunnerUDF
SQLStageGraphExecutionQueryHandlerState
Class Communicator has some attributes that potentially could be
SQLStageGraphExecutionInput still imports and uses as attribute type-hint
call_udf.py contains
Class |
Regarding BackgroundListenerThread They can only be initialized with a proper value in the run method, because the object gets transferred from one process to another process after the construction and only in the process then run is called. Furthermore, I think there are more attributes for which the same is true , e g. self._in_control_socket, have a look at the create* methods that get called in run. After the calls to the create methods in run they shouldn't be None anymore, before they could be None, I think. However, you might need to assert that they are not anymore before they get used otherwise, mypy might complain that they could be None. @tomuben had to do this in the itde. |
I think UDFParameter.temporary_schema_name can be None, because we don't validate the json in Lua regarding this and we probably don't need to. However, should be maybe checked , what we get if the json has no schema specified. However, the more I think, about it , also if it could be None , we need a value for it and that means either a default or an error. And, I think, tend to error here, that also should solve the complaint |
Regarding QueryHandlerRunnerState.input_query_query_handler_context check with exception in self._wrap_return_query() that it is not None, that solve the complaint |
Other findings during review |
Regarding UDFParameter temporary_schema_name, python_class_name, python_class_module are not optional, we need to check if the values we get from the ctx are None and if yes throw an error message.
|
SQLStageGraphExecutionQueryHandlerState
|
Same for advanced-analytics-framework/exasol/analytics/udf/communication/broadcast_operation.py Line 24 in fcbf1bf
|
Only two type check findings remaining: Class BackgroundListenerInterface
The return value of this method potentially is used in many places.
A potential minimal-invasive patch could be to return a constant
I found two alternative initializations of self._parameter |
The current unit tests for the classes in exasol.analytics.schema verify I see the following options
|
I fixed most of the findings in initial review batch
|
Waiting until reviewer @tkilias is available. |
* Fixed mypy warnings * Formatted code * Made register_peer_connection optional in RegisterPeerForwarder, RegisterPeerForwarderBuilderParameter, RegisterPeerForwarderFactory * replaced comment to ignore import-untyped by entry in pyproject.toml * Prefixed properties with "_checked_" * Updated pandas to version 2.2.3 Co-authored-by: Thomas Ubensee <34603111+tomuben@users.noreply.github.com>
https://blog.whtsky.me/tech/2021/dont-forget-py.typed-for-your-typed-python-package/
https://mypy.readthedocs.io/en/stable/running_mypy.html
The text was updated successfully, but these errors were encountered: