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:
close
camera_ctrl_info
to an emptydict
, hence keeping the same type. This approach could also be seen in_reset_flags
L297*_configuration
properties to emptyCameraConfiguration
objects, hence keeping the same type.__init__
*_configuration_
attributes instead of setting the*_configuration
properties which uses the*_configuration_
attributes under the hood without properly initialising them.Refactors done in:
_initialize_camera
True
or raisedRuntimeError
, so using abool
return type doesn't make sense and is non-pythonic. The downstream usage by_open_camera
expects a return value ofFalse
in case of failure, butFalse
is never returned._open_camera
_initialize_camera
returnedTrue
, 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.