Skip to content

Commit 3bc3f7a

Browse files
authored
Add stub for html._replace_charref from standard library
`_replace_charref` is defined here: https://github.com/python/cpython/blob/64fab74bd7288bfa67cd7727452febdaafed4270/Lib/html/__init__.py#L91-L115 Although it’s a private attribute we have a use case for importing it: We re-implement `html.unescape` using our own definition of `_charref`, but we don’t want to reimpliment `_replace_charref`. Example can be found [in our codebase](https://github.com/alphagov/notifications-utils/blob/1eccc101a96cf120ce7bdc71528222ebc694432b/notifications_utils/formatters.py#L161-L167).
1 parent 63c876f commit 3bc3f7a

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

stdlib/html/__init__.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
import re
2+
13
__all__ = ["escape", "unescape"]
24

35
def escape(s: str, quote: bool = True) -> str: ...
46
def unescape(s: str) -> str: ...
7+
def _replace_charref(s: re.Match[str]) -> str: ...

0 commit comments

Comments
 (0)