mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-16 02:02:58 -07:00
Bump mako from 1.1.6 to 1.2.0 (#1684)
* Bump mako from 1.1.6 to 1.2.0 Bumps [mako](https://github.com/sqlalchemy/mako) from 1.1.6 to 1.2.0. - [Release notes](https://github.com/sqlalchemy/mako/releases) - [Changelog](https://github.com/sqlalchemy/mako/blob/main/CHANGES) - [Commits](https://github.com/sqlalchemy/mako/commits) --- updated-dependencies: - dependency-name: mako dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Update mako==1.2.0 * Update MarkupSafe==2.1.1 * Add importlib-metadata==4.11.3 * Update requirements.txt Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> [skip ci]
This commit is contained in:
parent
aa0c58ef0e
commit
238afb4794
45 changed files with 2948 additions and 848 deletions
|
@ -11,9 +11,10 @@ if t.TYPE_CHECKING:
|
|||
pass
|
||||
|
||||
|
||||
__version__ = "2.0.1"
|
||||
__version__ = "2.1.1"
|
||||
|
||||
_striptags_re = re.compile(r"(<!--.*?-->|<[^>]*>)")
|
||||
_strip_comments_re = re.compile(r"<!--.*?-->")
|
||||
_strip_tags_re = re.compile(r"<.*?>")
|
||||
|
||||
|
||||
def _simple_escaping_wrapper(name: str) -> t.Callable[..., "Markup"]:
|
||||
|
@ -92,19 +93,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))
|
||||
|
||||
|
@ -153,8 +159,11 @@ class Markup(str):
|
|||
>>> Markup("Main »\t<em>About</em>").striptags()
|
||||
'Main » About'
|
||||
"""
|
||||
stripped = " ".join(_striptags_re.sub("", self).split())
|
||||
return Markup(stripped).unescape()
|
||||
# Use two regexes to avoid ambiguous matches.
|
||||
value = _strip_comments_re.sub("", self)
|
||||
value = _strip_tags_re.sub("", value)
|
||||
value = " ".join(value.split())
|
||||
return Markup(value).unescape()
|
||||
|
||||
@classmethod
|
||||
def escape(cls, s: t.Any) -> "Markup":
|
||||
|
@ -280,9 +289,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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue