PyCharm not picking up TypeShed stub definition for method
I'm new to python so have been relying on intellisense fairly heavily to work my way through the new classes and methods but I've come across a scenario where it has fallen. This has led me on a little path of discovery but I can't seem to resolve the issue.
Using the xml.etree.ElementTree API to parse an XML file, I get full intellisense on the ElementTree object after I've used ElementTree.parse()

The issue I'm getting is when I call the object's .getroot() method which should return a class, the resulting object has no intellisense options (as I'm assuming PyCharm can't infer it's type?)

If i use the # type: Element hinting I get the intellisense but I'm looking for a more robust solution and came across mypy and TypeShed. I've installed mypy and now when I inspect the .getroot() method I can see all of the stubs.
The first definition that's returned is the standard package ElementTree.py which has no type definition but all of the stubs do

If I updated the ElementTree.py definition to def getroot(self) -> Element: then I get the full intellisense but is there any way to just use the stubs to do this? It looks like it's defaulting to the built in .py files for the definition?
Sorry if I've misunderstood anything but any help would be appreciated.
Cheers!
请先登录再写评论。
The duplicate of support request in Zendesk.