diff options
author | arcadia-devtools <arcadia-devtools@yandex-team.ru> | 2022-02-19 18:51:55 +0300 |
---|---|---|
committer | arcadia-devtools <arcadia-devtools@yandex-team.ru> | 2022-02-19 18:51:55 +0300 |
commit | 9691260ca94129d24114051f9b7e117cb2fa9ca8 (patch) | |
tree | 4be5f8dd15be6c352c08d90c188adbb1f48d0027 | |
parent | 52a1ac58104ca032e718abb079dedc9600e85e34 (diff) | |
download | ydb-9691260ca94129d24114051f9b7e117cb2fa9ca8.tar.gz |
intermediate changes
ref:0bb75733c76b2fcaae048d43c4477755596029bb
-rwxr-xr-x | build/ymake_conf.py | 1 | ||||
-rw-r--r-- | contrib/python/MarkupSafe/py3/.dist-info/METADATA | 6 | ||||
-rw-r--r-- | contrib/python/MarkupSafe/py3/README.rst | 2 | ||||
-rw-r--r-- | contrib/python/MarkupSafe/py3/markupsafe/__init__.py | 15 | ||||
-rw-r--r-- | contrib/python/MarkupSafe/py3/markupsafe/_native.py | 12 | ||||
-rw-r--r-- | contrib/python/MarkupSafe/py3/markupsafe/_speedups.c | 19 | ||||
-rw-r--r-- | contrib/python/MarkupSafe/py3/tests/conftest.py | 5 | ||||
-rw-r--r-- | contrib/python/MarkupSafe/py3/tests/test_markupsafe.py | 11 | ||||
-rw-r--r-- | contrib/python/MarkupSafe/py3/ya.make | 2 | ||||
-rw-r--r-- | contrib/python/ya.make | 1 | ||||
-rw-r--r-- | library/cpp/yson_pull/detail/fail.h | 2 |
11 files changed, 22 insertions, 54 deletions
diff --git a/build/ymake_conf.py b/build/ymake_conf.py index 5e52da458b..b9b3f324dc 100755 --- a/build/ymake_conf.py +++ b/build/ymake_conf.py @@ -2465,7 +2465,6 @@ class MSVCCompiler(MSVC, Compiler): '-Wno-ignored-pragma-optimize', '-Wno-inconsistent-dllimport', '-Wno-int-conversion', - '-Wno-invalid-noreturn', '-Wno-logical-op-parentheses', '-Wno-macro-redefined', '-Wno-parentheses', diff --git a/contrib/python/MarkupSafe/py3/.dist-info/METADATA b/contrib/python/MarkupSafe/py3/.dist-info/METADATA index e87ebb99a9..0c81a12c40 100644 --- a/contrib/python/MarkupSafe/py3/.dist-info/METADATA +++ b/contrib/python/MarkupSafe/py3/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: MarkupSafe -Version: 2.0.1 +Version: 2.1.0 Summary: Safely add untrusted strings to HTML/XML markup. Home-page: https://palletsprojects.com/p/markupsafe/ Author: Armin Ronacher @@ -24,7 +24,7 @@ Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content Classifier: Topic :: Text Processing :: Markup :: HTML -Requires-Python: >=3.6 +Requires-Python: >=3.7 Description-Content-Type: text/x-rst License-File: LICENSE.rst @@ -47,7 +47,7 @@ Install and update using `pip`_: pip install -U MarkupSafe -.. _pip: https://pip.pypa.io/en/stable/quickstart/ +.. _pip: https://pip.pypa.io/en/stable/getting-started/ Examples diff --git a/contrib/python/MarkupSafe/py3/README.rst b/contrib/python/MarkupSafe/py3/README.rst index 273e1db40f..0b27612322 100644 --- a/contrib/python/MarkupSafe/py3/README.rst +++ b/contrib/python/MarkupSafe/py3/README.rst @@ -17,7 +17,7 @@ Install and update using `pip`_: pip install -U MarkupSafe -.. _pip: https://pip.pypa.io/en/stable/quickstart/ +.. _pip: https://pip.pypa.io/en/stable/getting-started/ Examples diff --git a/contrib/python/MarkupSafe/py3/markupsafe/__init__.py b/contrib/python/MarkupSafe/py3/markupsafe/__init__.py index d331ac3622..2acb04e47b 100644 --- a/contrib/python/MarkupSafe/py3/markupsafe/__init__.py +++ b/contrib/python/MarkupSafe/py3/markupsafe/__init__.py @@ -11,7 +11,7 @@ if t.TYPE_CHECKING: pass -__version__ = "2.0.1" +__version__ = "2.1.0" _striptags_re = re.compile(r"(<!--.*?-->|<[^>]*>)") @@ -92,19 +92,24 @@ class Markup(str): return NotImplemented - def __mul__(self, num: int) -> "Markup": + def __mul__(self, num: "te.SupportsIndex") -> "Markup": if isinstance(num, int): return self.__class__(super().__mul__(num)) - return NotImplemented # type: ignore + return NotImplemented __rmul__ = __mul__ def __mod__(self, arg: t.Any) -> "Markup": if isinstance(arg, tuple): + # a tuple of arguments, each wrapped arg = tuple(_MarkupEscapeHelper(x, self.escape) for x in arg) - else: + elif hasattr(type(arg), "__getitem__") and not isinstance(arg, str): + # a mapping of arguments, wrapped arg = _MarkupEscapeHelper(arg, self.escape) + else: + # a single argument, wrapped with the helper and a tuple + arg = (_MarkupEscapeHelper(arg, self.escape),) return self.__class__(super().__mod__(arg)) @@ -280,9 +285,7 @@ try: from ._speedups import escape as escape from ._speedups import escape_silent as escape_silent from ._speedups import soft_str as soft_str - from ._speedups import soft_unicode except ImportError: from ._native import escape as escape from ._native import escape_silent as escape_silent # noqa: F401 from ._native import soft_str as soft_str # noqa: F401 - from ._native import soft_unicode # noqa: F401 diff --git a/contrib/python/MarkupSafe/py3/markupsafe/_native.py b/contrib/python/MarkupSafe/py3/markupsafe/_native.py index 6f7eb7a8cb..8117b2716d 100644 --- a/contrib/python/MarkupSafe/py3/markupsafe/_native.py +++ b/contrib/python/MarkupSafe/py3/markupsafe/_native.py @@ -61,15 +61,3 @@ def soft_str(s: t.Any) -> str: return str(s) return s - - -def soft_unicode(s: t.Any) -> str: - import warnings - - warnings.warn( - "'soft_unicode' has been renamed to 'soft_str'. The old name" - " will be removed in MarkupSafe 2.1.", - DeprecationWarning, - stacklevel=2, - ) - return soft_str(s) diff --git a/contrib/python/MarkupSafe/py3/markupsafe/_speedups.c b/contrib/python/MarkupSafe/py3/markupsafe/_speedups.c index 44967b1fdc..3c463fb82d 100644 --- a/contrib/python/MarkupSafe/py3/markupsafe/_speedups.c +++ b/contrib/python/MarkupSafe/py3/markupsafe/_speedups.c @@ -254,19 +254,6 @@ soft_str(PyObject *self, PyObject *s) } -static PyObject* -soft_unicode(PyObject *self, PyObject *s) -{ - PyErr_WarnEx( - PyExc_DeprecationWarning, - "'soft_unicode' has been renamed to 'soft_str'. The old name" - " will be removed in MarkupSafe 2.1.", - 2 - ); - return soft_str(self, s); -} - - static PyMethodDef module_methods[] = { { "escape", @@ -308,12 +295,6 @@ static PyMethodDef module_methods[] = { ">>> escape(soft_str(value))\n" "Markup('<User 1>')\n" }, - { - "soft_unicode", - (PyCFunction)soft_unicode, - METH_O, - "" - }, {NULL, NULL, 0, NULL} /* Sentinel */ }; diff --git a/contrib/python/MarkupSafe/py3/tests/conftest.py b/contrib/python/MarkupSafe/py3/tests/conftest.py index 13f938ced9..d040ea8b1c 100644 --- a/contrib/python/MarkupSafe/py3/tests/conftest.py +++ b/contrib/python/MarkupSafe/py3/tests/conftest.py @@ -35,8 +35,3 @@ def escape_silent(_mod): @pytest.fixture(scope="session") def soft_str(_mod): return _mod.soft_str - - -@pytest.fixture(scope="session") -def soft_unicode(_mod): - return _mod.soft_unicode diff --git a/contrib/python/MarkupSafe/py3/tests/test_markupsafe.py b/contrib/python/MarkupSafe/py3/tests/test_markupsafe.py index fcd934702e..2f13885406 100644 --- a/contrib/python/MarkupSafe/py3/tests/test_markupsafe.py +++ b/contrib/python/MarkupSafe/py3/tests/test_markupsafe.py @@ -45,6 +45,12 @@ def test_html_interop(): assert result == "<strong><em>awesome</em></strong>" +@pytest.mark.parametrize("args", ["foo", 42, ("foo", 42)]) +def test_missing_interpol(args): + with pytest.raises(TypeError): + Markup("<em></em>") % args + + def test_tuple_interpol(): result = Markup("<em>%s:%s</em>") % ("<foo>", "<bar>") expect = Markup("<em><foo>:<bar></em>") @@ -178,8 +184,3 @@ def test_soft_str(soft_str): assert type(soft_str("")) is str assert type(soft_str(Markup())) is Markup assert type(soft_str(15)) is str - - -def test_soft_unicode_deprecated(soft_unicode): - with pytest.warns(DeprecationWarning): - assert type(soft_unicode(Markup())) is Markup diff --git a/contrib/python/MarkupSafe/py3/ya.make b/contrib/python/MarkupSafe/py3/ya.make index 8c750e15d8..2dfc6466e3 100644 --- a/contrib/python/MarkupSafe/py3/ya.make +++ b/contrib/python/MarkupSafe/py3/ya.make @@ -4,7 +4,7 @@ PY3_LIBRARY() OWNER(g:python-contrib) -VERSION(2.0.1) +VERSION(2.1.0) LICENSE(BSD-3-Clause) diff --git a/contrib/python/ya.make b/contrib/python/ya.make index 290cd426b6..a985927534 100644 --- a/contrib/python/ya.make +++ b/contrib/python/ya.make @@ -326,6 +326,7 @@ RECURSE( dpkt drf-extensions drf-spectacular + drf-spectacular-sidecar drf_ujson drf-yasg easywebdav diff --git a/library/cpp/yson_pull/detail/fail.h b/library/cpp/yson_pull/detail/fail.h index 6937612d0b..3e65b0f887 100644 --- a/library/cpp/yson_pull/detail/fail.h +++ b/library/cpp/yson_pull/detail/fail.h @@ -9,7 +9,7 @@ namespace NYsonPull { namespace NDetail { template <typename... Args> - ATTRIBUTE(noreturn, noinline, cold) + [[noreturn]] ATTRIBUTE(noinline, cold) void fail( const TPositionInfo& info, Args&&... args) { |