Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complete stubs for bleach #9314

Merged
merged 28 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4375fb5
Mark `bleach` as complete
sobolevn Dec 1, 2022
49d8286
Fix CI
sobolevn Dec 1, 2022
b924759
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 1, 2022
146a810
Merge branch 'main' into mark-bleach
AlexWaygood Feb 19, 2023
18e31e5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 19, 2023
24e2ad3
Fix some obvious merge issues
AlexWaygood Feb 19, 2023
1b526fe
fix more mistakes when merging `main`
AlexWaygood Feb 19, 2023
198f6a6
Update linkifier.pyi
AlexWaygood Feb 19, 2023
22fd76e
Remove unused allowlist entries
AlexWaygood Feb 19, 2023
dc39112
Merge branch 'main' into mark-bleach
AlexWaygood Feb 21, 2023
3245722
Merge branch 'main' into mark-bleach
AlexWaygood Jul 22, 2023
c4767d5
Update stubs/bleach/METADATA.toml
AlexWaygood Jul 22, 2023
704cb27
Update stubs/bleach/bleach/html5lib_shim.pyi
AlexWaygood Jul 22, 2023
5950664
fix mypy
AlexWaygood Jul 22, 2023
c723045
Merge branch 'main' into mark-bleach
Avasam Nov 30, 2023
c9faed8
Post-merge remove bleach from pyrightconfig.stricter.json
Avasam Nov 30, 2023
7b72eef
Merge branch 'main' into mark-bleach
AlexWaygood Feb 5, 2024
96fc2c4
Merge branch 'main' of https://github.com/python/typeshed into mark-b…
Avasam Feb 20, 2024
c79dca1
Ran stubdefaulter
Avasam Feb 20, 2024
7723b65
Complete missing types
Avasam Feb 20, 2024
ea95d05
Address PR comments
Avasam Feb 20, 2024
a4ee82c
More PR comments
Avasam Feb 20, 2024
5a39614
Mark uppercase names as Final
Avasam Feb 20, 2024
3f865d3
Reduce allowlist entried and indicate possible runtime failure
Avasam Feb 21, 2024
5f48c83
typo
Avasam Feb 21, 2024
9c88154
Update stubs/html5lib/html5lib/_inputstream.pyi
Avasam Feb 21, 2024
e318888
Update stubs/bleach/bleach/html5lib_shim.pyi
Avasam Feb 21, 2024
c4aeaa5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions stubs/bleach/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Internal private stuff:
bleach._vendor.*

# Hacks:
# Is a property returning a method, simplified:
bleach.html5lib_shim.InputStreamWithMemory.changeEncoding
bleach.html5lib_shim.InputStreamWithMemory.reset
7 changes: 4 additions & 3 deletions stubs/bleach/bleach/html5lib_shim.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ from typing import Any, Final, Protocol
# really public and may change at any time. This is just a helper module,
# import things directly from `html5lib` instead!
from html5lib import HTMLParser
from html5lib._inputstream import HTMLUnicodeInputStream
from html5lib._inputstream import HTMLBinaryInputStream, HTMLUnicodeInputStream
from html5lib._tokenizer import HTMLTokenizer
from html5lib._trie import Trie
from html5lib.serializer import HTMLSerializer
Expand All @@ -32,14 +32,15 @@ TAG_TOKEN_TYPE_START: Final[int]

class InputStreamWithMemory:
position = HTMLUnicodeInputStream.position
reset = HTMLUnicodeInputStream.reset
def __init__(self, inner_stream: HTMLUnicodeInputStream) -> None: ...
def reset(self) -> None: ...
@property
def errors(self) -> list[str]: ...
@property
def charEncoding(self) -> tuple[_Encoding, str]: ...
# Also if inner_stream wasn't a HTMLBinaryInputStream, this will error at runtime
# Is a property returning a method, simplified:
def changeEncoding(self, newEncoding: str) -> None: ...
changeEncoding = HTMLBinaryInputStream.changeEncoding
def char(self) -> str: ...
def charsUntil(self, characters: Collection[str], opposite: bool = False) -> str: ...
Avasam marked this conversation as resolved.
Show resolved Hide resolved
def unget(self, char: str | None) -> None: ...
Expand Down
2 changes: 1 addition & 1 deletion stubs/html5lib/html5lib/_inputstream.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class HTMLBinaryInputStream(HTMLUnicodeInputStream):
def reset(self) -> None: ...
def openStream(self, source): ...
def determineEncoding(self, chardet: bool = True): ...
def changeEncoding(self, newEncoding) -> None: ...
def changeEncoding(self, newEncoding: str) -> None: ...
Avasam marked this conversation as resolved.
Show resolved Hide resolved
def detectBOM(self): ...
def detectEncodingMeta(self): ...

Expand Down
Loading