From af8c3a1b93422b4729ca247aa41cc7c4cf0dbfd2 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Wed, 4 Oct 2023 18:19:26 +0200 Subject: [PATCH] [bleach] Add html5lib_shim.Filter__init__/__iter__ (#10835) The missing __init__ method caused `Filter` to be incompatible with the `_Filter` protocol, preventing valid initialization of `Cleaner` instances. Closes: #10834 --- stubs/bleach/bleach/html5lib_shim.pyi | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/stubs/bleach/bleach/html5lib_shim.pyi b/stubs/bleach/bleach/html5lib_shim.pyi index ee35bc62dba2..dbcde6f14a00 100644 --- a/stubs/bleach/bleach/html5lib_shim.pyi +++ b/stubs/bleach/bleach/html5lib_shim.pyi @@ -1,11 +1,14 @@ from _typeshed import Incomplete -from collections.abc import Generator, Iterable +from collections.abc import Generator, Iterable, Iterator class HTMLParser: # actually html5lib.HTMLParser def __getattr__(self, __name: str) -> Incomplete: ... class Filter: # actually html5lib.filters.base.Filter - def __getattr__(self, __name: str) -> Incomplete: ... + source: Incomplete + def __init__(self, source) -> None: ... + def __iter__(self) -> Iterator[Incomplete]: ... + def __getattr__(self, name: str) -> Incomplete: ... # copy attributes from source class SanitizerFilter: # actually html5lib.filters.sanitizer.Filter def __getattr__(self, __name: str) -> Incomplete: ...