Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-MarkupSafe for openSUSE:Factory checked in at 2023-06-21 22:36:58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-MarkupSafe (Old) and /work/SRC/openSUSE:Factory/.python-MarkupSafe.new.15902 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-MarkupSafe" Wed Jun 21 22:36:58 2023 rev:28 rq:1093827 version:2.1.3 Changes: -------- --- /work/SRC/openSUSE:Factory/python-MarkupSafe/python-MarkupSafe.changes 2023-04-22 22:03:29.166301810 +0200 +++ /work/SRC/openSUSE:Factory/.python-MarkupSafe.new.15902/python-MarkupSafe.changes 2023-06-21 22:37:08.937392540 +0200 @@ -1,0 +2,9 @@ +Mon Jun 19 20:10:45 UTC 2023 - Dirk Müller <dmuel...@suse.com> + +- update to 2.1.3: + * Implement ``format_map``, ``casefold``, ``removeprefix``, + and ``removesuffix`` methods. + * Fix static typing for basic ``str`` methods on ``Markup``. + * Use ``Self`` for annotating return types. :pr:`379` + +------------------------------------------------------------------- Old: ---- MarkupSafe-2.1.2.tar.gz New: ---- MarkupSafe-2.1.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-MarkupSafe.spec ++++++ --- /var/tmp/diff_new_pack.wBp71c/_old 2023-06-21 22:37:09.641396777 +0200 +++ /var/tmp/diff_new_pack.wBp71c/_new 2023-06-21 22:37:09.645396801 +0200 @@ -16,13 +16,10 @@ # -%define oldpython python -%define skip_python2 1 -%{?!python_module:%define python_module() python-%{**} python3-%{**}} %bcond_without test %{?sle15_python_module_pythons} Name: python-MarkupSafe -Version: 2.1.2 +Version: 2.1.3 Release: 0 Summary: Implements a XML/HTML/XHTML Markup safe string for Python License: BSD-3-Clause @@ -30,17 +27,14 @@ URL: https://github.com/pallets/markupsafe Source: https://files.pythonhosted.org/packages/source/M/MarkupSafe/MarkupSafe-%{version}.tar.gz BuildRequires: %{python_module devel} -BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module pip} +BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-base >= 3.6 %if %{with test} BuildRequires: %{python_module pytest} %endif -%ifpython2 -Provides: %{oldpython}-markupsafe = %{version} -Obsoletes: %{oldpython}-markupsafe < %{version} -%endif %python_subpackages %description @@ -52,10 +46,10 @@ %build export CFLAGS="%{optflags}" -%python_build +%pyproject_wheel %install -%python_install +%pyproject_install %python_expand %fdupes %{buildroot}%{$python_sitearch} %python_expand rm %{buildroot}%{$python_sitearch}/markupsafe/_speedups.c # Upstream changed the Python package metadata to require Python 3.7, but the tests pass on Python 3.6. @@ -72,6 +66,6 @@ %license LICENSE.rst %doc README.rst docs/ %{python_sitearch}/markupsafe/ -%{python_sitearch}/MarkupSafe-%{version}-py*.egg-info +%{python_sitearch}/MarkupSafe-%{version}.dist-info %changelog ++++++ MarkupSafe-2.1.2.tar.gz -> MarkupSafe-2.1.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MarkupSafe-2.1.2/CHANGES.rst new/MarkupSafe-2.1.3/CHANGES.rst --- old/MarkupSafe-2.1.2/CHANGES.rst 2023-01-17 18:51:51.000000000 +0100 +++ new/MarkupSafe-2.1.3/CHANGES.rst 2023-06-02 23:13:16.000000000 +0200 @@ -1,3 +1,14 @@ +Version 2.1.3 +------------- + +Released 2023-06-02 + +- Implement ``format_map``, ``casefold``, ``removeprefix``, and ``removesuffix`` + methods. :issue:`370` +- Fix static typing for basic ``str`` methods on ``Markup``. :issue:`358` +- Use ``Self`` for annotating return types. :pr:`379` + + Version 2.1.2 ------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MarkupSafe-2.1.2/PKG-INFO new/MarkupSafe-2.1.3/PKG-INFO --- old/MarkupSafe-2.1.2/PKG-INFO 2023-01-17 18:52:09.244761500 +0100 +++ new/MarkupSafe-2.1.3/PKG-INFO 2023-06-02 23:13:25.750226700 +0200 @@ -1,10 +1,8 @@ Metadata-Version: 2.1 Name: MarkupSafe -Version: 2.1.2 +Version: 2.1.3 Summary: Safely add untrusted strings to HTML/XML markup. Home-page: https://palletsprojects.com/p/markupsafe/ -Author: Armin Ronacher -Author-email: armin.ronac...@active-4.com Maintainer: Pallets Maintainer-email: cont...@palletsprojects.com License: BSD-3-Clause @@ -13,7 +11,6 @@ Project-URL: Changes, https://markupsafe.palletsprojects.com/changes/ Project-URL: Source Code, https://github.com/pallets/markupsafe/ Project-URL: Issue Tracker, https://github.com/pallets/markupsafe/issues/ -Project-URL: Twitter, https://twitter.com/PalletsTeam Project-URL: Chat, https://discord.gg/pallets Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: Web Environment @@ -93,6 +90,4 @@ - PyPI Releases: https://pypi.org/project/MarkupSafe/ - Source Code: https://github.com/pallets/markupsafe/ - Issue Tracker: https://github.com/pallets/markupsafe/issues/ -- Website: https://palletsprojects.com/p/markupsafe/ -- Twitter: https://twitter.com/PalletsTeam - Chat: https://discord.gg/pallets diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MarkupSafe-2.1.2/README.rst new/MarkupSafe-2.1.3/README.rst --- old/MarkupSafe-2.1.2/README.rst 2023-01-17 18:51:51.000000000 +0100 +++ new/MarkupSafe-2.1.3/README.rst 2023-06-02 23:13:16.000000000 +0200 @@ -64,6 +64,4 @@ - PyPI Releases: https://pypi.org/project/MarkupSafe/ - Source Code: https://github.com/pallets/markupsafe/ - Issue Tracker: https://github.com/pallets/markupsafe/issues/ -- Website: https://palletsprojects.com/p/markupsafe/ -- Twitter: https://twitter.com/PalletsTeam - Chat: https://discord.gg/pallets diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MarkupSafe-2.1.2/docs/conf.py new/MarkupSafe-2.1.3/docs/conf.py --- old/MarkupSafe-2.1.2/docs/conf.py 2023-01-17 18:51:51.000000000 +0100 +++ new/MarkupSafe-2.1.3/docs/conf.py 2023-06-02 23:13:16.000000000 +0200 @@ -32,8 +32,6 @@ ProjectLink("PyPI Releases", "https://pypi.org/project/MarkupSafe/"), ProjectLink("Source Code", "https://github.com/pallets/markupsafe/"), ProjectLink("Issue Tracker", "https://github.com/pallets/markupsafe/issues/"), - ProjectLink("Website", "https://palletsprojects.com/p/markupsafe/"), - ProjectLink("Twitter", "https://twitter.com/PalletsTeam"), ProjectLink("Chat", "https://discord.gg/pallets"), ] } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MarkupSafe-2.1.2/requirements/build.txt new/MarkupSafe-2.1.3/requirements/build.txt --- old/MarkupSafe-2.1.2/requirements/build.txt 2023-01-17 18:51:51.000000000 +0100 +++ new/MarkupSafe-2.1.3/requirements/build.txt 2023-06-02 23:13:16.000000000 +0200 @@ -5,13 +5,9 @@ # # pip-compile-multi # -build==0.9.0 +build==0.10.0 # via -r requirements/build.in -packaging==23.0 +packaging==23.1 # via build -pep517==0.13.0 +pyproject-hooks==1.0.0 # via build -tomli==2.0.1 - # via - # build - # pep517 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MarkupSafe-2.1.2/requirements/dev.txt new/MarkupSafe-2.1.3/requirements/dev.txt --- old/MarkupSafe-2.1.2/requirements/dev.txt 2023-01-17 18:51:51.000000000 +0100 +++ new/MarkupSafe-2.1.3/requirements/dev.txt 2023-06-02 23:13:16.000000000 +0200 @@ -8,9 +8,9 @@ -r docs.txt -r tests.txt -r typing.txt -build==0.9.0 +build==0.10.0 # via pip-tools -cachetools==5.2.0 +cachetools==5.3.1 # via tox cfgv==3.3.1 # via pre-commit @@ -24,39 +24,39 @@ # via tox distlib==0.3.6 # via virtualenv -filelock==3.9.0 +filelock==3.12.0 # via # tox # virtualenv -identify==2.5.11 +identify==2.5.24 # via pre-commit -nodeenv==1.7.0 +nodeenv==1.8.0 # via pre-commit -pep517==0.13.0 - # via build -pip-compile-multi==2.6.1 +pip-compile-multi==2.6.3 # via -r requirements/dev.in -pip-tools==6.12.1 +pip-tools==6.13.0 # via pip-compile-multi -platformdirs==2.6.2 +platformdirs==3.5.1 # via # tox # virtualenv -pre-commit==2.21.0 +pre-commit==3.3.2 # via -r requirements/dev.in -pyproject-api==1.2.1 +pyproject-api==1.5.1 # via tox +pyproject-hooks==1.0.0 + # via build pyyaml==6.0 # via pre-commit -toposort==1.7 +toposort==1.10 # via pip-compile-multi -tox==4.1.0 +tox==4.5.2 # via -r requirements/dev.in -virtualenv==20.17.1 +virtualenv==20.23.0 # via # pre-commit # tox -wheel==0.38.4 +wheel==0.40.0 # via pip-tools # The following packages are considered to be unsafe in a requirements file: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MarkupSafe-2.1.2/requirements/docs.txt new/MarkupSafe-2.1.3/requirements/docs.txt --- old/MarkupSafe-2.1.2/requirements/docs.txt 2023-01-17 18:51:51.000000000 +0100 +++ new/MarkupSafe-2.1.3/requirements/docs.txt 2023-06-02 23:13:16.000000000 +0200 @@ -5,15 +5,15 @@ # # pip-compile-multi # -alabaster==0.7.12 +alabaster==0.7.13 # via sphinx -babel==2.11.0 +babel==2.12.1 # via sphinx -certifi==2022.12.7 +certifi==2023.5.7 # via requests -charset-normalizer==2.1.1 +charset-normalizer==3.1.0 # via requests -docutils==0.19 +docutils==0.20.1 # via sphinx idna==3.4 # via requests @@ -21,23 +21,21 @@ # via sphinx jinja2==3.1.2 # via sphinx -markupsafe==2.1.1 +markupsafe==2.1.2 # via jinja2 -packaging==22.0 +packaging==23.1 # via # pallets-sphinx-themes # sphinx -pallets-sphinx-themes==2.0.3 +pallets-sphinx-themes==2.1.0 # via -r requirements/docs.in -pygments==2.13.0 +pygments==2.15.1 # via sphinx -pytz==2022.7 - # via babel -requests==2.28.1 +requests==2.31.0 # via sphinx snowballstemmer==2.2.0 # via sphinx -sphinx==6.0.0 +sphinx==7.0.1 # via # -r requirements/docs.in # pallets-sphinx-themes @@ -45,11 +43,11 @@ # sphinxcontrib-log-cabinet sphinx-issues==3.0.1 # via -r requirements/docs.in -sphinxcontrib-applehelp==1.0.2 +sphinxcontrib-applehelp==1.0.4 # via sphinx sphinxcontrib-devhelp==1.0.2 # via sphinx -sphinxcontrib-htmlhelp==2.0.0 +sphinxcontrib-htmlhelp==2.0.1 # via sphinx sphinxcontrib-jsmath==1.0.1 # via sphinx @@ -59,5 +57,5 @@ # via sphinx sphinxcontrib-serializinghtml==1.1.5 # via sphinx -urllib3==1.26.13 +urllib3==2.0.2 # via requests diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MarkupSafe-2.1.2/requirements/tests.txt new/MarkupSafe-2.1.3/requirements/tests.txt --- old/MarkupSafe-2.1.2/requirements/tests.txt 2023-01-17 18:51:51.000000000 +0100 +++ new/MarkupSafe-2.1.3/requirements/tests.txt 2023-06-02 23:13:16.000000000 +0200 @@ -5,17 +5,11 @@ # # pip-compile-multi # -attrs==22.2.0 +iniconfig==2.0.0 # via pytest -exceptiongroup==1.1.0 - # via pytest -iniconfig==1.1.1 - # via pytest -packaging==22.0 +packaging==23.1 # via pytest pluggy==1.0.0 # via pytest -pytest==7.2.0 +pytest==7.3.1 # via -r requirements/tests.in -tomli==2.0.1 - # via pytest diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MarkupSafe-2.1.2/requirements/typing.txt new/MarkupSafe-2.1.3/requirements/typing.txt --- old/MarkupSafe-2.1.2/requirements/typing.txt 2023-01-17 18:51:51.000000000 +0100 +++ new/MarkupSafe-2.1.3/requirements/typing.txt 2023-06-02 23:13:16.000000000 +0200 @@ -5,11 +5,9 @@ # # pip-compile-multi # -mypy==0.991 +mypy==1.3.0 # via -r requirements/typing.in -mypy-extensions==0.4.3 +mypy-extensions==1.0.0 # via mypy -tomli==2.0.1 - # via mypy -typing-extensions==4.4.0 +typing-extensions==4.6.2 # via mypy diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MarkupSafe-2.1.2/setup.cfg new/MarkupSafe-2.1.3/setup.cfg --- old/MarkupSafe-2.1.2/setup.cfg 2023-01-17 18:52:09.248761400 +0100 +++ new/MarkupSafe-2.1.3/setup.cfg 2023-06-02 23:13:25.754227200 +0200 @@ -8,12 +8,9 @@ Changes = https://markupsafe.palletsprojects.com/changes/ Source Code = https://github.com/pallets/markupsafe/ Issue Tracker = https://github.com/pallets/markupsafe/issues/ - Twitter = https://twitter.com/PalletsTeam Chat = https://discord.gg/pallets license = BSD-3-Clause license_files = LICENSE.rst -author = Armin Ronacher -author_email = armin.ronac...@active-4.com maintainer = Pallets maintainer_email = cont...@palletsprojects.com description = Safely add untrusted strings to HTML/XML markup. @@ -42,6 +39,7 @@ testpaths = tests filterwarnings = error + ignore:ast:DeprecationWarning [coverage:run] branch = True diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MarkupSafe-2.1.2/src/MarkupSafe.egg-info/PKG-INFO new/MarkupSafe-2.1.3/src/MarkupSafe.egg-info/PKG-INFO --- old/MarkupSafe-2.1.2/src/MarkupSafe.egg-info/PKG-INFO 2023-01-17 18:52:09.000000000 +0100 +++ new/MarkupSafe-2.1.3/src/MarkupSafe.egg-info/PKG-INFO 2023-06-02 23:13:25.000000000 +0200 @@ -1,10 +1,8 @@ Metadata-Version: 2.1 Name: MarkupSafe -Version: 2.1.2 +Version: 2.1.3 Summary: Safely add untrusted strings to HTML/XML markup. Home-page: https://palletsprojects.com/p/markupsafe/ -Author: Armin Ronacher -Author-email: armin.ronac...@active-4.com Maintainer: Pallets Maintainer-email: cont...@palletsprojects.com License: BSD-3-Clause @@ -13,7 +11,6 @@ Project-URL: Changes, https://markupsafe.palletsprojects.com/changes/ Project-URL: Source Code, https://github.com/pallets/markupsafe/ Project-URL: Issue Tracker, https://github.com/pallets/markupsafe/issues/ -Project-URL: Twitter, https://twitter.com/PalletsTeam Project-URL: Chat, https://discord.gg/pallets Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: Web Environment @@ -93,6 +90,4 @@ - PyPI Releases: https://pypi.org/project/MarkupSafe/ - Source Code: https://github.com/pallets/markupsafe/ - Issue Tracker: https://github.com/pallets/markupsafe/issues/ -- Website: https://palletsprojects.com/p/markupsafe/ -- Twitter: https://twitter.com/PalletsTeam - Chat: https://discord.gg/pallets diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MarkupSafe-2.1.2/src/markupsafe/__init__.py new/MarkupSafe-2.1.3/src/markupsafe/__init__.py --- old/MarkupSafe-2.1.2/src/markupsafe/__init__.py 2023-01-17 18:51:51.000000000 +0100 +++ new/MarkupSafe-2.1.3/src/markupsafe/__init__.py 2023-06-02 23:13:16.000000000 +0200 @@ -1,6 +1,7 @@ import functools import re import string +import sys import typing as t if t.TYPE_CHECKING: @@ -10,23 +11,23 @@ def __html__(self) -> str: pass + _P = te.ParamSpec("_P") -__version__ = "2.1.2" + +__version__ = "2.1.3" _strip_comments_re = re.compile(r"<!--.*?-->", re.DOTALL) _strip_tags_re = re.compile(r"<.*?>", re.DOTALL) -def _simple_escaping_wrapper(name: str) -> t.Callable[..., "Markup"]: - orig = getattr(str, name) - - @functools.wraps(orig) - def wrapped(self: "Markup", *args: t.Any, **kwargs: t.Any) -> "Markup": - args = _escape_argspec(list(args), enumerate(args), self.escape) # type: ignore +def _simple_escaping_wrapper(func: "t.Callable[_P, str]") -> "t.Callable[_P, Markup]": + @functools.wraps(func) + def wrapped(self: "Markup", *args: "_P.args", **kwargs: "_P.kwargs") -> "Markup": + arg_list = _escape_argspec(list(args), enumerate(args), self.escape) _escape_argspec(kwargs, kwargs.items(), self.escape) - return self.__class__(orig(self, *args, **kwargs)) + return self.__class__(func(self, *arg_list, **kwargs)) # type: ignore[arg-type] - return wrapped + return wrapped # type: ignore[return-value] class Markup(str): @@ -69,7 +70,7 @@ def __new__( cls, base: t.Any = "", encoding: t.Optional[str] = None, errors: str = "strict" - ) -> "Markup": + ) -> "te.Self": if hasattr(base, "__html__"): base = base.__html__() @@ -78,22 +79,22 @@ return super().__new__(cls, base, encoding, errors) - def __html__(self) -> "Markup": + def __html__(self) -> "te.Self": return self - def __add__(self, other: t.Union[str, "HasHTML"]) -> "Markup": + def __add__(self, other: t.Union[str, "HasHTML"]) -> "te.Self": if isinstance(other, str) or hasattr(other, "__html__"): return self.__class__(super().__add__(self.escape(other))) return NotImplemented - def __radd__(self, other: t.Union[str, "HasHTML"]) -> "Markup": + def __radd__(self, other: t.Union[str, "HasHTML"]) -> "te.Self": if isinstance(other, str) or hasattr(other, "__html__"): return self.escape(other).__add__(self) return NotImplemented - def __mul__(self, num: "te.SupportsIndex") -> "Markup": + def __mul__(self, num: "te.SupportsIndex") -> "te.Self": if isinstance(num, int): return self.__class__(super().__mul__(num)) @@ -101,7 +102,7 @@ __rmul__ = __mul__ - def __mod__(self, arg: t.Any) -> "Markup": + def __mod__(self, arg: t.Any) -> "te.Self": if isinstance(arg, tuple): # a tuple of arguments, each wrapped arg = tuple(_MarkupEscapeHelper(x, self.escape) for x in arg) @@ -117,26 +118,28 @@ def __repr__(self) -> str: return f"{self.__class__.__name__}({super().__repr__()})" - def join(self, seq: t.Iterable[t.Union[str, "HasHTML"]]) -> "Markup": + def join(self, seq: t.Iterable[t.Union[str, "HasHTML"]]) -> "te.Self": return self.__class__(super().join(map(self.escape, seq))) join.__doc__ = str.join.__doc__ - def split( # type: ignore + def split( # type: ignore[override] self, sep: t.Optional[str] = None, maxsplit: int = -1 - ) -> t.List["Markup"]: + ) -> t.List["te.Self"]: return [self.__class__(v) for v in super().split(sep, maxsplit)] split.__doc__ = str.split.__doc__ - def rsplit( # type: ignore + def rsplit( # type: ignore[override] self, sep: t.Optional[str] = None, maxsplit: int = -1 - ) -> t.List["Markup"]: + ) -> t.List["te.Self"]: return [self.__class__(v) for v in super().rsplit(sep, maxsplit)] rsplit.__doc__ = str.rsplit.__doc__ - def splitlines(self, keepends: bool = False) -> t.List["Markup"]: # type: ignore + def splitlines( # type: ignore[override] + self, keepends: bool = False + ) -> t.List["te.Self"]: return [self.__class__(v) for v in super().splitlines(keepends)] splitlines.__doc__ = str.splitlines.__doc__ @@ -163,10 +166,10 @@ value = _strip_comments_re.sub("", self) value = _strip_tags_re.sub("", value) value = " ".join(value.split()) - return Markup(value).unescape() + return self.__class__(value).unescape() @classmethod - def escape(cls, s: t.Any) -> "Markup": + def escape(cls, s: t.Any) -> "te.Self": """Escape a string. Calls :func:`escape` and ensures that for subclasses the correct type is returned. """ @@ -175,45 +178,51 @@ if rv.__class__ is not cls: return cls(rv) - return rv - - for method in ( - "__getitem__", - "capitalize", - "title", - "lower", - "upper", - "replace", - "ljust", - "rjust", - "lstrip", - "rstrip", - "center", - "strip", - "translate", - "expandtabs", - "swapcase", - "zfill", - ): - locals()[method] = _simple_escaping_wrapper(method) + return rv # type: ignore[return-value] - del method + __getitem__ = _simple_escaping_wrapper(str.__getitem__) + capitalize = _simple_escaping_wrapper(str.capitalize) + title = _simple_escaping_wrapper(str.title) + lower = _simple_escaping_wrapper(str.lower) + upper = _simple_escaping_wrapper(str.upper) + replace = _simple_escaping_wrapper(str.replace) + ljust = _simple_escaping_wrapper(str.ljust) + rjust = _simple_escaping_wrapper(str.rjust) + lstrip = _simple_escaping_wrapper(str.lstrip) + rstrip = _simple_escaping_wrapper(str.rstrip) + center = _simple_escaping_wrapper(str.center) + strip = _simple_escaping_wrapper(str.strip) + translate = _simple_escaping_wrapper(str.translate) + expandtabs = _simple_escaping_wrapper(str.expandtabs) + swapcase = _simple_escaping_wrapper(str.swapcase) + zfill = _simple_escaping_wrapper(str.zfill) + casefold = _simple_escaping_wrapper(str.casefold) + + if sys.version_info >= (3, 9): + removeprefix = _simple_escaping_wrapper(str.removeprefix) + removesuffix = _simple_escaping_wrapper(str.removesuffix) - def partition(self, sep: str) -> t.Tuple["Markup", "Markup", "Markup"]: + def partition(self, sep: str) -> t.Tuple["te.Self", "te.Self", "te.Self"]: l, s, r = super().partition(self.escape(sep)) cls = self.__class__ return cls(l), cls(s), cls(r) - def rpartition(self, sep: str) -> t.Tuple["Markup", "Markup", "Markup"]: + def rpartition(self, sep: str) -> t.Tuple["te.Self", "te.Self", "te.Self"]: l, s, r = super().rpartition(self.escape(sep)) cls = self.__class__ return cls(l), cls(s), cls(r) - def format(self, *args: t.Any, **kwargs: t.Any) -> "Markup": + def format(self, *args: t.Any, **kwargs: t.Any) -> "te.Self": formatter = EscapeFormatter(self.escape) return self.__class__(formatter.vformat(self, args, kwargs)) - def __html_format__(self, format_spec: str) -> "Markup": + def format_map( # type: ignore[override] + self, map: t.Mapping[str, t.Any] + ) -> "te.Self": + formatter = EscapeFormatter(self.escape) + return self.__class__(formatter.vformat(self, (), map)) + + def __html_format__(self, format_spec: str) -> "te.Self": if format_spec: raise ValueError("Unsupported format specification for Markup.") @@ -268,8 +277,8 @@ self.obj = obj self.escape = escape - def __getitem__(self, item: t.Any) -> "_MarkupEscapeHelper": - return _MarkupEscapeHelper(self.obj[item], self.escape) + def __getitem__(self, item: t.Any) -> "te.Self": + return self.__class__(self.obj[item], self.escape) def __str__(self) -> str: return str(self.escape(self.obj)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MarkupSafe-2.1.2/tests/test_markupsafe.py new/MarkupSafe-2.1.3/tests/test_markupsafe.py --- old/MarkupSafe-2.1.2/tests/test_markupsafe.py 2023-01-17 18:51:51.000000000 +0100 +++ new/MarkupSafe-2.1.3/tests/test_markupsafe.py 2023-06-02 23:13:16.000000000 +0200 @@ -108,6 +108,11 @@ assert result == "<bar/>" +def test_format_map(): + result = Markup("<em>{value}</em>").format_map({"value": "<value>"}) + assert result == "<em><value></em>" + + def test_formatting_empty(): formatted = Markup("{}").format(0) assert formatted == Markup("0")