Commit Graph

49 Commits

Author SHA1 Message Date
Thanos
3ddcbd04b8 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.
2024-02-27 21:05:54 -08:00
Sebastian Rittau
b6eaadcfe5 Update typing_extensions imports in third-party stubs (#11245) 2024-01-05 15:40:13 +01:00
Alex Waygood
a08d4c8d2e Remove many redundant inheritances from Generic[] (#10933) 2023-10-26 20:07:20 +02:00
Avasam
22b055a147 Fill in all missing upstream_repository fields (#10571)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-08-13 22:03:33 +01:00
Avasam
db0149859c Add partial_stub metadata field (#10157) 2023-05-10 17:04:18 +02:00
Jelle Zijlstra
4e52cf1b71 bs4: NavigableString accepts ReadableBuffer (#10106)
It delegates to str.__new__.
2023-04-29 15:54:09 +01:00
Nikita Sobolev
3102875bce bs4: update for 4.12.2 (#10026)
Release: https://pypi.org/project/beautifulsoup4/4.12.2/
2023-04-09 15:49:29 +01:00
Shantanu
1c0500a570 bs4: update for 4.12.1 (#10015) 2023-04-06 08:05:21 +01:00
Alex Waygood
b9fedd20ce Add defaults for third-party stubs A-D (#9952) 2023-03-27 16:49:58 +01:00
github-actions[bot]
151159709d [stubsabot] Bump beautifulsoup4 to 4.12.* (#9910)
Release: https://pypi.org/pypi/beautifulsoup4/4.12.0
Homepage: https://www.crummy.com/software/BeautifulSoup/bs4/
2023-03-21 00:26:02 +00:00
Avasam
ed6748fb32 Stubtest settings: change ignore_missing_stub default to false (#9779)
If you're reading about this commit from an autogenerated changelog entry, this should have no user-visible impact on how the stubs are interpreted by a type checker; it's just an internal change to how typeshed's tests work.
2023-02-20 22:37:45 +00:00
Alex Waygood
7180d0223b Use typing_extensions.Self instead of _typeshed.Self (#9702) 2023-02-15 11:32:43 +01:00
Alex Waygood
23e3dc9bd8 Fix stubtest errors on beautifulsoup4 (#9648)
Fixes #9645.
2023-02-01 06:06:45 -08:00
Avasam
6ac24ed923 Replace Any with Incomplete in many places (#9565) 2023-01-18 19:12:46 +00:00
Alex Waygood
4fea314594 Replace Any with Incomplete in many places (#9558) 2023-01-18 08:48:16 +00:00
Avasam
3b94e71280 Add types-html5lib as a dependency of types-beautifulsoup4 (#9462)
Remove the need for subclassing `Any`
2023-01-05 10:40:17 +00:00
Nikita Sobolev
62a6c3d616 Annotate known magic-method return types (#9131) 2022-11-08 18:28:42 +00:00
James Hilton-Balfe
189d1116d1 [bs4] More precise types for bs4.Tag.select(_one) (#8687)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-09-05 15:16:33 -07:00
Kevin Kirsche
8c51fab4e2 Support extras in stubtest_third_party.py (#8467) 2022-08-18 14:12:36 -07:00
Jelle Zijlstra
b418c1c3ba beautifulsoup4: Fix type of Tag.__iter__ (#8357) 2022-07-21 21:32:15 +02:00
Alex Waygood
6348a58b8b Import Match and Pattern from re, not typing (#8277) 2022-07-12 15:32:48 +02:00
Alex Waygood
a2ef47660a Fix TypeVars in beautifulsoup and SQLAlchemy (#8087) 2022-06-16 17:34:27 +02:00
Shantanu
550454c9aa beautifulsoup4: small fixes and updates (#7816) 2022-05-10 09:17:40 +02:00
Shantanu
e8b361983f bs4: update to 4.11 (#7785)
Co-authored-by: hauntsaninja <>
2022-05-06 11:54:50 -07:00
Alex Waygood
653f2c6ba4 Third-party stubs: import from collections.abc where possible (#7637) 2022-04-16 14:52:57 +01:00
Alex Waygood
740193a8fc Use TypeAlias where possible for type aliases (#7630) 2022-04-15 18:01:00 -07:00
Alex Waygood
1ceb486b75 Replace Union with union operator (#7596) 2022-04-05 23:07:31 +02:00
Alex Waygood
85aec034ae Mark many attributes as read-only properties (#7591) 2022-04-05 08:37:24 +02:00
Alex Waygood
340c6c97ed Add mypy error codes to type: ignores, remove unused ignores (#7504)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-03-19 13:10:00 +00:00
Alex Waygood
3ab250eec8 Use PEP 604 syntax wherever possible (#7493) 2022-03-16 16:01:33 +01:00
Shantanu
a5ec3c69b2 bs4: expose several other classes (#7420)
On the same lines as #7419

These are all imports that are not used within bs4/__init__.py
My main interest here is in exposing NavigableString

Co-authored-by: hauntsaninja <>
2022-03-01 17:59:11 -08:00
Shantanu
2f27eaab44 bs4: expose bs4.PageElement (#7419)
This is generally useful. It's also imported in the source without being
used in bs4/__init__.py which in well maintained packages is a pretty
good marker of intention to export

Co-authored-by: hauntsaninja <>
2022-03-01 16:59:50 -08:00
J Rob Gant
99aedf4724 Tag.attrs is a dict, instead of an immutable Mapping (#7253) 2022-02-18 00:46:49 +02:00
Jelle Zijlstra
3d28f0981f bs4: Expose bs4.SoupStrainer and bs4.Tag (#7002) 2022-01-23 19:11:38 +02:00
Alex Waygood
a40d79a4e6 Use lowercase type everywhere (#6853) 2022-01-08 16:09:29 +01:00
Sebastian Rittau
e77a66aced Update pyright (#6840) 2022-01-07 18:58:15 +02:00
Alex Waygood
8d5d2520ac Use PEP 585 syntax wherever possible (#6717) 2021-12-28 11:31:43 +01:00
Sebastian Rittau
9bf2ceb963 Fix third-party issues found by stubtest (#6667) 2021-12-22 15:09:44 -08:00
Alex Waygood
c685c2d6c6 Reduce use of deprecated typing aliases (#6358) 2021-11-23 10:56:43 +01:00
Akuli
e72a4034bf Cleanup: use lower-case list and dict, add a test (#6161) 2021-10-13 22:59:27 +03:00
cmckain
71f2e4ab0a Put Generic last in base class list (#6155) 2021-10-12 17:58:19 +02:00
Sebastian Rittau
9f86972350 Add star to all non-0.1 versions (#6146) 2021-10-11 13:41:19 -07:00
cmckain
57c26d5b2c PageElement.find_all() can return any subclass of PageElement (#6081) 2021-09-27 09:54:40 +02:00
Hackrrr
2237daa650 Update for beautifulsoup4 for version 4.10 (#6059)
Tighten types and add missing fields
2021-09-22 17:42:42 +02:00
Hackrrr
3ce5502675 Added str type to modifying methods on PageElement (#5929)
Co-authored-by: Hackrrr <Hackrrr@users.noreply.github.com>
2021-08-15 08:15:34 -07:00
Anders Kaseorg
96358fd944 beautifulsoup4 stub improvements (#5907) 2021-08-10 20:04:48 -07:00
Akuli
ce11072dbe Big diff: use lower-case list and dict (#5888) 2021-08-08 09:26:35 -07:00
Ethan Corey
69c56b9496 Fix for _SimpleStrainable type def (#5810)
Modified definitions of _SimpleStrainable and _SimpleNormalizedStrainable to include Callable[[Tag], bool] (see https://www.crummy.com/software/BeautifulSoup/bs4/doc/#a-function)
2021-07-26 20:08:43 -07:00
Jelle Zijlstra
7f320c6b9e Stubs for beautifulsoup4 (#5758)
Stubgen and manual fixes, don't bother with Python 2
2021-07-11 17:02:51 +03:00