Projects
openEuler:Mainline
python-markupsafe
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 8
View file
_service:tar_scm:python-markupsafe.spec
Changed
@@ -4,7 +4,7 @@ This mitigates injection attacks, meaning untrusted user input can safely be displayed on a page. Name: python-markupsafe -Version: 2.1.1 +Version: 2.1.3 Release: 1 Summary: Safely add untrusted strings to HTML/XML markup. License: BSD @@ -45,6 +45,9 @@ %doc README.rst %changelog +* Wed Jul 12 2023 sunhui <sunhui@kylinos.cn> - 2.1.3-1 +- Update package to version 2.1.3 + * Thu Jan 19 2023 chendh6 <chendonghui6@huawei.com> - 2.1.1-1 - upgrade to 2.1.1
View file
_service:tar_scm:MarkupSafe-2.1.1.tar.gz/CHANGES.rst -> _service:tar_scm:MarkupSafe-2.1.3.tar.gz/CHANGES.rst
Changed
@@ -1,3 +1,23 @@ +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 +------------- + +Released 2023-01-17 + +- Fix ``striptags`` not stripping tags containing newlines. + :issue:`310` + + Version 2.1.1 -------------
View file
_service:tar_scm:MarkupSafe-2.1.1.tar.gz/PKG-INFO -> _service:tar_scm:MarkupSafe-2.1.3.tar.gz/PKG-INFO
Changed
@@ -1,10 +1,8 @@ Metadata-Version: 2.1 Name: MarkupSafe -Version: 2.1.1 +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.ronacher@active-4.com Maintainer: Pallets Maintainer-email: contact@palletsprojects.com License: BSD-3-Clause @@ -13,9 +11,7 @@ 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 -Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: Web Environment Classifier: Intended Audience :: Developers @@ -94,8 +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 - -
View file
_service:tar_scm:MarkupSafe-2.1.1.tar.gz/README.rst -> _service:tar_scm:MarkupSafe-2.1.3.tar.gz/README.rst
Changed
@@ -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
View file
_service:tar_scm:MarkupSafe-2.1.1.tar.gz/docs/conf.py -> _service:tar_scm:MarkupSafe-2.1.3.tar.gz/docs/conf.py
Changed
@@ -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"), }
View file
_service:tar_scm:MarkupSafe-2.1.3.tar.gz/requirements/build.txt
Added
@@ -0,0 +1,13 @@ +# SHA1:80754af91bfb6d1073585b046fe0a474ce868509 +# +# This file is autogenerated by pip-compile-multi +# To update, run: +# +# pip-compile-multi +# +build==0.10.0 + # via -r requirements/build.in +packaging==23.1 + # via build +pyproject-hooks==1.0.0 + # via build
View file
_service:tar_scm:MarkupSafe-2.1.1.tar.gz/requirements/dev.txt -> _service:tar_scm:MarkupSafe-2.1.3.tar.gz/requirements/dev.txt
Changed
@@ -8,51 +8,55 @@ -r docs.txt -r tests.txt -r typing.txt +build==0.10.0 + # via pip-tools +cachetools==5.3.1 + # via tox cfgv==3.3.1 # via pre-commit -click==8.0.3 +chardet==5.1.0 + # via tox +click==8.1.3 # via # pip-compile-multi # pip-tools -distlib==0.3.4 +colorama==0.4.6 + # via tox +distlib==0.3.6 # via virtualenv -filelock==3.5.1 +filelock==3.12.0 # via # tox # virtualenv -identify==2.4.10 +identify==2.5.24 # via pre-commit -nodeenv==1.6.0 +nodeenv==1.8.0 # via pre-commit -pep517==0.12.0 - # via pip-tools -pip-compile-multi==2.4.3 +pip-compile-multi==2.6.3 # via -r requirements/dev.in -pip-tools==6.5.1 +pip-tools==6.13.0 # via pip-compile-multi -platformdirs==2.5.0 - # via virtualenv -pre-commit==2.17.0 - # via -r requirements/dev.in -pyyaml==6.0 - # via pre-commit -six==1.16.0 +platformdirs==3.5.1 # via # tox # virtualenv -toml==0.10.2 - # via - # pre-commit - # tox -toposort==1.7 +pre-commit==3.3.2 + # via -r requirements/dev.in +pyproject-api==1.5.1 + # via tox +pyproject-hooks==1.0.0 + # via build +pyyaml==6.0 + # via pre-commit +toposort==1.10 # via pip-compile-multi -tox==3.24.5 +tox==4.5.2 # via -r requirements/dev.in -virtualenv==20.13.1 +virtualenv==20.23.0 # via # pre-commit # tox -wheel==0.37.1 +wheel==0.40.0 # via pip-tools # The following packages are considered to be unsafe in a requirements file:
View file
_service:tar_scm:MarkupSafe-2.1.1.tar.gz/requirements/docs.txt -> _service:tar_scm:MarkupSafe-2.1.3.tar.gz/requirements/docs.txt
Changed
@@ -5,41 +5,37 @@ # # pip-compile-multi # -alabaster==0.7.12 +alabaster==0.7.13 # via sphinx -babel==2.9.1 +babel==2.12.1 # via sphinx -certifi==2021.10.8 +certifi==2023.5.7 # via requests -charset-normalizer==2.0.12 +charset-normalizer==3.1.0 # via requests -docutils==0.17.1 +docutils==0.20.1 # via sphinx -idna==3.3 +idna==3.4 # via requests -imagesize==1.3.0 +imagesize==1.4.1 # via sphinx -jinja2==3.0.3 +jinja2==3.1.2 # via sphinx -markupsafe==2.0.1 +markupsafe==2.1.2 # via jinja2 -packaging==21.3 +packaging==23.1 # via # pallets-sphinx-themes # sphinx -pallets-sphinx-themes==2.0.2 +pallets-sphinx-themes==2.1.0 # via -r requirements/docs.in -pygments==2.11.2 +pygments==2.15.1 # via sphinx -pyparsing==3.0.7 - # via packaging -pytz==2021.3 - # via babel -requests==2.27.1 +requests==2.31.0 # via sphinx snowballstemmer==2.2.0 # via sphinx -sphinx==4.4.0 +sphinx==7.0.1 # via # -r requirements/docs.in # pallets-sphinx-themes @@ -47,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 @@ -61,5 +57,5 @@ # via sphinx sphinxcontrib-serializinghtml==1.1.5 # via sphinx -urllib3==1.26.8 +urllib3==2.0.2 # via requests
View file
_service:tar_scm:MarkupSafe-2.1.1.tar.gz/requirements/tests.txt -> _service:tar_scm:MarkupSafe-2.1.3.tar.gz/requirements/tests.txt
Changed
@@ -5,19 +5,11 @@ # # pip-compile-multi # -attrs==21.4.0 +iniconfig==2.0.0 # via pytest -iniconfig==1.1.1 - # via pytest -packaging==21.3 +packaging==23.1 # via pytest pluggy==1.0.0 # via pytest -py==1.11.0 - # via pytest -pyparsing==3.0.7 - # via packaging -pytest==7.0.1 +pytest==7.3.1 # via -r requirements/tests.in -tomli==2.0.1 - # via pytest
View file
_service:tar_scm:MarkupSafe-2.1.1.tar.gz/requirements/typing.txt -> _service:tar_scm:MarkupSafe-2.1.3.tar.gz/requirements/typing.txt
Changed
@@ -5,11 +5,9 @@ # # pip-compile-multi # -mypy==0.931 +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.1.1 +typing-extensions==4.6.2 # via mypy
View file
_service:tar_scm:MarkupSafe-2.1.1.tar.gz/setup.cfg -> _service:tar_scm:MarkupSafe-2.1.3.tar.gz/setup.cfg
Changed
@@ -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.ronacher@active-4.com maintainer = Pallets maintainer_email = contact@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 @@ -61,6 +59,7 @@ E501 E722 W503 + B905 max-line-length = 80 mypy
View file
_service:tar_scm:MarkupSafe-2.1.1.tar.gz/src/MarkupSafe.egg-info/PKG-INFO -> _service:tar_scm:MarkupSafe-2.1.3.tar.gz/src/MarkupSafe.egg-info/PKG-INFO
Changed
@@ -1,10 +1,8 @@ Metadata-Version: 2.1 Name: MarkupSafe -Version: 2.1.1 +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.ronacher@active-4.com Maintainer: Pallets Maintainer-email: contact@palletsprojects.com License: BSD-3-Clause @@ -13,9 +11,7 @@ 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 -Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: Web Environment Classifier: Intended Audience :: Developers @@ -94,8 +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 - -
View file
_service:tar_scm:MarkupSafe-2.1.1.tar.gz/src/MarkupSafe.egg-info/SOURCES.txt -> _service:tar_scm:MarkupSafe-2.1.3.tar.gz/src/MarkupSafe.egg-info/SOURCES.txt
Changed
@@ -14,6 +14,7 @@ docs/index.rst docs/license.rst docs/make.bat +requirements/build.txt requirements/dev.txt requirements/docs.txt requirements/tests.txt
View file
_service:tar_scm:MarkupSafe-2.1.1.tar.gz/src/markupsafe/__init__.py -> _service:tar_scm:MarkupSafe-2.1.3.tar.gz/src/markupsafe/__init__.py
Changed
@@ -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.1" -_strip_comments_re = re.compile(r"<!--.*?-->") -_strip_tags_re = re.compile(r"<.*?>") +__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: ignorearg-type - return wrapped + return wrapped # type: ignorereturn-value class Markup(str): @@ -69,7 +70,7 @@ def __new__( cls, base: t.Any = "", encoding: t.Optionalstr = 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.Unionstr, "HasHTML") -> "Markup": + def __add__(self, other: t.Unionstr, "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.Unionstr, "HasHTML") -> "Markup": + def __radd__(self, other: t.Unionstr, "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.Iterablet.Unionstr, "HasHTML") -> "Markup": + def join(self, seq: t.Iterablet.Unionstr, "HasHTML") -> "te.Self": return self.__class__(super().join(map(self.escape, seq))) join.__doc__ = str.join.__doc__ - def split( # type: ignore + def split( # type: ignoreoverride self, sep: t.Optionalstr = 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: ignoreoverride self, sep: t.Optionalstr = 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: ignoreoverride + 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) - - del method - - def partition(self, sep: str) -> t.Tuple"Markup", "Markup", "Markup": + return rv # type: ignorereturn-value + + __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"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: ignoreoverride + self, map: t.Mappingstr, 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.objitem, self.escape) + def __getitem__(self, item: t.Any) -> "te.Self": + return self.__class__(self.objitem, self.escape) def __str__(self) -> str: return str(self.escape(self.obj))
View file
_service:tar_scm:MarkupSafe-2.1.1.tar.gz/tests/test_markupsafe.py -> _service:tar_scm:MarkupSafe-2.1.3.tar.gz/tests/test_markupsafe.py
Changed
@@ -75,6 +75,8 @@ "<em>Foo & Bar" "<!-- inner comment about <em> -->" "</em>" + "<!-- comment\nwith\nnewlines\n-->" + "<meta content='tag\nwith\nnewlines'>" ).striptags() == "Foo & Bar" ) @@ -106,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")
View file
_service:tar_scm:MarkupSafe-2.1.1.tar.gz/tox.ini -> _service:tar_scm:MarkupSafe-2.1.3.tar.gz/tox.ini
Changed
@@ -1,24 +1,28 @@ tox envlist = - py3{11,10,9,8,7},pypy3{8,7} + py3{12,11,10,9,8,7} + pypy39 style typing docs skip_missing_interpreters = true testenv +package = wheel deps = -r requirements/tests.txt commands = pytest -v --tb=short --basetemp={envtmpdir} {posargs} testenv:style deps = pre-commit skip_install = true -commands = pre-commit run --all-files --show-diff-on-failure +commands = pre-commit run --all-files testenv:typing +package = wheel deps = -r requirements/typing.txt commands = mypy testenv:docs +package = wheel deps = -r requirements/docs.txt commands = sphinx-build -W -b html -d {envtmpdir}/doctrees docs {envtmpdir}/html
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2