mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-06 05:01:14 -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
|
@ -1,5 +1,5 @@
|
|||
# mako/pyparser.py
|
||||
# Copyright 2006-2020 the Mako authors and contributors <see AUTHORS file>
|
||||
# Copyright 2006-2021 the Mako authors and contributors <see AUTHORS file>
|
||||
#
|
||||
# This module is part of Mako and is released under
|
||||
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
||||
|
@ -18,22 +18,13 @@ from mako import _ast_util
|
|||
from mako import compat
|
||||
from mako import exceptions
|
||||
from mako import util
|
||||
from mako.compat import arg_stringname
|
||||
|
||||
if compat.py3k:
|
||||
# words that cannot be assigned to (notably
|
||||
# smaller than the total keys in __builtins__)
|
||||
reserved = set(["True", "False", "None", "print"])
|
||||
# words that cannot be assigned to (notably
|
||||
# smaller than the total keys in __builtins__)
|
||||
reserved = {"True", "False", "None", "print"}
|
||||
|
||||
# the "id" attribute on a function node
|
||||
arg_id = operator.attrgetter("arg")
|
||||
else:
|
||||
# words that cannot be assigned to (notably
|
||||
# smaller than the total keys in __builtins__)
|
||||
reserved = set(["True", "False", "None"])
|
||||
|
||||
# the "id" attribute on a function node
|
||||
arg_id = operator.attrgetter("id")
|
||||
# the "id" attribute on a function node
|
||||
arg_id = operator.attrgetter("arg")
|
||||
|
||||
util.restore__ast(_ast)
|
||||
|
||||
|
@ -43,7 +34,7 @@ def parse(code, mode="exec", **exception_kwargs):
|
|||
|
||||
try:
|
||||
return _ast_util.parse(code, "<unknown>", mode)
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
raise exceptions.SyntaxException(
|
||||
"(%s) %s (%r)"
|
||||
% (
|
||||
|
@ -51,8 +42,8 @@ def parse(code, mode="exec", **exception_kwargs):
|
|||
compat.exception_as(),
|
||||
code[0:50],
|
||||
),
|
||||
**exception_kwargs
|
||||
)
|
||||
**exception_kwargs,
|
||||
) from e
|
||||
|
||||
|
||||
class FindIdentifiers(_ast_util.NodeVisitor):
|
||||
|
@ -85,18 +76,13 @@ class FindIdentifiers(_ast_util.NodeVisitor):
|
|||
self.visit(n)
|
||||
self.in_assign_targets = in_a
|
||||
|
||||
if compat.py3k:
|
||||
|
||||
# ExceptHandler is in Python 2, but this block only works in
|
||||
# Python 3 (and is required there)
|
||||
|
||||
def visit_ExceptHandler(self, node):
|
||||
if node.name is not None:
|
||||
self._add_declared(node.name)
|
||||
if node.type is not None:
|
||||
self.visit(node.type)
|
||||
for statement in node.body:
|
||||
self.visit(statement)
|
||||
def visit_ExceptHandler(self, node):
|
||||
if node.name is not None:
|
||||
self._add_declared(node.name)
|
||||
if node.type is not None:
|
||||
self.visit(node.type)
|
||||
for statement in node.body:
|
||||
self.visit(statement)
|
||||
|
||||
def visit_Lambda(self, node, *args):
|
||||
self._visit_function(node, True)
|
||||
|
@ -108,8 +94,7 @@ class FindIdentifiers(_ast_util.NodeVisitor):
|
|||
def _expand_tuples(self, args):
|
||||
for arg in args:
|
||||
if isinstance(arg, _ast.Tuple):
|
||||
for n in arg.elts:
|
||||
yield n
|
||||
yield from arg.elts
|
||||
else:
|
||||
yield arg
|
||||
|
||||
|
@ -170,15 +155,15 @@ class FindIdentifiers(_ast_util.NodeVisitor):
|
|||
for name in node.names:
|
||||
if name.asname is not None:
|
||||
self._add_declared(name.asname)
|
||||
elif name.name == "*":
|
||||
raise exceptions.CompileException(
|
||||
"'import *' is not supported, since all identifier "
|
||||
"names must be explicitly declared. Please use the "
|
||||
"form 'from <modulename> import <name1>, <name2>, "
|
||||
"...' instead.",
|
||||
**self.exception_kwargs,
|
||||
)
|
||||
else:
|
||||
if name.name == "*":
|
||||
raise exceptions.CompileException(
|
||||
"'import *' is not supported, since all identifier "
|
||||
"names must be explicitly declared. Please use the "
|
||||
"form 'from <modulename> import <name1>, <name2>, "
|
||||
"...' instead.",
|
||||
**self.exception_kwargs
|
||||
)
|
||||
self._add_declared(name.name)
|
||||
|
||||
|
||||
|
@ -213,27 +198,20 @@ class ParseFunc(_ast_util.NodeVisitor):
|
|||
|
||||
argnames = [arg_id(arg) for arg in node.args.args]
|
||||
if node.args.vararg:
|
||||
argnames.append(arg_stringname(node.args.vararg))
|
||||
argnames.append(node.args.vararg.arg)
|
||||
|
||||
if compat.py2k:
|
||||
# kw-only args don't exist in Python 2
|
||||
kwargnames = []
|
||||
else:
|
||||
kwargnames = [arg_id(arg) for arg in node.args.kwonlyargs]
|
||||
kwargnames = [arg_id(arg) for arg in node.args.kwonlyargs]
|
||||
if node.args.kwarg:
|
||||
kwargnames.append(arg_stringname(node.args.kwarg))
|
||||
kwargnames.append(node.args.kwarg.arg)
|
||||
self.listener.argnames = argnames
|
||||
self.listener.defaults = node.args.defaults # ast
|
||||
self.listener.kwargnames = kwargnames
|
||||
if compat.py2k:
|
||||
self.listener.kwdefaults = []
|
||||
else:
|
||||
self.listener.kwdefaults = node.args.kw_defaults
|
||||
self.listener.kwdefaults = node.args.kw_defaults
|
||||
self.listener.varargs = node.args.vararg
|
||||
self.listener.kwargs = node.args.kwarg
|
||||
|
||||
|
||||
class ExpressionGenerator(object):
|
||||
class ExpressionGenerator:
|
||||
def __init__(self, astnode):
|
||||
self.generator = _ast_util.SourceGenerator(" " * 4)
|
||||
self.generator.visit(astnode)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue