This library does a great job of typing the results from lxml functions. I can see, for example, that the XML parse method returns a type _ElementTree[_Element]. However, I cannot see a way to use these types in my own code. For example, I'd like to write a method which takes an ElementTree as an argument:
def my_func(element: _ElementTree[_Element]):
pass
but I can't work out how to import these types. I tried:
from types_lxml import _ElementTree, _Element
but this didn't work. So:
- Is there a way to import these types to use in our own code?
- Could this be documented somewhere in the readme?
Thanks!
This library does a great job of typing the results from
lxmlfunctions. I can see, for example, that the XMLparsemethod returns a type_ElementTree[_Element]. However, I cannot see a way to use these types in my own code. For example, I'd like to write a method which takes an ElementTree as an argument:but I can't work out how to import these types. I tried:
but this didn't work. So:
Thanks!