Skip to content

Commit 4a053b9

Browse files
authored
Hint base_url and base_href as Optional (GH-107)
Thanks. Note that this package is superseded by https://github.com/abelcheung/types-lxml
1 parent 3fcf5d3 commit 4a053b9

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

lxml-stubs/etree.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -524,21 +524,21 @@ def cleanup_namespaces(
524524
def parse(
525525
source: _FileSource,
526526
parser: Optional[_AnyParser] = ...,
527-
base_url: _AnyStr = ...,
527+
base_url: Optional[_AnyStr] = ...,
528528
) -> Union[_ElementTree, Any]: ...
529529
@overload
530530
def fromstring(
531531
text: _AnyStr,
532532
parser: None = ...,
533533
*,
534-
base_url: _AnyStr = ...,
534+
base_url: Optional[_AnyStr] = ...,
535535
) -> _Element: ...
536536
@overload
537537
def fromstring(
538538
text: _AnyStr,
539539
parser: _AnyParser = ...,
540540
*,
541-
base_url: _AnyStr = ...,
541+
base_url: Optional[_AnyStr] = ...,
542542
) -> Union[_Element, Any]: ...
543543
@overload
544544
def tostring(

lxml-stubs/html/__init__.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class HtmlMixin:
4949
def cssselect(self, expr: str, translator: str = ...) -> List["_Element"]: ...
5050
def make_links_absolute(
5151
self,
52-
base_url: str = ...,
52+
base_url: Optional[str] = ...,
5353
resolve_base_href: bool = ...,
5454
handle_failures: _HANDLE_FALURES = ...,
5555
) -> str: ...
@@ -59,7 +59,7 @@ class HtmlMixin:
5959
self,
6060
link_repl_func: Callable[[str], Optional[str]],
6161
resolve_base_href: bool = ...,
62-
base_href: str = ...,
62+
base_href: Optional[str] = ...,
6363
) -> None: ...
6464
def __getattr__(self, name: str) -> Any: ... # incomplete
6565

@@ -75,11 +75,11 @@ def document_fromstring(
7575
def fragments_fromstring(
7676
html: "_AnyStr",
7777
no_leading_text: bool = ...,
78-
base_url: str = ...,
78+
base_url: Optional[str] = ...,
7979
parser: "_BaseParser" = ...,
8080
**kw
8181
) -> "_Element": ...
8282
def fromstring(
83-
html: "_AnyStr", base_url: str = ..., parser: "_BaseParser" = ..., **kw
83+
html: "_AnyStr", base_url: Optional[str] = ..., parser: "_BaseParser" = ..., **kw
8484
) -> "_Element": ...
8585
def __getattr__(name: str) -> Any: ... # incomplete

lxml-stubs/objectify.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Union
1+
from typing import Any, Optional, Union
22

33
from lxml.etree import ElementBase, XMLParser
44

@@ -12,5 +12,5 @@ def fromstring(
1212
text: Union[bytes, str],
1313
parser: XMLParser = ...,
1414
*,
15-
base_url: Union[bytes, str] = ...
15+
base_url: Optional[Union[bytes, str]] = ...
1616
) -> ObjectifiedElement: ...

0 commit comments

Comments
 (0)