Skip to content

Commit 3ddcbd0

Browse files
bs4: Make Tag.attrs more permissive (#11487)
Make `Tag.attrs` more permissive to be in line with actual code `Tag.attrs` is a dict can technically have `list[str]` as a valid value, not just `str`. Making the value type a union with `Any` allows `list[str]` to be valid in a type checker's eyes if a user narrows it. Based on discussion in, and fixes, #8755.
1 parent 1f3cf14 commit 3ddcbd0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

stubs/beautifulsoup4/bs4/element.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ class Tag(PageElement):
234234
sourceline: int | None
235235
sourcepos: int | None
236236
known_xml: bool | None
237-
attrs: dict[str, str]
237+
attrs: dict[str, str | Any]
238238
contents: list[PageElement]
239239
hidden: bool
240240
can_be_empty_element: bool | None

0 commit comments

Comments
 (0)