svg_utils
svg_utils copied to clipboard
"copy()" deepcopys "self.root" not "self", leading to unexpected behaviour not in line with documentation
Like the title says, copying e.g. a svgutils.transform.GroupElement
returns a lxml.etree._Element
, not a new GroupElement
. That means that if you try to copy an Element instead of reading it from disk again, the function does not return a copy of the Element, like the documentation says.
Honestly, I don't understand how this could ever be the desired behavior. This way, if you want to include the same SVG twice on two different spots of the figure, you need to pass the result of copy to the appropriate constructor before you can move it.
So I propose that either the documentation should reflect this, or the behaviour should be changed to be in line with what you would naturally expect.
hi @Quwertzuiopp, thanks for the report! I agree that the expected behaviour would be the copy of svgutils class not the lxml base. Please feel free to submit a PR!
@btel can I take this up (If no one is working on this)?