xenopsd
: Fix pytype
warning on get_words
: Name string
is not defined
#5921
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.
For @stephenchengCloud:
FYI: @ashwin9390
In #5896 (review), changes were requested:
Before merging
feature/py3
intomaster
, certain warnings in files that weren't checked so far should be fixed.This PR fixes two of the mentioned
pytype
warnings:These uses of the not defined variable
string
are in an inner function ofVIF.get_locking_mode()
.This inner function (
get_words
) isn't used by the method, see:https://github.com/xapi-project/xen-api/blob/master/ocaml/xenopsd/scripts/common.py#L196
The inner function was never used, it is completely bogus.
Because inner functions cannot be called from outside the containing method, it is 100% safe to remove it:
common.VIF.get_locking_mode().get_words()
to fixpytype
warnings and apply minor clean-ups after adding a test that covers all branches in the method, ensuring that the changes do not change functionality.Two commits are to be added to this PR:`
xenopsd
: Add pytest file forcommon.VIF.get_locking_mode()
ocaml/xenopsd/scripts/common.py
: Fix warnings: remove inner function, useisinstance