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
Expose to_<str> as a public function #68965
Conversation
now only 1200+ refs to change ... |
How many collections as well :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there. But a few things are missing
The old version of |
@jborean93 note: samdoran had a pr that did this and also changed imports to use the new location. The import change was performed vian the rope refactoring library. Might want to get that info from him and update the imports when he's back |
if PY3: | ||
to_native = to_text | ||
else: | ||
to_native = to_bytes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please put these first in the file. The callees should be defined before the callers by convention.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just copied what was exactly in the _text.py
, didn't want to really change the contents up. Also does that work without to_text
or to_bytes
being defined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry, what i meant was that the container_to_* functions call to_text/to_bytes so all of these moved functions should be at the top of the file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah no worries, will raise a new PR next week to fix this and the missing imports.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've moved the functions to the top of the file in #69090.
@felixfontein I've added the six imports back in with #69090. |
* Expose to_<str> as a public function * Fix sanity checks * Move docstring to start of util
* Expose to_<str> as a public function * Fix sanity checks * Move docstring to start of util
SUMMARY
These functions are used throughout Ansible and now in different collections and having it behind a "private" import may put people off from using them. The functions haven't changed dramatically recently and I think it's time we expose them properly.
ISSUE TYPE
COMPONENT NAME
module_utils.text.converters