Skip to content

Commit

Permalink
fixup! Raise warning for unstable URL parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
frenzymadness committed Oct 8, 2024
1 parent 232187c commit 453a9e9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lxml_html_clean/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ from .clean import (
autolink as autolink,
autolink_html as autolink_html,
word_break as word_break,
word_break_html as word_break_html
word_break_html as word_break_html,
LXMLHTMLCleanWarning as LXMLHTMLCleanWarning,
AmbiguousURLWarning as AmbiguousURLWarning,
)
11 changes: 11 additions & 0 deletions lxml_html_clean/clean.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ _DT = TypeVar("_DT", str, bytes, HtmlElement)
_ET_DT = TypeVar("_ET_DT", str, bytes, HtmlElement, _ElementTree[HtmlElement])


def _get_authority_from_url(url: str) -> str | bool: ...


class LXMLHTMLCleanWarning(Warning):
pass


class AmbiguousURLWarning(LXMLHTMLCleanWarning):
pass


class Cleaner:
@overload # allow_tags present, remove_unknown_tags must be False
def __init__(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import warnings

import lxml.html
from lxml_html_clean import AmbiguousURLWarning, Cleaner, clean_html, LXMLHTMLCleanWarning # type:ignore
from lxml_html_clean import AmbiguousURLWarning, Cleaner, clean_html, LXMLHTMLCleanWarning
from .utils import peak_memory_usage


Expand Down

0 comments on commit 453a9e9

Please sign in to comment.