Skip to content
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

Added findtext and xpath #47

Closed
wants to merge 9 commits into from
Closed
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion lxml-stubs/html/_element.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ from .._types import (
_AttrName,
_AttrVal,
_ElemPathArg,
_NonDefaultNSMapArg,
_NSMapArg,
_TagName,
_TagSelector,
_XPathExtFuncArg,
_XPathVarArg,
)
from ..cssselect import _CSSTransArg
from ._form import FormElement, LabelElement
Expand Down Expand Up @@ -195,18 +198,33 @@ class HtmlElement(etree.ElementBase):
def find(
self, path: _ElemPathArg, namespaces: _NSMapArg | None = None
) -> HtmlElement | None: ...
def findtext(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [pyright] reported by reviewdog 🐶
Method "findtext" overrides class "_Element" in an incompatible manner
  Parameter "namespaces" is missing in override
  Return type mismatch: base method returns type "str | None", override returns type "str | _T@findtext" (reportIncompatibleMethodOverride)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [mypy] reported by reviewdog 🐶
Signature of "findtext" incompatible with supertype "_Element" [override]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [pyright] reported by reviewdog 🐶
Method "findtext" overrides class "_Element" in an incompatible manner
  Positional parameter count mismatch; base method has 3, but override has 4
  Parameter "namespaces" is missing in override
  Return type mismatch: base method returns type "str | None", override returns type "str | _T@findtext" (reportIncompatibleMethodOverride)

self,
path: _ElemPathArg,
default: _T,
namespaces: _NSMapArg | None = None,
) -> str | _T: ...
def findall(
self, path: _ElemPathArg, namespaces: _NSMapArg | None = None
) -> list[HtmlElement]: ...
def iterfind(
self, path: _ElemPathArg, namespaces: _NSMapArg | None = None
) -> Iterator[HtmlElement]: ...
def xpath(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [mypy] reported by reviewdog 🐶
Signature of "xpath" incompatible with supertype "_Element" [override]

self,
_path: _AnyStr,
*,
namespaces: _NonDefaultNSMapArg | None = None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [mypy] reported by reviewdog 🐶
Name "_NonDefaultNSMapArg" is not defined [name-defined]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [pyright] reported by reviewdog 🐶
Type of parameter "namespaces" is partially unknown
  Parameter type is "Unknown | None" (reportUnknownParameterType)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [pyright] reported by reviewdog 🐶
"_NonDefaultNSMapArg" is not defined (reportUndefinedVariable)

extensions: _XPathExtFuncArg | None = None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [mypy] reported by reviewdog 🐶
Name "_XPathExtFuncArg" is not defined [name-defined]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [pyright] reported by reviewdog 🐶
Type of parameter "extensions" is partially unknown
  Parameter type is "Unknown | None" (reportUnknownParameterType)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [pyright] reported by reviewdog 🐶
"_XPathExtFuncArg" is not defined (reportUndefinedVariable)

smart_strings: bool = True,
**_variables: _XPathVarArg
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [mypy] reported by reviewdog 🐶
Name "_XPathVarArg" is not defined [name-defined]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [pyright] reported by reviewdog 🐶
Type of parameter "_variables" is unknown (reportUnknownParameterType)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [pyright] reported by reviewdog 🐶
"_XPathVarArg" is not defined (reportUndefinedVariable)

) -> list[HtmlElement]: ...
def cssselect(
self,
expr: str,
*,
translator: _CSSTransArg = "xml",
) -> list[HtmlElement]: ...
) -> _XPathObject: ...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [mypy] reported by reviewdog 🐶
Name "_XPathObject" is not defined [name-defined]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [pyright] reported by reviewdog 🐶
"_XPathObject" is not defined (reportUndefinedVariable)


#
# HTML element class attribute
Expand Down
Loading