Skip to content

Hint base_url and base_href as Optional #107

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
6 changes: 3 additions & 3 deletions lxml-stubs/etree.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -524,21 +524,21 @@ def cleanup_namespaces(
def parse(
source: _FileSource,
parser: Optional[_AnyParser] = ...,
base_url: _AnyStr = ...,
base_url: Optional[_AnyStr] = ...,
) -> Union[_ElementTree, Any]: ...
@overload
def fromstring(
text: _AnyStr,
parser: None = ...,
*,
base_url: _AnyStr = ...,
base_url: Optional[_AnyStr] = ...,
) -> _Element: ...
@overload
def fromstring(
text: _AnyStr,
parser: _AnyParser = ...,
*,
base_url: _AnyStr = ...,
base_url: Optional[_AnyStr] = ...,
) -> Union[_Element, Any]: ...
@overload
def tostring(
Expand Down
8 changes: 4 additions & 4 deletions lxml-stubs/html/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class HtmlMixin:
def cssselect(self, expr: str, translator: str = ...) -> List["_Element"]: ...
def make_links_absolute(
self,
base_url: str = ...,
base_url: Optional[str] = ...,
resolve_base_href: bool = ...,
handle_failures: _HANDLE_FALURES = ...,
) -> str: ...
Expand All @@ -59,7 +59,7 @@ class HtmlMixin:
self,
link_repl_func: Callable[[str], Optional[str]],
resolve_base_href: bool = ...,
base_href: str = ...,
base_href: Optional[str] = ...,
) -> None: ...
def __getattr__(self, name: str) -> Any: ... # incomplete

Expand All @@ -75,11 +75,11 @@ def document_fromstring(
def fragments_fromstring(
html: "_AnyStr",
no_leading_text: bool = ...,
base_url: str = ...,
base_url: Optional[str] = ...,
parser: "_BaseParser" = ...,
**kw
) -> "_Element": ...
def fromstring(
html: "_AnyStr", base_url: str = ..., parser: "_BaseParser" = ..., **kw
html: "_AnyStr", base_url: Optional[str] = ..., parser: "_BaseParser" = ..., **kw
) -> "_Element": ...
def __getattr__(name: str) -> Any: ... # incomplete
4 changes: 2 additions & 2 deletions lxml-stubs/objectify.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Union
from typing import Any, Optional, Union

from lxml.etree import ElementBase, XMLParser

Expand All @@ -12,5 +12,5 @@ def fromstring(
text: Union[bytes, str],
parser: XMLParser = ...,
*,
base_url: Union[bytes, str] = ...
base_url: Optional[Union[bytes, str]] = ...
) -> ObjectifiedElement: ...