Resolve various type errors and do some pythonic refactoring of the codebase #1179
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.
Partly inspired by the edit of #1177 (Comment)
Type errors resolved in:
closecamera_ctrl_infoto an emptydict, hence keeping the same type. This approach could also be seen in_reset_flagsL297*_configurationproperties to emptyCameraConfigurationobjects, hence keeping the same type.__init__*_configuration_attributes instead of setting the*_configurationproperties which uses the*_configuration_attributes under the hood without properly initialising them.Refactors done in:
_initialize_cameraTrueor raisedRuntimeError, so using aboolreturn type doesn't make sense and is non-pythonic. The downstream usage by_open_cameraexpects a return value ofFalsein case of failure, butFalseis never returned._open_camera_initialize_camerareturnedTrue, the if block was skipped. In the failure case of_initialize_camera, the error was propagated, the if block never got the chance to execute.