Skip to content

lxml missing type annotation for XPath #525

Closed
@uglycoyote

Description

@uglycoyote

The following small script

from lxml import etree    
NameXPath = etree.XPath("Name/text()")

gives the error

test.py:3: error: "module" has no attribute "XPath"

which appears to be because the lxml typings are incomplete. I confirmed that this source does not mention XPath

https://github.com/python/typeshed/blob/master/third_party/3/lxml/etree.pyi

but I don't know enough about mypy or the types in lxml to propose a patch myself.

I asked a question about this on Stack Overflow (http://stackoverflow.com/questions/39382937/mypy-spurious-error-module-has-no-attribute-xpath-with-etree#39382937) which brought me here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions