aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorartkolesnikov <artkolesnikov@yandex-team.ru>2022-02-10 16:47:37 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:37 +0300
commit0d7c4ef9025d79c9bba6f62a92b490ee72e80ed0 (patch)
treec0748b5dcbade83af788c0abfa89c0383d6b779c
parent8611780b719073fe6c7e6536c71d61e20d57a5d6 (diff)
downloadydb-0d7c4ef9025d79c9bba6f62a92b490ee72e80ed0.tar.gz
Restoring authorship annotation for <artkolesnikov@yandex-team.ru>. Commit 2 of 2.
-rw-r--r--contrib/libs/libidn/idna.c2
-rw-r--r--contrib/python/MarkupSafe/py2/markupsafe/__init__.py370
-rw-r--r--contrib/python/MarkupSafe/py2/markupsafe/_compat.py36
-rw-r--r--contrib/python/MarkupSafe/py2/markupsafe/_constants.py14
-rw-r--r--contrib/python/MarkupSafe/py2/markupsafe/_native.py48
-rw-r--r--contrib/python/MarkupSafe/py2/markupsafe/_speedups.c442
-rw-r--r--contrib/python/MarkupSafe/py2/ya.make22
-rw-r--r--contrib/python/MarkupSafe/py3/markupsafe/__init__.py156
-rw-r--r--contrib/python/MarkupSafe/py3/markupsafe/_native.py30
-rw-r--r--contrib/python/MarkupSafe/py3/markupsafe/_speedups.c188
-rw-r--r--contrib/python/MarkupSafe/py3/ya.make8
-rw-r--r--contrib/python/MarkupSafe/ya.make6
-rw-r--r--contrib/python/tornado/ya.make2
-rw-r--r--library/cpp/http/server/response.h8
-rw-r--r--library/cpp/string_utils/parse_size/parse_size.cpp20
-rw-r--r--library/cpp/string_utils/parse_size/parse_size.h8
-rw-r--r--library/cpp/string_utils/parse_size/parse_size_ut.cpp84
-rw-r--r--library/cpp/string_utils/parse_size/ut/ya.make14
-rw-r--r--library/cpp/string_utils/parse_size/ya.make18
-rw-r--r--util/generic/buffer.cpp26
-rw-r--r--util/generic/buffer.h2
-rw-r--r--util/generic/refcount.h46
-rw-r--r--util/generic/typetraits_ut.cpp78
-rw-r--r--util/stream/str_ut.cpp46
24 files changed, 837 insertions, 837 deletions
diff --git a/contrib/libs/libidn/idna.c b/contrib/libs/libidn/idna.c
index 7745bd5f9e..af3f24d58e 100644
--- a/contrib/libs/libidn/idna.c
+++ b/contrib/libs/libidn/idna.c
@@ -360,7 +360,7 @@ idna_to_unicode_internal (char *utf8in,
*/
step3:
- if (strncmp (IDNA_ACE_PREFIX, utf8in, STRLEN (IDNA_ACE_PREFIX)) != 0)
+ if (strncmp (IDNA_ACE_PREFIX, utf8in, STRLEN (IDNA_ACE_PREFIX)) != 0)
{
free (utf8in);
return IDNA_NO_ACE_PREFIX;
diff --git a/contrib/python/MarkupSafe/py2/markupsafe/__init__.py b/contrib/python/MarkupSafe/py2/markupsafe/__init__.py
index a3697a9477..da05ed328a 100644
--- a/contrib/python/MarkupSafe/py2/markupsafe/__init__.py
+++ b/contrib/python/MarkupSafe/py2/markupsafe/__init__.py
@@ -1,17 +1,17 @@
-# -*- coding: utf-8 -*-
-"""
+# -*- coding: utf-8 -*-
+"""
markupsafe
~~~~~~~~~~
-
+
Implements an escape function and a Markup string to replace HTML
special characters with safe representations.
-
+
:copyright: 2010 Pallets
:license: BSD-3-Clause
-"""
-import re
-import string
-
+"""
+import re
+import string
+
from ._compat import int_types
from ._compat import iteritems
from ._compat import Mapping
@@ -19,31 +19,31 @@ from ._compat import PY2
from ._compat import string_types
from ._compat import text_type
from ._compat import unichr
-
+
__version__ = "1.1.1"
-
+
__all__ = ["Markup", "soft_unicode", "escape", "escape_silent"]
-
+
_striptags_re = re.compile(r"(<!--.*?-->|<[^>]*>)")
_entity_re = re.compile(r"&([^& ;]+);")
-
-
-class Markup(text_type):
+
+
+class Markup(text_type):
"""A string that is ready to be safely inserted into an HTML or XML
document, either because it was escaped or because it was marked
safe.
-
+
Passing an object to the constructor converts it to text and wraps
it to mark it safe without escaping. To escape the text, use the
:meth:`escape` class method instead.
-
+
>>> Markup('Hello, <em>World</em>!')
Markup('Hello, <em>World</em>!')
>>> Markup(42)
Markup('42')
>>> Markup.escape('Hello, <em>World</em>!')
Markup('Hello &lt;em&gt;World&lt;/em&gt;!')
-
+
This implements the ``__html__()`` interface that some frameworks
use. Passing an object that implements ``__html__()`` will wrap the
output of that method, marking it safe.
@@ -51,136 +51,136 @@ class Markup(text_type):
>>> class Foo:
... def __html__(self):
... return '<a href="/foo">foo</a>'
- ...
- >>> Markup(Foo())
+ ...
+ >>> Markup(Foo())
Markup('<a href="/foo">foo</a>')
-
+
This is a subclass of the text type (``str`` in Python 3,
``unicode`` in Python 2). It has the same methods as that type, but
all methods escape their arguments and return a ``Markup`` instance.
-
+
>>> Markup('<em>%s</em>') % 'foo & bar'
Markup('<em>foo &amp; bar</em>')
>>> Markup('<em>Hello</em> ') + '<foo>'
Markup('<em>Hello</em> &lt;foo&gt;')
"""
-
- __slots__ = ()
-
+
+ __slots__ = ()
+
def __new__(cls, base=u"", encoding=None, errors="strict"):
if hasattr(base, "__html__"):
- base = base.__html__()
- if encoding is None:
- return text_type.__new__(cls, base)
- return text_type.__new__(cls, base, encoding, errors)
-
- def __html__(self):
- return self
-
- def __add__(self, other):
+ base = base.__html__()
+ if encoding is None:
+ return text_type.__new__(cls, base)
+ return text_type.__new__(cls, base, encoding, errors)
+
+ def __html__(self):
+ return self
+
+ def __add__(self, other):
if isinstance(other, string_types) or hasattr(other, "__html__"):
- return self.__class__(super(Markup, self).__add__(self.escape(other)))
- return NotImplemented
-
- def __radd__(self, other):
+ return self.__class__(super(Markup, self).__add__(self.escape(other)))
+ return NotImplemented
+
+ def __radd__(self, other):
if hasattr(other, "__html__") or isinstance(other, string_types):
- return self.escape(other).__add__(self)
- return NotImplemented
-
- def __mul__(self, num):
- if isinstance(num, int_types):
- return self.__class__(text_type.__mul__(self, num))
- return NotImplemented
-
- __rmul__ = __mul__
-
- def __mod__(self, arg):
- if isinstance(arg, tuple):
- arg = tuple(_MarkupEscapeHelper(x, self.escape) for x in arg)
- else:
- arg = _MarkupEscapeHelper(arg, self.escape)
- return self.__class__(text_type.__mod__(self, arg))
-
- def __repr__(self):
+ return self.escape(other).__add__(self)
+ return NotImplemented
+
+ def __mul__(self, num):
+ if isinstance(num, int_types):
+ return self.__class__(text_type.__mul__(self, num))
+ return NotImplemented
+
+ __rmul__ = __mul__
+
+ def __mod__(self, arg):
+ if isinstance(arg, tuple):
+ arg = tuple(_MarkupEscapeHelper(x, self.escape) for x in arg)
+ else:
+ arg = _MarkupEscapeHelper(arg, self.escape)
+ return self.__class__(text_type.__mod__(self, arg))
+
+ def __repr__(self):
return "%s(%s)" % (self.__class__.__name__, text_type.__repr__(self))
-
- def join(self, seq):
- return self.__class__(text_type.join(self, map(self.escape, seq)))
-
- join.__doc__ = text_type.join.__doc__
-
- def split(self, *args, **kwargs):
- return list(map(self.__class__, text_type.split(self, *args, **kwargs)))
-
- split.__doc__ = text_type.split.__doc__
-
- def rsplit(self, *args, **kwargs):
- return list(map(self.__class__, text_type.rsplit(self, *args, **kwargs)))
-
- rsplit.__doc__ = text_type.rsplit.__doc__
-
- def splitlines(self, *args, **kwargs):
+
+ def join(self, seq):
+ return self.__class__(text_type.join(self, map(self.escape, seq)))
+
+ join.__doc__ = text_type.join.__doc__
+
+ def split(self, *args, **kwargs):
+ return list(map(self.__class__, text_type.split(self, *args, **kwargs)))
+
+ split.__doc__ = text_type.split.__doc__
+
+ def rsplit(self, *args, **kwargs):
+ return list(map(self.__class__, text_type.rsplit(self, *args, **kwargs)))
+
+ rsplit.__doc__ = text_type.rsplit.__doc__
+
+ def splitlines(self, *args, **kwargs):
return list(map(self.__class__, text_type.splitlines(self, *args, **kwargs)))
- splitlines.__doc__ = text_type.splitlines.__doc__
-
- def unescape(self):
+ splitlines.__doc__ = text_type.splitlines.__doc__
+
+ def unescape(self):
"""Convert escaped markup back into a text string. This replaces
HTML entities with the characters they represent.
-
+
>>> Markup('Main &raquo; <em>About</em>').unescape()
'Main » <em>About</em>'
- """
+ """
from ._constants import HTML_ENTITIES
- def handle_match(m):
- name = m.group(1)
- if name in HTML_ENTITIES:
- return unichr(HTML_ENTITIES[name])
- try:
+ def handle_match(m):
+ name = m.group(1)
+ if name in HTML_ENTITIES:
+ return unichr(HTML_ENTITIES[name])
+ try:
if name[:2] in ("#x", "#X"):
- return unichr(int(name[2:], 16))
+ return unichr(int(name[2:], 16))
elif name.startswith("#"):
- return unichr(int(name[1:]))
- except ValueError:
- pass
+ return unichr(int(name[1:]))
+ except ValueError:
+ pass
# Don't modify unexpected input.
return m.group()
- return _entity_re.sub(handle_match, text_type(self))
-
- def striptags(self):
+ return _entity_re.sub(handle_match, text_type(self))
+
+ def striptags(self):
""":meth:`unescape` the markup, remove tags, and normalize
whitespace to single spaces.
-
+
>>> Markup('Main &raquo;\t<em>About</em>').striptags()
'Main » About'
- """
+ """
stripped = u" ".join(_striptags_re.sub("", self).split())
- return Markup(stripped).unescape()
-
- @classmethod
- def escape(cls, s):
+ return Markup(stripped).unescape()
+
+ @classmethod
+ def escape(cls, s):
"""Escape a string. Calls :func:`escape` and ensures that for
subclasses the correct type is returned.
- """
- rv = escape(s)
- if rv.__class__ is not cls:
- return cls(rv)
- return rv
-
+ """
+ rv = escape(s)
+ if rv.__class__ is not cls:
+ return cls(rv)
+ return rv
+
def make_simple_escaping_wrapper(name): # noqa: B902
- orig = getattr(text_type, name)
+ orig = getattr(text_type, name)
+
+ def func(self, *args, **kwargs):
+ args = _escape_argspec(list(args), enumerate(args), self.escape)
+ _escape_argspec(kwargs, iteritems(kwargs), self.escape)
+ return self.__class__(orig(self, *args, **kwargs))
- def func(self, *args, **kwargs):
- args = _escape_argspec(list(args), enumerate(args), self.escape)
- _escape_argspec(kwargs, iteritems(kwargs), self.escape)
- return self.__class__(orig(self, *args, **kwargs))
+ func.__name__ = orig.__name__
+ func.__doc__ = orig.__doc__
+ return func
- func.__name__ = orig.__name__
- func.__doc__ = orig.__doc__
- return func
-
for method in (
"__getitem__",
"capitalize",
@@ -199,110 +199,110 @@ class Markup(text_type):
"swapcase",
"zfill",
):
- locals()[method] = make_simple_escaping_wrapper(method)
-
+ locals()[method] = make_simple_escaping_wrapper(method)
+
def partition(self, sep):
return tuple(map(self.__class__, text_type.partition(self, self.escape(sep))))
-
+
def rpartition(self, sep):
return tuple(map(self.__class__, text_type.rpartition(self, self.escape(sep))))
-
+
def format(self, *args, **kwargs):
formatter = EscapeFormatter(self.escape)
kwargs = _MagicFormatMapping(args, kwargs)
return self.__class__(formatter.vformat(self, args, kwargs))
-
+
def __html_format__(self, format_spec):
if format_spec:
raise ValueError("Unsupported format specification " "for Markup.")
return self
- # not in python 3
+ # not in python 3
if hasattr(text_type, "__getslice__"):
__getslice__ = make_simple_escaping_wrapper("__getslice__")
-
- del method, make_simple_escaping_wrapper
-
-
-class _MagicFormatMapping(Mapping):
- """This class implements a dummy wrapper to fix a bug in the Python
- standard library for string formatting.
-
- See http://bugs.python.org/issue13598 for information about why
- this is necessary.
- """
-
- def __init__(self, args, kwargs):
- self._args = args
- self._kwargs = kwargs
- self._last_index = 0
-
- def __getitem__(self, key):
+
+ del method, make_simple_escaping_wrapper
+
+
+class _MagicFormatMapping(Mapping):
+ """This class implements a dummy wrapper to fix a bug in the Python
+ standard library for string formatting.
+
+ See http://bugs.python.org/issue13598 for information about why
+ this is necessary.
+ """
+
+ def __init__(self, args, kwargs):
+ self._args = args
+ self._kwargs = kwargs
+ self._last_index = 0
+
+ def __getitem__(self, key):
if key == "":
- idx = self._last_index
- self._last_index += 1
- try:
- return self._args[idx]
- except LookupError:
- pass
- key = str(idx)
- return self._kwargs[key]
-
- def __iter__(self):
- return iter(self._kwargs)
-
- def __len__(self):
- return len(self._kwargs)
-
-
+ idx = self._last_index
+ self._last_index += 1
+ try:
+ return self._args[idx]
+ except LookupError:
+ pass
+ key = str(idx)
+ return self._kwargs[key]
+
+ def __iter__(self):
+ return iter(self._kwargs)
+
+ def __len__(self):
+ return len(self._kwargs)
+
+
if hasattr(text_type, "format"):
- class EscapeFormatter(string.Formatter):
- def __init__(self, escape):
- self.escape = escape
-
- def format_field(self, value, format_spec):
+ class EscapeFormatter(string.Formatter):
+ def __init__(self, escape):
+ self.escape = escape
+
+ def format_field(self, value, format_spec):
if hasattr(value, "__html_format__"):
- rv = value.__html_format__(format_spec)
+ rv = value.__html_format__(format_spec)
elif hasattr(value, "__html__"):
- if format_spec:
+ if format_spec:
raise ValueError(
"Format specifier {0} given, but {1} does not"
" define __html_format__. A class that defines"
" __html__ must define __html_format__ to work"
" with format specifiers.".format(format_spec, type(value))
)
- rv = value.__html__()
- else:
+ rv = value.__html__()
+ else:
# We need to make sure the format spec is unicode here as
# otherwise the wrong callback methods are invoked. For
# instance a byte string there would invoke __str__ and
# not __unicode__.
rv = string.Formatter.format_field(self, value, text_type(format_spec))
- return text_type(self.escape(rv))
-
-
-def _escape_argspec(obj, iterable, escape):
- """Helper for various string-wrapped functions."""
- for key, value in iterable:
+ return text_type(self.escape(rv))
+
+
+def _escape_argspec(obj, iterable, escape):
+ """Helper for various string-wrapped functions."""
+ for key, value in iterable:
if hasattr(value, "__html__") or isinstance(value, string_types):
- obj[key] = escape(value)
- return obj
-
-
-class _MarkupEscapeHelper(object):
- """Helper for Markup.__mod__"""
-
- def __init__(self, obj, escape):
- self.obj = obj
- self.escape = escape
-
+ obj[key] = escape(value)
+ return obj
+
+
+class _MarkupEscapeHelper(object):
+ """Helper for Markup.__mod__"""
+
+ def __init__(self, obj, escape):
+ self.obj = obj
+ self.escape = escape
+
def __getitem__(self, item):
return _MarkupEscapeHelper(self.obj[item], self.escape)
-
+
def __str__(self):
return text_type(self.escape(self.obj))
-
+
__unicode__ = __str__
def __repr__(self):
@@ -315,13 +315,13 @@ class _MarkupEscapeHelper(object):
return float(self.obj)
-# we have to import it down here as the speedups and native
-# modules imports the markup type which is define above.
-try:
+# we have to import it down here as the speedups and native
+# modules imports the markup type which is define above.
+try:
from ._speedups import escape, escape_silent, soft_unicode
-except ImportError:
+except ImportError:
from ._native import escape, escape_silent, soft_unicode
-
-if not PY2:
- soft_str = soft_unicode
+
+if not PY2:
+ soft_str = soft_unicode
__all__.append("soft_str")
diff --git a/contrib/python/MarkupSafe/py2/markupsafe/_compat.py b/contrib/python/MarkupSafe/py2/markupsafe/_compat.py
index 22afe4eda5..bc05090f9e 100644
--- a/contrib/python/MarkupSafe/py2/markupsafe/_compat.py
+++ b/contrib/python/MarkupSafe/py2/markupsafe/_compat.py
@@ -1,31 +1,31 @@
-# -*- coding: utf-8 -*-
-"""
+# -*- coding: utf-8 -*-
+"""
markupsafe._compat
~~~~~~~~~~~~~~~~~~
-
+
:copyright: 2010 Pallets
:license: BSD-3-Clause
-"""
-import sys
-
-PY2 = sys.version_info[0] == 2
-
-if not PY2:
- text_type = str
- string_types = (str,)
- unichr = chr
- int_types = (int,)
+"""
+import sys
+
+PY2 = sys.version_info[0] == 2
+
+if not PY2:
+ text_type = str
+ string_types = (str,)
+ unichr = chr
+ int_types = (int,)
def iteritems(x):
return iter(x.items())
from collections.abc import Mapping
-else:
- text_type = unicode
- string_types = (str, unicode)
- unichr = unichr
- int_types = (int, long)
+else:
+ text_type = unicode
+ string_types = (str, unicode)
+ unichr = unichr
+ int_types = (int, long)
def iteritems(x):
return x.iteritems()
diff --git a/contrib/python/MarkupSafe/py2/markupsafe/_constants.py b/contrib/python/MarkupSafe/py2/markupsafe/_constants.py
index 1a14c3cde1..7c57c2d294 100644
--- a/contrib/python/MarkupSafe/py2/markupsafe/_constants.py
+++ b/contrib/python/MarkupSafe/py2/markupsafe/_constants.py
@@ -1,13 +1,13 @@
-# -*- coding: utf-8 -*-
-"""
+# -*- coding: utf-8 -*-
+"""
markupsafe._constants
~~~~~~~~~~~~~~~~~~~~~
-
+
:copyright: 2010 Pallets
:license: BSD-3-Clause
-"""
-
-HTML_ENTITIES = {
+"""
+
+HTML_ENTITIES = {
"AElig": 198,
"Aacute": 193,
"Acirc": 194,
@@ -261,4 +261,4 @@ HTML_ENTITIES = {
"zeta": 950,
"zwj": 8205,
"zwnj": 8204,
-}
+}
diff --git a/contrib/python/MarkupSafe/py2/markupsafe/_native.py b/contrib/python/MarkupSafe/py2/markupsafe/_native.py
index 773556d290..cd08752cd8 100644
--- a/contrib/python/MarkupSafe/py2/markupsafe/_native.py
+++ b/contrib/python/MarkupSafe/py2/markupsafe/_native.py
@@ -1,18 +1,18 @@
-# -*- coding: utf-8 -*-
-"""
+# -*- coding: utf-8 -*-
+"""
markupsafe._native
~~~~~~~~~~~~~~~~~~
-
+
Native Python implementation used when the C module is not compiled.
-
+
:copyright: 2010 Pallets
:license: BSD-3-Clause
-"""
+"""
from . import Markup
from ._compat import text_type
-
-
-def escape(s):
+
+
+def escape(s):
"""Replace the characters ``&``, ``<``, ``>``, ``'``, and ``"`` in
the string with HTML-safe sequences. Use this if you need to display
text that might contain such characters in HTML.
@@ -22,7 +22,7 @@ def escape(s):
:param s: An object to be converted to a string and escaped.
:return: A :class:`Markup` string with the escaped text.
- """
+ """
if hasattr(s, "__html__"):
return Markup(s.__html__())
return Markup(
@@ -32,10 +32,10 @@ def escape(s):
.replace("<", "&lt;")
.replace("'", "&#39;")
.replace('"', "&#34;")
- )
-
-
-def escape_silent(s):
+ )
+
+
+def escape_silent(s):
"""Like :func:`escape` but treats ``None`` as the empty string.
Useful with optional values, as otherwise you get the string
``'None'`` when the value is ``None``.
@@ -44,13 +44,13 @@ def escape_silent(s):
Markup('None')
>>> escape_silent(None)
Markup('')
- """
- if s is None:
- return Markup()
- return escape(s)
-
-
-def soft_unicode(s):
+ """
+ if s is None:
+ return Markup()
+ return escape(s)
+
+
+def soft_unicode(s):
"""Convert an object to a string if it isn't already. This preserves
a :class:`Markup` string rather than converting it back to a basic
string, so it will still be marked as safe and won't be escaped
@@ -63,7 +63,7 @@ def soft_unicode(s):
Markup('&amp;lt;User 1&amp;gt;')
>>> escape(soft_unicode(value))
Markup('&lt;User 1&gt;')
- """
- if not isinstance(s, text_type):
- s = text_type(s)
- return s
+ """
+ if not isinstance(s, text_type):
+ s = text_type(s)
+ return s
diff --git a/contrib/python/MarkupSafe/py2/markupsafe/_speedups.c b/contrib/python/MarkupSafe/py2/markupsafe/_speedups.c
index 5dc15ddbe7..fabfdc98a1 100644
--- a/contrib/python/MarkupSafe/py2/markupsafe/_speedups.c
+++ b/contrib/python/MarkupSafe/py2/markupsafe/_speedups.c
@@ -1,118 +1,118 @@
-/**
- * markupsafe._speedups
- * ~~~~~~~~~~~~~~~~~~~~
- *
+/**
+ * markupsafe._speedups
+ * ~~~~~~~~~~~~~~~~~~~~
+ *
* C implementation of escaping for better performance. Used instead of
* the native Python implementation when compiled.
- *
+ *
* :copyright: 2010 Pallets
* :license: BSD-3-Clause
- */
-#include <Python.h>
-
+ */
+#include <Python.h>
+
#if PY_MAJOR_VERSION < 3
-#define ESCAPED_CHARS_TABLE_SIZE 63
-#define UNICHR(x) (PyUnicode_AS_UNICODE((PyUnicodeObject*)PyUnicode_DecodeASCII(x, strlen(x), NULL)));
-
+#define ESCAPED_CHARS_TABLE_SIZE 63
+#define UNICHR(x) (PyUnicode_AS_UNICODE((PyUnicodeObject*)PyUnicode_DecodeASCII(x, strlen(x), NULL)));
+
static Py_ssize_t escaped_chars_delta_len[ESCAPED_CHARS_TABLE_SIZE];
static Py_UNICODE *escaped_chars_repl[ESCAPED_CHARS_TABLE_SIZE];
-#endif
-
-static PyObject* markup;
-
-static int
-init_constants(void)
-{
- PyObject *module;
+#endif
+
+static PyObject* markup;
+
+static int
+init_constants(void)
+{
+ PyObject *module;
#if PY_MAJOR_VERSION < 3
/* mapping of characters to replace */
- escaped_chars_repl['"'] = UNICHR("&#34;");
- escaped_chars_repl['\''] = UNICHR("&#39;");
- escaped_chars_repl['&'] = UNICHR("&amp;");
- escaped_chars_repl['<'] = UNICHR("&lt;");
- escaped_chars_repl['>'] = UNICHR("&gt;");
-
- /* lengths of those characters when replaced - 1 */
- memset(escaped_chars_delta_len, 0, sizeof (escaped_chars_delta_len));
- escaped_chars_delta_len['"'] = escaped_chars_delta_len['\''] = \
- escaped_chars_delta_len['&'] = 4;
- escaped_chars_delta_len['<'] = escaped_chars_delta_len['>'] = 3;
+ escaped_chars_repl['"'] = UNICHR("&#34;");
+ escaped_chars_repl['\''] = UNICHR("&#39;");
+ escaped_chars_repl['&'] = UNICHR("&amp;");
+ escaped_chars_repl['<'] = UNICHR("&lt;");
+ escaped_chars_repl['>'] = UNICHR("&gt;");
+
+ /* lengths of those characters when replaced - 1 */
+ memset(escaped_chars_delta_len, 0, sizeof (escaped_chars_delta_len));
+ escaped_chars_delta_len['"'] = escaped_chars_delta_len['\''] = \
+ escaped_chars_delta_len['&'] = 4;
+ escaped_chars_delta_len['<'] = escaped_chars_delta_len['>'] = 3;
#endif
- /* import markup type so that we can mark the return value */
- module = PyImport_ImportModule("markupsafe");
- if (!module)
- return 0;
- markup = PyObject_GetAttrString(module, "Markup");
- Py_DECREF(module);
-
- return 1;
-}
-
+ /* import markup type so that we can mark the return value */
+ module = PyImport_ImportModule("markupsafe");
+ if (!module)
+ return 0;
+ markup = PyObject_GetAttrString(module, "Markup");
+ Py_DECREF(module);
+
+ return 1;
+}
+
#if PY_MAJOR_VERSION < 3
-static PyObject*
-escape_unicode(PyUnicodeObject *in)
-{
- PyUnicodeObject *out;
- Py_UNICODE *inp = PyUnicode_AS_UNICODE(in);
- const Py_UNICODE *inp_end = PyUnicode_AS_UNICODE(in) + PyUnicode_GET_SIZE(in);
- Py_UNICODE *next_escp;
- Py_UNICODE *outp;
- Py_ssize_t delta=0, erepl=0, delta_len=0;
-
- /* First we need to figure out how long the escaped string will be */
- while (*(inp) || inp < inp_end) {
- if (*inp < ESCAPED_CHARS_TABLE_SIZE) {
- delta += escaped_chars_delta_len[*inp];
- erepl += !!escaped_chars_delta_len[*inp];
- }
- ++inp;
- }
-
- /* Do we need to escape anything at all? */
- if (!erepl) {
- Py_INCREF(in);
- return (PyObject*)in;
- }
-
- out = (PyUnicodeObject*)PyUnicode_FromUnicode(NULL, PyUnicode_GET_SIZE(in) + delta);
- if (!out)
- return NULL;
-
- outp = PyUnicode_AS_UNICODE(out);
- inp = PyUnicode_AS_UNICODE(in);
- while (erepl-- > 0) {
- /* look for the next substitution */
- next_escp = inp;
- while (next_escp < inp_end) {
- if (*next_escp < ESCAPED_CHARS_TABLE_SIZE &&
- (delta_len = escaped_chars_delta_len[*next_escp])) {
- ++delta_len;
- break;
- }
- ++next_escp;
- }
-
- if (next_escp > inp) {
- /* copy unescaped chars between inp and next_escp */
- Py_UNICODE_COPY(outp, inp, next_escp-inp);
- outp += next_escp - inp;
- }
-
- /* escape 'next_escp' */
- Py_UNICODE_COPY(outp, escaped_chars_repl[*next_escp], delta_len);
- outp += delta_len;
-
- inp = next_escp + 1;
- }
- if (inp < inp_end)
- Py_UNICODE_COPY(outp, inp, PyUnicode_GET_SIZE(in) - (inp - PyUnicode_AS_UNICODE(in)));
-
- return (PyObject*)out;
-}
+static PyObject*
+escape_unicode(PyUnicodeObject *in)
+{
+ PyUnicodeObject *out;
+ Py_UNICODE *inp = PyUnicode_AS_UNICODE(in);
+ const Py_UNICODE *inp_end = PyUnicode_AS_UNICODE(in) + PyUnicode_GET_SIZE(in);
+ Py_UNICODE *next_escp;
+ Py_UNICODE *outp;
+ Py_ssize_t delta=0, erepl=0, delta_len=0;
+
+ /* First we need to figure out how long the escaped string will be */
+ while (*(inp) || inp < inp_end) {
+ if (*inp < ESCAPED_CHARS_TABLE_SIZE) {
+ delta += escaped_chars_delta_len[*inp];
+ erepl += !!escaped_chars_delta_len[*inp];
+ }
+ ++inp;
+ }
+
+ /* Do we need to escape anything at all? */
+ if (!erepl) {
+ Py_INCREF(in);
+ return (PyObject*)in;
+ }
+
+ out = (PyUnicodeObject*)PyUnicode_FromUnicode(NULL, PyUnicode_GET_SIZE(in) + delta);
+ if (!out)
+ return NULL;
+
+ outp = PyUnicode_AS_UNICODE(out);
+ inp = PyUnicode_AS_UNICODE(in);
+ while (erepl-- > 0) {
+ /* look for the next substitution */
+ next_escp = inp;
+ while (next_escp < inp_end) {
+ if (*next_escp < ESCAPED_CHARS_TABLE_SIZE &&
+ (delta_len = escaped_chars_delta_len[*next_escp])) {
+ ++delta_len;
+ break;
+ }
+ ++next_escp;
+ }
+
+ if (next_escp > inp) {
+ /* copy unescaped chars between inp and next_escp */
+ Py_UNICODE_COPY(outp, inp, next_escp-inp);
+ outp += next_escp - inp;
+ }
+
+ /* escape 'next_escp' */
+ Py_UNICODE_COPY(outp, escaped_chars_repl[*next_escp], delta_len);
+ outp += delta_len;
+
+ inp = next_escp + 1;
+ }
+ if (inp < inp_end)
+ Py_UNICODE_COPY(outp, inp, PyUnicode_GET_SIZE(in) - (inp - PyUnicode_AS_UNICODE(in)));
+
+ return (PyObject*)out;
+}
#else /* PY_MAJOR_VERSION < 3 */
-
+
#define GET_DELTA(inp, inp_end, delta) \
while (inp < inp_end) { \
switch (*inp++) { \
@@ -127,7 +127,7 @@ escape_unicode(PyUnicodeObject *in)
break; \
} \
}
-
+
#define DO_ESCAPE(inp, inp_end, outp) \
{ \
Py_ssize_t ncopy = 0; \
@@ -184,7 +184,7 @@ escape_unicode(PyUnicodeObject *in)
memcpy(outp, inp-ncopy, sizeof(*outp)*ncopy); \
}
-static PyObject*
+static PyObject*
escape_unicode_kind1(PyUnicodeObject *in)
{
Py_UCS1 *inp = PyUnicode_1BYTE_DATA(in);
@@ -281,11 +281,11 @@ escape_unicode(PyUnicodeObject *in)
#endif /* PY_MAJOR_VERSION < 3 */
static PyObject*
-escape(PyObject *self, PyObject *text)
-{
+escape(PyObject *self, PyObject *text)
+{
static PyObject *id_html;
- PyObject *s = NULL, *rv = NULL, *html;
-
+ PyObject *s = NULL, *rv = NULL, *html;
+
if (id_html == NULL) {
#if PY_MAJOR_VERSION < 3
id_html = PyString_InternFromString("__html__");
@@ -297,127 +297,127 @@ escape(PyObject *self, PyObject *text)
}
}
- /* we don't have to escape integers, bools or floats */
- if (PyLong_CheckExact(text) ||
-#if PY_MAJOR_VERSION < 3
- PyInt_CheckExact(text) ||
-#endif
- PyFloat_CheckExact(text) || PyBool_Check(text) ||
- text == Py_None)
- return PyObject_CallFunctionObjArgs(markup, text, NULL);
-
- /* if the object has an __html__ method that performs the escaping */
+ /* we don't have to escape integers, bools or floats */
+ if (PyLong_CheckExact(text) ||
+#if PY_MAJOR_VERSION < 3
+ PyInt_CheckExact(text) ||
+#endif
+ PyFloat_CheckExact(text) || PyBool_Check(text) ||
+ text == Py_None)
+ return PyObject_CallFunctionObjArgs(markup, text, NULL);
+
+ /* if the object has an __html__ method that performs the escaping */
html = PyObject_GetAttr(text ,id_html);
- if (html) {
+ if (html) {
s = PyObject_CallObject(html, NULL);
- Py_DECREF(html);
+ Py_DECREF(html);
if (s == NULL) {
return NULL;
}
/* Convert to Markup object */
rv = PyObject_CallFunctionObjArgs(markup, (PyObject*)s, NULL);
Py_DECREF(s);
- return rv;
- }
-
- /* otherwise make the object unicode if it isn't, then escape */
- PyErr_Clear();
- if (!PyUnicode_Check(text)) {
-#if PY_MAJOR_VERSION < 3
- PyObject *unicode = PyObject_Unicode(text);
-#else
- PyObject *unicode = PyObject_Str(text);
-#endif
- if (!unicode)
- return NULL;
- s = escape_unicode((PyUnicodeObject*)unicode);
- Py_DECREF(unicode);
- }
- else
- s = escape_unicode((PyUnicodeObject*)text);
-
- /* convert the unicode string into a markup object. */
- rv = PyObject_CallFunctionObjArgs(markup, (PyObject*)s, NULL);
- Py_DECREF(s);
- return rv;
-}
-
-
-static PyObject*
-escape_silent(PyObject *self, PyObject *text)
-{
- if (text != Py_None)
- return escape(self, text);
- return PyObject_CallFunctionObjArgs(markup, NULL);
-}
-
-
-static PyObject*
-soft_unicode(PyObject *self, PyObject *s)
-{
- if (!PyUnicode_Check(s))
-#if PY_MAJOR_VERSION < 3
- return PyObject_Unicode(s);
-#else
- return PyObject_Str(s);
-#endif
- Py_INCREF(s);
- return s;
-}
-
-
-static PyMethodDef module_methods[] = {
- {"escape", (PyCFunction)escape, METH_O,
- "escape(s) -> markup\n\n"
- "Convert the characters &, <, >, ', and \" in string s to HTML-safe\n"
- "sequences. Use this if you need to display text that might contain\n"
- "such characters in HTML. Marks return value as markup string."},
- {"escape_silent", (PyCFunction)escape_silent, METH_O,
- "escape_silent(s) -> markup\n\n"
- "Like escape but converts None to an empty string."},
- {"soft_unicode", (PyCFunction)soft_unicode, METH_O,
- "soft_unicode(object) -> string\n\n"
- "Make a string unicode if it isn't already. That way a markup\n"
- "string is not converted back to unicode."},
- {NULL, NULL, 0, NULL} /* Sentinel */
-};
-
-
-#if PY_MAJOR_VERSION < 3
-
-#ifndef PyMODINIT_FUNC /* declarations for DLL import/export */
-#define PyMODINIT_FUNC void
-#endif
-PyMODINIT_FUNC
+ return rv;
+ }
+
+ /* otherwise make the object unicode if it isn't, then escape */
+ PyErr_Clear();
+ if (!PyUnicode_Check(text)) {
+#if PY_MAJOR_VERSION < 3
+ PyObject *unicode = PyObject_Unicode(text);
+#else
+ PyObject *unicode = PyObject_Str(text);
+#endif
+ if (!unicode)
+ return NULL;
+ s = escape_unicode((PyUnicodeObject*)unicode);
+ Py_DECREF(unicode);
+ }
+ else
+ s = escape_unicode((PyUnicodeObject*)text);
+
+ /* convert the unicode string into a markup object. */
+ rv = PyObject_CallFunctionObjArgs(markup, (PyObject*)s, NULL);
+ Py_DECREF(s);
+ return rv;
+}
+
+
+static PyObject*
+escape_silent(PyObject *self, PyObject *text)
+{
+ if (text != Py_None)
+ return escape(self, text);
+ return PyObject_CallFunctionObjArgs(markup, NULL);
+}
+
+
+static PyObject*
+soft_unicode(PyObject *self, PyObject *s)
+{
+ if (!PyUnicode_Check(s))
+#if PY_MAJOR_VERSION < 3
+ return PyObject_Unicode(s);
+#else
+ return PyObject_Str(s);
+#endif
+ Py_INCREF(s);
+ return s;
+}
+
+
+static PyMethodDef module_methods[] = {
+ {"escape", (PyCFunction)escape, METH_O,
+ "escape(s) -> markup\n\n"
+ "Convert the characters &, <, >, ', and \" in string s to HTML-safe\n"
+ "sequences. Use this if you need to display text that might contain\n"
+ "such characters in HTML. Marks return value as markup string."},
+ {"escape_silent", (PyCFunction)escape_silent, METH_O,
+ "escape_silent(s) -> markup\n\n"
+ "Like escape but converts None to an empty string."},
+ {"soft_unicode", (PyCFunction)soft_unicode, METH_O,
+ "soft_unicode(object) -> string\n\n"
+ "Make a string unicode if it isn't already. That way a markup\n"
+ "string is not converted back to unicode."},
+ {NULL, NULL, 0, NULL} /* Sentinel */
+};
+
+
+#if PY_MAJOR_VERSION < 3
+
+#ifndef PyMODINIT_FUNC /* declarations for DLL import/export */
+#define PyMODINIT_FUNC void
+#endif
+PyMODINIT_FUNC
init10markupsafe9_speedups(void)
-{
- if (!init_constants())
- return;
-
- Py_InitModule3("markupsafe._speedups", module_methods, "");
-}
-
-#else /* Python 3.x module initialization */
-
-static struct PyModuleDef module_definition = {
- PyModuleDef_HEAD_INIT,
- "markupsafe._speedups",
- NULL,
- -1,
- module_methods,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-PyMODINIT_FUNC
+{
+ if (!init_constants())
+ return;
+
+ Py_InitModule3("markupsafe._speedups", module_methods, "");
+}
+
+#else /* Python 3.x module initialization */
+
+static struct PyModuleDef module_definition = {
+ PyModuleDef_HEAD_INIT,
+ "markupsafe._speedups",
+ NULL,
+ -1,
+ module_methods,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
+PyMODINIT_FUNC
PyInit_10markupsafe9_speedups(void)
-{
- if (!init_constants())
- return NULL;
-
- return PyModule_Create(&module_definition);
-}
-
-#endif
+{
+ if (!init_constants())
+ return NULL;
+
+ return PyModule_Create(&module_definition);
+}
+
+#endif
diff --git a/contrib/python/MarkupSafe/py2/ya.make b/contrib/python/MarkupSafe/py2/ya.make
index c70ee05cad..0e773ee33a 100644
--- a/contrib/python/MarkupSafe/py2/ya.make
+++ b/contrib/python/MarkupSafe/py2/ya.make
@@ -1,19 +1,19 @@
OWNER(g:python-contrib)
-
+
PY2_LIBRARY()
-
+
LICENSE(BSD-3-Clause)
VERSION(1.1.1)
-PY_SRCS(
- TOP_LEVEL
- markupsafe/_compat.py
- markupsafe/_constants.py
- markupsafe/__init__.py
- markupsafe/_native.py
-)
-
+PY_SRCS(
+ TOP_LEVEL
+ markupsafe/_compat.py
+ markupsafe/_constants.py
+ markupsafe/__init__.py
+ markupsafe/_native.py
+)
+
#SRCS(
# markupsafe/_speedups.c
#)
@@ -32,7 +32,7 @@ RESOURCE_FILES(
.dist-info/top_level.txt
)
-END()
+END()
RECURSE_FOR_TESTS(
tests
diff --git a/contrib/python/MarkupSafe/py3/markupsafe/__init__.py b/contrib/python/MarkupSafe/py3/markupsafe/__init__.py
index 85bbf45363..d331ac3622 100644
--- a/contrib/python/MarkupSafe/py3/markupsafe/__init__.py
+++ b/contrib/python/MarkupSafe/py3/markupsafe/__init__.py
@@ -1,21 +1,21 @@
import functools
-import re
-import string
+import re
+import string
import typing as t
-
+
if t.TYPE_CHECKING:
import typing_extensions as te
-
+
class HasHTML(te.Protocol):
def __html__(self) -> str:
pass
-
-
+
+
__version__ = "2.0.1"
_striptags_re = re.compile(r"(<!--.*?-->|<[^>]*>)")
-
-
+
+
def _simple_escaping_wrapper(name: str) -> t.Callable[..., "Markup"]:
orig = getattr(str, name)
@@ -32,18 +32,18 @@ class Markup(str):
"""A string that is ready to be safely inserted into an HTML or XML
document, either because it was escaped or because it was marked
safe.
-
+
Passing an object to the constructor converts it to text and wraps
it to mark it safe without escaping. To escape the text, use the
:meth:`escape` class method instead.
-
+
>>> Markup("Hello, <em>World</em>!")
Markup('Hello, <em>World</em>!')
>>> Markup(42)
Markup('42')
>>> Markup.escape("Hello, <em>World</em>!")
Markup('Hello &lt;em&gt;World&lt;/em&gt;!')
-
+
This implements the ``__html__()`` interface that some frameworks
use. Passing an object that implements ``__html__()`` will wrap the
output of that method, marking it safe.
@@ -51,46 +51,46 @@ class Markup(str):
>>> class Foo:
... def __html__(self):
... return '<a href="/foo">foo</a>'
- ...
- >>> Markup(Foo())
+ ...
+ >>> Markup(Foo())
Markup('<a href="/foo">foo</a>')
-
+
This is a subclass of :class:`str`. It has the same methods, but
escapes their arguments and returns a ``Markup`` instance.
-
+
>>> Markup("<em>%s</em>") % ("foo & bar",)
Markup('<em>foo &amp; bar</em>')
>>> Markup("<em>Hello</em> ") + "<foo>"
Markup('<em>Hello</em> &lt;foo&gt;')
"""
-
- __slots__ = ()
-
+
+ __slots__ = ()
+
def __new__(
cls, base: t.Any = "", encoding: t.Optional[str] = None, errors: str = "strict"
) -> "Markup":
if hasattr(base, "__html__"):
- base = base.__html__()
+ base = base.__html__()
- if encoding is None:
+ if encoding is None:
return super().__new__(cls, base)
-
+
return super().__new__(cls, base, encoding, errors)
def __html__(self) -> "Markup":
- return self
-
+ return self
+
def __add__(self, other: t.Union[str, "HasHTML"]) -> "Markup":
if isinstance(other, str) or hasattr(other, "__html__"):
return self.__class__(super().__add__(self.escape(other)))
- return NotImplemented
-
+ return NotImplemented
+
def __radd__(self, other: t.Union[str, "HasHTML"]) -> "Markup":
if isinstance(other, str) or hasattr(other, "__html__"):
- return self.escape(other).__add__(self)
-
- return NotImplemented
+ return self.escape(other).__add__(self)
+
+ return NotImplemented
def __mul__(self, num: int) -> "Markup":
if isinstance(num, int):
@@ -98,50 +98,50 @@ class Markup(str):
return NotImplemented # type: ignore
- __rmul__ = __mul__
-
+ __rmul__ = __mul__
+
def __mod__(self, arg: t.Any) -> "Markup":
- if isinstance(arg, tuple):
- arg = tuple(_MarkupEscapeHelper(x, self.escape) for x in arg)
- else:
- arg = _MarkupEscapeHelper(arg, self.escape)
-
+ if isinstance(arg, tuple):
+ arg = tuple(_MarkupEscapeHelper(x, self.escape) for x in arg)
+ else:
+ arg = _MarkupEscapeHelper(arg, self.escape)
+
return self.__class__(super().__mod__(arg))
-
+
def __repr__(self) -> str:
return f"{self.__class__.__name__}({super().__repr__()})"
def join(self, seq: t.Iterable[t.Union[str, "HasHTML"]]) -> "Markup":
return self.__class__(super().join(map(self.escape, seq)))
-
+
join.__doc__ = str.join.__doc__
def split( # type: ignore
self, sep: t.Optional[str] = None, maxsplit: int = -1
) -> t.List["Markup"]:
return [self.__class__(v) for v in super().split(sep, maxsplit)]
-
+
split.__doc__ = str.split.__doc__
def rsplit( # type: ignore
self, sep: t.Optional[str] = None, maxsplit: int = -1
) -> t.List["Markup"]:
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
return [self.__class__(v) for v in super().splitlines(keepends)]
-
+
splitlines.__doc__ = str.splitlines.__doc__
def unescape(self) -> str:
"""Convert escaped markup back into a text string. This replaces
HTML entities with the characters they represent.
-
+
>>> Markup("Main &raquo; <em>About</em>").unescape()
'Main » <em>About</em>'
- """
+ """
from html import unescape
return unescape(str(self))
@@ -149,25 +149,25 @@ class Markup(str):
def striptags(self) -> str:
""":meth:`unescape` the markup, remove tags, and normalize
whitespace to single spaces.
-
+
>>> Markup("Main &raquo;\t<em>About</em>").striptags()
'Main » About'
- """
+ """
stripped = " ".join(_striptags_re.sub("", self).split())
- return Markup(stripped).unescape()
-
- @classmethod
+ return Markup(stripped).unescape()
+
+ @classmethod
def escape(cls, s: t.Any) -> "Markup":
"""Escape a string. Calls :func:`escape` and ensures that for
subclasses the correct type is returned.
- """
- rv = escape(s)
+ """
+ rv = escape(s)
+
+ if rv.__class__ is not cls:
+ return cls(rv)
- if rv.__class__ is not cls:
- return cls(rv)
+ return rv
- return rv
-
for method in (
"__getitem__",
"capitalize",
@@ -187,14 +187,14 @@ class Markup(str):
"zfill",
):
locals()[method] = _simple_escaping_wrapper(method)
-
+
del method
-
+
def partition(self, sep: str) -> t.Tuple["Markup", "Markup", "Markup"]:
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"]:
l, s, r = super().rpartition(self.escape(sep))
cls = self.__class__
@@ -203,21 +203,21 @@ class Markup(str):
def format(self, *args: t.Any, **kwargs: t.Any) -> "Markup":
formatter = EscapeFormatter(self.escape)
return self.__class__(formatter.vformat(self, args, kwargs))
-
+
def __html_format__(self, format_spec: str) -> "Markup":
if format_spec:
raise ValueError("Unsupported format specification for Markup.")
return self
-
+
class EscapeFormatter(string.Formatter):
__slots__ = ("escape",)
-
+
def __init__(self, escape: t.Callable[[t.Any], Markup]) -> None:
self.escape = escape
super().__init__()
-
+
def format_field(self, value: t.Any, format_spec: str) -> str:
if hasattr(value, "__html_format__"):
rv = value.__html_format__(format_spec)
@@ -234,37 +234,37 @@ class EscapeFormatter(string.Formatter):
# otherwise the wrong callback methods are invoked.
rv = string.Formatter.format_field(self, value, str(format_spec))
return str(self.escape(rv))
-
-
+
+
_ListOrDict = t.TypeVar("_ListOrDict", list, dict)
-
-
+
+
def _escape_argspec(
obj: _ListOrDict, iterable: t.Iterable[t.Any], escape: t.Callable[[t.Any], Markup]
) -> _ListOrDict:
- """Helper for various string-wrapped functions."""
- for key, value in iterable:
+ """Helper for various string-wrapped functions."""
+ for key, value in iterable:
if isinstance(value, str) or hasattr(value, "__html__"):
- obj[key] = escape(value)
+ obj[key] = escape(value)
+
+ return obj
+
- return obj
-
-
class _MarkupEscapeHelper:
"""Helper for :meth:`Markup.__mod__`."""
-
+
__slots__ = ("obj", "escape")
def __init__(self, obj: t.Any, escape: t.Callable[[t.Any], Markup]) -> None:
- self.obj = obj
- self.escape = escape
-
+ self.obj = obj
+ self.escape = escape
+
def __getitem__(self, item: t.Any) -> "_MarkupEscapeHelper":
return _MarkupEscapeHelper(self.obj[item], self.escape)
-
+
def __str__(self) -> str:
return str(self.escape(self.obj))
-
+
def __repr__(self) -> str:
return str(self.escape(repr(self.obj)))
@@ -276,12 +276,12 @@ class _MarkupEscapeHelper:
# circular import
-try:
+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:
+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
diff --git a/contrib/python/MarkupSafe/py3/markupsafe/_native.py b/contrib/python/MarkupSafe/py3/markupsafe/_native.py
index 8d5e144bbc..6f7eb7a8cb 100644
--- a/contrib/python/MarkupSafe/py3/markupsafe/_native.py
+++ b/contrib/python/MarkupSafe/py3/markupsafe/_native.py
@@ -1,8 +1,8 @@
import typing as t
-
+
from . import Markup
-
-
+
+
def escape(s: t.Any) -> Markup:
"""Replace the characters ``&``, ``<``, ``>``, ``'``, and ``"`` in
the string with HTML-safe sequences. Use this if you need to display
@@ -13,7 +13,7 @@ def escape(s: t.Any) -> Markup:
:param s: An object to be converted to a string and escaped.
:return: A :class:`Markup` string with the escaped text.
- """
+ """
if hasattr(s, "__html__"):
return Markup(s.__html__())
@@ -24,9 +24,9 @@ def escape(s: t.Any) -> Markup:
.replace("<", "&lt;")
.replace("'", "&#39;")
.replace('"', "&#34;")
- )
-
-
+ )
+
+
def escape_silent(s: t.Optional[t.Any]) -> Markup:
"""Like :func:`escape` but treats ``None`` as the empty string.
Useful with optional values, as otherwise you get the string
@@ -36,13 +36,13 @@ def escape_silent(s: t.Optional[t.Any]) -> Markup:
Markup('None')
>>> escape_silent(None)
Markup('')
- """
- if s is None:
- return Markup()
+ """
+ if s is None:
+ return Markup()
+
+ return escape(s)
+
- return escape(s)
-
-
def soft_str(s: t.Any) -> str:
"""Convert an object to a string if it isn't already. This preserves
a :class:`Markup` string rather than converting it back to a basic
@@ -56,11 +56,11 @@ def soft_str(s: t.Any) -> str:
Markup('&amp;lt;User 1&amp;gt;')
>>> escape(soft_str(value))
Markup('&lt;User 1&gt;')
- """
+ """
if not isinstance(s, str):
return str(s)
- return s
+ return s
def soft_unicode(s: t.Any) -> str:
diff --git a/contrib/python/MarkupSafe/py3/markupsafe/_speedups.c b/contrib/python/MarkupSafe/py3/markupsafe/_speedups.c
index b56cd6bee1..44967b1fdc 100644
--- a/contrib/python/MarkupSafe/py3/markupsafe/_speedups.c
+++ b/contrib/python/MarkupSafe/py3/markupsafe/_speedups.c
@@ -1,22 +1,22 @@
-#include <Python.h>
-
-static PyObject* markup;
-
-static int
-init_constants(void)
-{
- PyObject *module;
-
- /* import markup type so that we can mark the return value */
- module = PyImport_ImportModule("markupsafe");
- if (!module)
- return 0;
- markup = PyObject_GetAttrString(module, "Markup");
- Py_DECREF(module);
-
- return 1;
-}
-
+#include <Python.h>
+
+static PyObject* markup;
+
+static int
+init_constants(void)
+{
+ PyObject *module;
+
+ /* import markup type so that we can mark the return value */
+ module = PyImport_ImportModule("markupsafe");
+ if (!module)
+ return 0;
+ markup = PyObject_GetAttrString(module, "Markup");
+ Py_DECREF(module);
+
+ return 1;
+}
+
#define GET_DELTA(inp, inp_end, delta) \
while (inp < inp_end) { \
switch (*inp++) { \
@@ -31,7 +31,7 @@ init_constants(void)
break; \
} \
}
-
+
#define DO_ESCAPE(inp, inp_end, outp) \
{ \
Py_ssize_t ncopy = 0; \
@@ -88,7 +88,7 @@ init_constants(void)
memcpy(outp, inp-ncopy, sizeof(*outp)*ncopy); \
}
-static PyObject*
+static PyObject*
escape_unicode_kind1(PyUnicodeObject *in)
{
Py_UCS1 *inp = PyUnicode_1BYTE_DATA(in);
@@ -184,11 +184,11 @@ escape_unicode(PyUnicodeObject *in)
}
static PyObject*
-escape(PyObject *self, PyObject *text)
-{
+escape(PyObject *self, PyObject *text)
+{
static PyObject *id_html;
- PyObject *s = NULL, *rv = NULL, *html;
-
+ PyObject *s = NULL, *rv = NULL, *html;
+
if (id_html == NULL) {
id_html = PyUnicode_InternFromString("__html__");
if (id_html == NULL) {
@@ -196,67 +196,67 @@ escape(PyObject *self, PyObject *text)
}
}
- /* we don't have to escape integers, bools or floats */
- if (PyLong_CheckExact(text) ||
+ /* we don't have to escape integers, bools or floats */
+ if (PyLong_CheckExact(text) ||
PyFloat_CheckExact(text) || PyBool_Check(text) ||
text == Py_None)
- return PyObject_CallFunctionObjArgs(markup, text, NULL);
-
- /* if the object has an __html__ method that performs the escaping */
+ return PyObject_CallFunctionObjArgs(markup, text, NULL);
+
+ /* if the object has an __html__ method that performs the escaping */
html = PyObject_GetAttr(text ,id_html);
- if (html) {
+ if (html) {
s = PyObject_CallObject(html, NULL);
- Py_DECREF(html);
+ Py_DECREF(html);
if (s == NULL) {
return NULL;
}
/* Convert to Markup object */
rv = PyObject_CallFunctionObjArgs(markup, (PyObject*)s, NULL);
Py_DECREF(s);
- return rv;
- }
-
- /* otherwise make the object unicode if it isn't, then escape */
- PyErr_Clear();
- if (!PyUnicode_Check(text)) {
- PyObject *unicode = PyObject_Str(text);
- if (!unicode)
- return NULL;
- s = escape_unicode((PyUnicodeObject*)unicode);
- Py_DECREF(unicode);
- }
- else
- s = escape_unicode((PyUnicodeObject*)text);
-
- /* convert the unicode string into a markup object. */
- rv = PyObject_CallFunctionObjArgs(markup, (PyObject*)s, NULL);
- Py_DECREF(s);
- return rv;
-}
-
-
-static PyObject*
-escape_silent(PyObject *self, PyObject *text)
-{
- if (text != Py_None)
- return escape(self, text);
- return PyObject_CallFunctionObjArgs(markup, NULL);
-}
-
-
-static PyObject*
+ return rv;
+ }
+
+ /* otherwise make the object unicode if it isn't, then escape */
+ PyErr_Clear();
+ if (!PyUnicode_Check(text)) {
+ PyObject *unicode = PyObject_Str(text);
+ if (!unicode)
+ return NULL;
+ s = escape_unicode((PyUnicodeObject*)unicode);
+ Py_DECREF(unicode);
+ }
+ else
+ s = escape_unicode((PyUnicodeObject*)text);
+
+ /* convert the unicode string into a markup object. */
+ rv = PyObject_CallFunctionObjArgs(markup, (PyObject*)s, NULL);
+ Py_DECREF(s);
+ return rv;
+}
+
+
+static PyObject*
+escape_silent(PyObject *self, PyObject *text)
+{
+ if (text != Py_None)
+ return escape(self, text);
+ return PyObject_CallFunctionObjArgs(markup, NULL);
+}
+
+
+static PyObject*
soft_str(PyObject *self, PyObject *s)
-{
- if (!PyUnicode_Check(s))
- return PyObject_Str(s);
- Py_INCREF(s);
- return s;
-}
-
-
+{
+ if (!PyUnicode_Check(s))
+ return PyObject_Str(s);
+ Py_INCREF(s);
+ return s;
+}
+
+
static PyObject*
soft_unicode(PyObject *self, PyObject *s)
-{
+{
PyErr_WarnEx(
PyExc_DeprecationWarning,
"'soft_unicode' has been renamed to 'soft_str'. The old name"
@@ -264,9 +264,9 @@ soft_unicode(PyObject *self, PyObject *s)
2
);
return soft_str(self, s);
-}
-
-
+}
+
+
static PyMethodDef module_methods[] = {
{
"escape",
@@ -317,23 +317,23 @@ static PyMethodDef module_methods[] = {
{NULL, NULL, 0, NULL} /* Sentinel */
};
-static struct PyModuleDef module_definition = {
+static struct PyModuleDef module_definition = {
PyModuleDef_HEAD_INIT,
- "markupsafe._speedups",
- NULL,
- -1,
- module_methods,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-PyMODINIT_FUNC
+ "markupsafe._speedups",
+ NULL,
+ -1,
+ module_methods,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
+PyMODINIT_FUNC
PyInit__speedups(void)
-{
- if (!init_constants())
- return NULL;
-
- return PyModule_Create(&module_definition);
-}
+{
+ if (!init_constants())
+ return NULL;
+
+ return PyModule_Create(&module_definition);
+}
diff --git a/contrib/python/MarkupSafe/py3/ya.make b/contrib/python/MarkupSafe/py3/ya.make
index d4344875f6..8c750e15d8 100644
--- a/contrib/python/MarkupSafe/py3/ya.make
+++ b/contrib/python/MarkupSafe/py3/ya.make
@@ -1,13 +1,13 @@
# Generated by devtools/yamaker (pypi).
-
+
PY3_LIBRARY()
-
+
OWNER(g:python-contrib)
VERSION(2.0.1)
LICENSE(BSD-3-Clause)
-
+
NO_COMPILER_WARNINGS()
NO_LINT()
@@ -34,7 +34,7 @@ RESOURCE_FILES(
markupsafe/py.typed
)
-END()
+END()
RECURSE_FOR_TESTS(
tests
diff --git a/contrib/python/MarkupSafe/ya.make b/contrib/python/MarkupSafe/ya.make
index 9d9fbbb37b..764b5915ff 100644
--- a/contrib/python/MarkupSafe/ya.make
+++ b/contrib/python/MarkupSafe/ya.make
@@ -1,5 +1,5 @@
PY23_LIBRARY()
-
+
LICENSE(Service-Py23-Proxy)
OWNER(g:python-contrib)
@@ -9,10 +9,10 @@ IF (PYTHON2)
ELSE()
PEERDIR(contrib/python/MarkupSafe/py3)
ENDIF()
-
+
NO_LINT()
-END()
+END()
RECURSE(
py2
diff --git a/contrib/python/tornado/ya.make b/contrib/python/tornado/ya.make
index 5f8e742716..85a91fb7c1 100644
--- a/contrib/python/tornado/ya.make
+++ b/contrib/python/tornado/ya.make
@@ -17,4 +17,4 @@ END()
RECURSE(
tornado-4
tornado-6
-)
+)
diff --git a/library/cpp/http/server/response.h b/library/cpp/http/server/response.h
index 65e941ba3d..a75cb85605 100644
--- a/library/cpp/http/server/response.h
+++ b/library/cpp/http/server/response.h
@@ -64,10 +64,10 @@ public:
return SetContent(content).SetContentType(contentType);
}
- HttpCodes HttpCode() const {
- return Code;
- }
-
+ HttpCodes HttpCode() const {
+ return Code;
+ }
+
THttpResponse& SetHttpCode(HttpCodes code) {
Code = code;
return *this;
diff --git a/library/cpp/string_utils/parse_size/parse_size.cpp b/library/cpp/string_utils/parse_size/parse_size.cpp
index 57c4c9c3a9..39188d560b 100644
--- a/library/cpp/string_utils/parse_size/parse_size.cpp
+++ b/library/cpp/string_utils/parse_size/parse_size.cpp
@@ -1,10 +1,10 @@
-#include "parse_size.h"
-
-#include <util/generic/yexception.h>
-#include <util/generic/ylimits.h>
+#include "parse_size.h"
+
+#include <util/generic/yexception.h>
+#include <util/generic/ylimits.h>
#include <util/string/cast.h>
#include <util/stream/output.h>
-
+
namespace {
enum ESuffixShifts {
ESS_KILO_BYTES = 10,
@@ -64,16 +64,16 @@ namespace NSize {
} else {
return value;
}
- }
-
+ }
+
TSize FromKiloBytes(ui64 value) {
return TSize(ShiftValue(value, ESS_KILO_BYTES));
}
-
+
TSize FromMegaBytes(ui64 value) {
return TSize(ShiftValue(value, ESS_MEGA_BYTES));
- }
-
+ }
+
TSize FromGigaBytes(ui64 value) {
return TSize(ShiftValue(value, ESS_GIGA_BYTES));
}
diff --git a/library/cpp/string_utils/parse_size/parse_size.h b/library/cpp/string_utils/parse_size/parse_size.h
index 6ce20ca8d4..ad235ef02f 100644
--- a/library/cpp/string_utils/parse_size/parse_size.h
+++ b/library/cpp/string_utils/parse_size/parse_size.h
@@ -1,7 +1,7 @@
-#pragma once
-
-#include <util/generic/strbuf.h>
-
+#pragma once
+
+#include <util/generic/strbuf.h>
+
namespace NSize {
ui64 ParseSize(TStringBuf size);
diff --git a/library/cpp/string_utils/parse_size/parse_size_ut.cpp b/library/cpp/string_utils/parse_size/parse_size_ut.cpp
index a30b9e77be..8fff4f56b2 100644
--- a/library/cpp/string_utils/parse_size/parse_size_ut.cpp
+++ b/library/cpp/string_utils/parse_size/parse_size_ut.cpp
@@ -1,48 +1,48 @@
-#include "parse_size.h"
-
+#include "parse_size.h"
+
#include <library/cpp/testing/unittest/registar.h>
-
+
using namespace NSize;
-class TParseSizeTest: public TTestBase {
- UNIT_TEST_SUITE(TParseSizeTest);
-
- UNIT_TEST(TestPlain);
- UNIT_TEST(TestKiloBytes);
- UNIT_TEST(TestMegaBytes);
- UNIT_TEST(TestGigaBytes);
- UNIT_TEST(TestTeraBytes);
+class TParseSizeTest: public TTestBase {
+ UNIT_TEST_SUITE(TParseSizeTest);
+
+ UNIT_TEST(TestPlain);
+ UNIT_TEST(TestKiloBytes);
+ UNIT_TEST(TestMegaBytes);
+ UNIT_TEST(TestGigaBytes);
+ UNIT_TEST(TestTeraBytes);
UNIT_TEST(TestOverflow);
UNIT_TEST(TestStaticCreators);
UNIT_TEST(TestToString);
-
- UNIT_TEST_SUITE_END();
-
-private:
- void TestPlain() {
- UNIT_ASSERT(ParseSize("1024") == 1024);
- }
-
- void TestKiloBytes() {
- UNIT_ASSERT(ParseSize("10K") == 1024 * 10);
- UNIT_ASSERT(ParseSize("10k") == 1024 * 10);
- }
-
- void TestMegaBytes() {
- UNIT_ASSERT(ParseSize("10M") == 1024 * 1024 * 10);
- UNIT_ASSERT(ParseSize("10m") == 1024 * 1024 * 10);
- }
-
- void TestGigaBytes() {
- UNIT_ASSERT(ParseSize("10G") == 1024ul * 1024ul * 1024ul * 10ul);
- UNIT_ASSERT(ParseSize("10g") == 1024ul * 1024ul * 1024ul * 10ul);
- }
-
- void TestTeraBytes() {
- UNIT_ASSERT(ParseSize("10T") == 1024ul * 1024ul * 1024ul * 1024ul * 10ul);
- UNIT_ASSERT(ParseSize("10t") == 1024ul * 1024ul * 1024ul * 1024ul * 10ul);
- }
-
+
+ UNIT_TEST_SUITE_END();
+
+private:
+ void TestPlain() {
+ UNIT_ASSERT(ParseSize("1024") == 1024);
+ }
+
+ void TestKiloBytes() {
+ UNIT_ASSERT(ParseSize("10K") == 1024 * 10);
+ UNIT_ASSERT(ParseSize("10k") == 1024 * 10);
+ }
+
+ void TestMegaBytes() {
+ UNIT_ASSERT(ParseSize("10M") == 1024 * 1024 * 10);
+ UNIT_ASSERT(ParseSize("10m") == 1024 * 1024 * 10);
+ }
+
+ void TestGigaBytes() {
+ UNIT_ASSERT(ParseSize("10G") == 1024ul * 1024ul * 1024ul * 10ul);
+ UNIT_ASSERT(ParseSize("10g") == 1024ul * 1024ul * 1024ul * 10ul);
+ }
+
+ void TestTeraBytes() {
+ UNIT_ASSERT(ParseSize("10T") == 1024ul * 1024ul * 1024ul * 1024ul * 10ul);
+ UNIT_ASSERT(ParseSize("10t") == 1024ul * 1024ul * 1024ul * 1024ul * 10ul);
+ }
+
void TestStaticCreators() {
UNIT_ASSERT_EQUAL(FromKiloBytes(10), 1024ul * 10ul);
UNIT_ASSERT_EQUAL(FromMegaBytes(10), 1024ul * 1024ul * 10ul);
@@ -58,6 +58,6 @@ private:
void TestToString() {
UNIT_ASSERT_VALUES_EQUAL(ToString(FromKiloBytes(1)), TString("1024"));
}
-};
-
-UNIT_TEST_SUITE_REGISTRATION(TParseSizeTest);
+};
+
+UNIT_TEST_SUITE_REGISTRATION(TParseSizeTest);
diff --git a/library/cpp/string_utils/parse_size/ut/ya.make b/library/cpp/string_utils/parse_size/ut/ya.make
index 9b9e9f111e..da19cf025b 100644
--- a/library/cpp/string_utils/parse_size/ut/ya.make
+++ b/library/cpp/string_utils/parse_size/ut/ya.make
@@ -1,9 +1,9 @@
UNITTEST_FOR(library/cpp/string_utils/parse_size)
-
+
OWNER(g:images-robot)
-
-SRCS(
- parse_size_ut.cpp
-)
-
-END()
+
+SRCS(
+ parse_size_ut.cpp
+)
+
+END()
diff --git a/library/cpp/string_utils/parse_size/ya.make b/library/cpp/string_utils/parse_size/ya.make
index e003f15761..4a62abcac2 100644
--- a/library/cpp/string_utils/parse_size/ya.make
+++ b/library/cpp/string_utils/parse_size/ya.make
@@ -1,10 +1,10 @@
-LIBRARY()
-
+LIBRARY()
+
OWNER(g:images-robot)
-
-SRCS(
- parse_size.cpp
- parse_size.h
-)
-
-END()
+
+SRCS(
+ parse_size.cpp
+ parse_size.h
+)
+
+END()
diff --git a/util/generic/buffer.cpp b/util/generic/buffer.cpp
index ef2b4b740a..b92697e1d0 100644
--- a/util/generic/buffer.cpp
+++ b/util/generic/buffer.cpp
@@ -31,19 +31,19 @@ TBuffer::TBuffer(const char* buf, size_t len)
}
TBuffer& TBuffer::operator=(TBuffer&& b) noexcept {
- y_deallocate(Data_);
-
- Data_ = b.Data_;
- Len_ = b.Len_;
- Pos_ = b.Pos_;
-
- b.Data_ = nullptr;
- b.Len_ = 0;
- b.Pos_ = 0;
-
- return *this;
-}
-
+ y_deallocate(Data_);
+
+ Data_ = b.Data_;
+ Len_ = b.Len_;
+ Pos_ = b.Pos_;
+
+ b.Data_ = nullptr;
+ b.Len_ = 0;
+ b.Pos_ = 0;
+
+ return *this;
+}
+
void TBuffer::Append(const char* buf, size_t len) {
if (len > Avail()) {
Reserve(Pos_ + len);
diff --git a/util/generic/buffer.h b/util/generic/buffer.h
index 80fd289b17..9576467404 100644
--- a/util/generic/buffer.h
+++ b/util/generic/buffer.h
@@ -27,7 +27,7 @@ public:
TBuffer(TBuffer&& b) noexcept;
TBuffer& operator=(TBuffer&& b) noexcept;
-
+
TBuffer& operator=(const TBuffer& b) {
if (this != &b) {
Assign(b.Data(), b.Size());
diff --git a/util/generic/refcount.h b/util/generic/refcount.h
index 531db87022..966e853b77 100644
--- a/util/generic/refcount.h
+++ b/util/generic/refcount.h
@@ -38,16 +38,16 @@ public:
}
inline bool TryWeakInc() noexcept {
- if (!Counter_) {
- return false;
- }
-
- Inc();
+ if (!Counter_) {
+ return false;
+ }
+
+ Inc();
Y_ASSERT(Counter_ != 0);
- return true;
- }
-
+ return true;
+ }
+
inline TAtomicBase Val() const noexcept {
return Counter_;
}
@@ -130,22 +130,22 @@ public:
}
inline bool TryWeakInc() noexcept {
- while (true) {
- intptr_t curValue = Counter_;
-
- if (!curValue) {
- return false;
- }
-
- intptr_t newValue = curValue + 1;
+ while (true) {
+ intptr_t curValue = Counter_;
+
+ if (!curValue) {
+ return false;
+ }
+
+ intptr_t newValue = curValue + 1;
Y_ASSERT(newValue != 0);
-
- if (AtomicCas(&Counter_, newValue, curValue)) {
- return true;
- }
- }
- }
-
+
+ if (AtomicCas(&Counter_, newValue, curValue)) {
+ return true;
+ }
+ }
+ }
+
private:
TAtomic Counter_;
};
diff --git a/util/generic/typetraits_ut.cpp b/util/generic/typetraits_ut.cpp
index 84169f1267..e7571c75ec 100644
--- a/util/generic/typetraits_ut.cpp
+++ b/util/generic/typetraits_ut.cpp
@@ -9,11 +9,11 @@ namespace {
enum ETestEnum {
};
- class TPodClass {
+ class TPodClass {
};
- class TNonPodClass {
- TNonPodClass() {
+ class TNonPodClass {
+ TNonPodClass() {
}
};
@@ -39,37 +39,37 @@ namespace {
class TNonEmptyDerivedClass: public TNonEmptyClass {
};
-
+
class TStdLayoutClass1: public TEmptyClass {
- public:
- int Value1;
- int Value2;
- };
-
+ public:
+ int Value1;
+ int Value2;
+ };
+
class TStdLayoutClass2: public TNonEmptyClass {
- };
-
- class TNonStdLayoutClass1 {
- public:
- int Value1;
+ };
+
+ class TNonStdLayoutClass1 {
+ public:
+ int Value1;
protected:
- int Value2;
- };
-
- class TNonStdLayoutClass2 {
- public:
+ int Value2;
+ };
+
+ class TNonStdLayoutClass2 {
+ public:
virtual void Func() {
}
- };
-
+ };
+
class TNonStdLayoutClass3: public TNonStdLayoutClass2 {
- };
-
+ };
+
class TNonStdLayoutClass4: public TEmptyClass {
- public:
- TEmptyClass Base;
- };
+ public:
+ TEmptyClass Base;
+ };
}
#define ASSERT_SAME_TYPE(x, y) \
@@ -131,7 +131,7 @@ Y_UNIT_TEST_SUITE(TTypeTraitsTest) {
UNIT_ASSERT(!std::is_arithmetic<T*>::value);
bool a;
-
+
a = std::is_same<typename TTypeTraits<T>::TFuncParam, T>::value;
UNIT_ASSERT(a);
a = std::is_same<typename TTypeTraits<const volatile T>::TFuncParam, const volatile T>::value;
@@ -217,7 +217,7 @@ Y_UNIT_TEST_SUITE(TTypeTraitsTest) {
UNIT_ASSERT(!std::is_empty<TNonEmptyClass>::value);
UNIT_ASSERT(!std::is_empty<TNonEmptyDerivedClass>::value);
}
-
+
Y_UNIT_TEST(TestIsStandardLayout) {
UNIT_ASSERT(std::is_standard_layout<TStdLayoutClass1>::value);
UNIT_ASSERT(std::is_standard_layout<TStdLayoutClass2>::value);
@@ -225,8 +225,8 @@ Y_UNIT_TEST_SUITE(TTypeTraitsTest) {
UNIT_ASSERT(!std::is_standard_layout<TNonStdLayoutClass2>::value);
UNIT_ASSERT(!std::is_standard_layout<TNonStdLayoutClass3>::value);
UNIT_ASSERT(!std::is_standard_layout<TNonStdLayoutClass4>::value);
- }
-
+ }
+
template <class T>
using TTrySum = decltype(std::declval<T>() + std::declval<T>());
@@ -318,32 +318,32 @@ namespace {
};
template <>
- struct TTypeTraitsExpected<TPodClass>: public TTypeTraitsExpected<void> {
+ struct TTypeTraitsExpected<TPodClass>: public TTypeTraitsExpected<void> {
enum { IsClassType = true };
enum { IsVoid = false };
};
template <>
- struct TTypeTraitsExpected<TNonPodClass>: public TTypeTraitsExpected<TPodClass> {
+ struct TTypeTraitsExpected<TNonPodClass>: public TTypeTraitsExpected<TPodClass> {
enum { IsPod = false };
};
template <>
- struct TTypeTraitsExpected<TNonPodClass&>: public TTypeTraitsExpected<TNonPodClass> {
+ struct TTypeTraitsExpected<TNonPodClass&>: public TTypeTraitsExpected<TNonPodClass> {
enum { IsClassType = false };
enum { IsReference = true };
enum { IsLvalueReference = true };
};
template <>
- struct TTypeTraitsExpected<TNonPodClass&&>: public TTypeTraitsExpected<TNonPodClass> {
+ struct TTypeTraitsExpected<TNonPodClass&&>: public TTypeTraitsExpected<TNonPodClass> {
enum { IsClassType = false };
enum { IsReference = true };
enum { IsRvalueReference = true };
};
template <>
- struct TTypeTraitsExpected<const TNonPodClass&>: public TTypeTraitsExpected<TNonPodClass&> {
+ struct TTypeTraitsExpected<const TNonPodClass&>: public TTypeTraitsExpected<TNonPodClass&> {
};
template <>
@@ -416,10 +416,10 @@ Y_UNIT_TEST_SUITE(TTypeTraitsTestNg) {
TYPE_TEST(FloatReference, float&)
TYPE_TEST(FloatConstReference, const float&)
TYPE_TEST(FloatArray, float[17])
- TYPE_TEST(PodClass, TPodClass)
- TYPE_TEST(NonPodClass, TNonPodClass)
- TYPE_TEST(NonPodClassReference, TNonPodClass&)
- TYPE_TEST(NonPodClassConstReference, const TNonPodClass&)
+ TYPE_TEST(PodClass, TPodClass)
+ TYPE_TEST(NonPodClass, TNonPodClass)
+ TYPE_TEST(NonPodClassReference, TNonPodClass&)
+ TYPE_TEST(NonPodClassConstReference, const TNonPodClass&)
}
enum E4 {
diff --git a/util/stream/str_ut.cpp b/util/stream/str_ut.cpp
index 33a70a7eab..fc6b46c31a 100644
--- a/util/stream/str_ut.cpp
+++ b/util/stream/str_ut.cpp
@@ -1,41 +1,41 @@
-#include "str.h"
-
+#include "str.h"
+
#include <library/cpp/testing/unittest/registar.h>
-#include <util/generic/typetraits.h>
-
-template <typename T>
-const T ReturnConstTemp();
-
+#include <util/generic/typetraits.h>
+
+template <typename T>
+const T ReturnConstTemp();
+
Y_UNIT_TEST_SUITE(TStringInputOutputTest) {
Y_UNIT_TEST(Lvalue) {
TString str = "Hello, World!";
- TStringInput input(str);
-
+ TStringInput input(str);
+
TString result = input.ReadAll();
-
+
UNIT_ASSERT_VALUES_EQUAL(result, str);
- }
-
+ }
+
Y_UNIT_TEST(ConstRef) {
TString str = "Hello, World!";
const TString& r = str;
- TStringInput input(r);
-
+ TStringInput input(r);
+
TString result = input.ReadAll();
-
+
UNIT_ASSERT_VALUES_EQUAL(result, str);
- }
-
+ }
+
Y_UNIT_TEST(NonConstRef) {
TString str = "Hello, World!";
TString& r = str;
- TStringInput input(r);
-
+ TStringInput input(r);
+
TString result = input.ReadAll();
-
+
UNIT_ASSERT_VALUES_EQUAL(result, str);
- }
-
+ }
+
Y_UNIT_TEST(Transfer) {
TString inputString = "some_string";
TStringInput input(inputString);
@@ -149,4 +149,4 @@ Y_UNIT_TEST_SUITE(TStringInputOutputTest) {
// Check old stream is in a valid state
output1 << "baz";
}
-}
+}