-
Notifications
You must be signed in to change notification settings - Fork 34
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
(feat) Next iteration of all xml-support #929
(feat) Next iteration of all xml-support #929
Conversation
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.
Looks good but can be hard to understand with doc strings and type hints.
Consider adding them for non-trivial code.
See specific questions.
) | ||
orig_text = original.text or "" | ||
gen_text = generated.text or "" | ||
self.assertEqual(orig_text.strip(), gen_text.strip()) |
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.
The intention is for "" to equal None, why?
@@ -64,6 +65,7 @@ def __iter__(self): | |||
|
|||
|
|||
def attrmap(o): | |||
o = dict(_global="global").get(o, o) |
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.
What is the purpose of this?
tag.lower(), *_preproc(c, kw, attrmap=attrmap, valmap=valmap), void_=void_ | ||
) | ||
# NB! fastcore.xml uses tag.lower() for tag names. This is not done here. | ||
return VT(tag, *_preproc(c, kw, attrmap=attrmap, valmap=valmap), void_=void_) |
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.
What does preproc do?
A docstring for preproc would be nice.
@@ -157,6 +164,8 @@ def _to_xml(elm, lvl, indent, do_escape): | |||
|
|||
# Handle void (self-closing) tags | |||
if elm.void_: | |||
if isinstance(elm.void_, str): |
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.
For contxt, void_ is a bool?
Why check for str?
Thanks a lot for the input. Will address in following PR as discussed. |
I confirm that this contribution is made under the terms of the license found in the root directory of this repository's source tree and that I have the authority necessary to make this contribution on behalf of its copyright owner.
Why
For background and context, see #915
What
Added some more meat needed to ensure compatibility with old approach.
Still a good way to go, but getting closer.
Next iteration will have tests of compatibility with old approach, and more tests for new approach.