[_sonic_yang_ext.py]: Using python mixin to extend sonic_yang class i… #65
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.
…nto 2 files and resolving Other LGTM issues.
Changes:
1.) Moved al functions of _sonic_yang_ext.py file in sonic_yang_ext_mixin class.
2.) Use this class in sonic_yang to extend funtionality.
3.) Solve Other LGTM issues from
https://lgtm.com/projects/g/Azure/sonic-buildimage/rev/pr-0f82616403c02577e1155347eb5b693a51c76a9e
Note: Code shows big diff due to TAB, otherwise I am just moving all functions inside a class which does not have init.
Note: Python mixin are different from parent class since it can access all variables
of the class which is using it.
Signed-off-by: Praveen Chaudhary pchaudhary@linkedin.com
- What I did
Using Python Mixine to extend the capability of sonic Yang class.
This is done to avoid below error. This was a warning in PY2 but in PY3, it is treated as high level error. So to convert the package into a PY3 in future, we need to resolve this problem sooner or later.
due to below line:
Other minor LGTM issues.
- How I did it
PY mixin is a way, which looks similar to inheritance, but the class which seems like a parent class can access all the variable of child class. So PY mixin in actually extend the functionality of another class. Also it is the recommended way to write a single class into multiple files.
- How to verify it
Mixin testing:
UnInstall previous package and install new package:
Check that files are updated and has new code:
Running Breakout
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)