mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-06 21:21:15 -07:00
Update mako to 1.1.2
This commit is contained in:
parent
843a400b2d
commit
4564623884
27 changed files with 53 additions and 112 deletions
|
@ -1,19 +0,0 @@
|
||||||
Copyright 2006-2019 the Mako authors and contributors <see AUTHORS file>.
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
|
||||||
the Software without restriction, including without limitation the rights to
|
|
||||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
||||||
of the Software, and to permit persons to whom the Software is furnished to do
|
|
||||||
so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
|
@ -1,52 +0,0 @@
|
||||||
=========================
|
|
||||||
Mako Templates for Python
|
|
||||||
=========================
|
|
||||||
|
|
||||||
Mako is a template library written in Python. It provides a familiar, non-XML
|
|
||||||
syntax which compiles into Python modules for maximum performance. Mako's
|
|
||||||
syntax and API borrows from the best ideas of many others, including Django
|
|
||||||
templates, Cheetah, Myghty, and Genshi. Conceptually, Mako is an embedded
|
|
||||||
Python (i.e. Python Server Page) language, which refines the familiar ideas
|
|
||||||
of componentized layout and inheritance to produce one of the most
|
|
||||||
straightforward and flexible models available, while also maintaining close
|
|
||||||
ties to Python calling and scoping semantics.
|
|
||||||
|
|
||||||
Nutshell
|
|
||||||
========
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
<%inherit file="base.html"/>
|
|
||||||
<%
|
|
||||||
rows = [[v for v in range(0,10)] for row in range(0,10)]
|
|
||||||
%>
|
|
||||||
<table>
|
|
||||||
% for row in rows:
|
|
||||||
${makerow(row)}
|
|
||||||
% endfor
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<%def name="makerow(row)">
|
|
||||||
<tr>
|
|
||||||
% for name in row:
|
|
||||||
<td>${name}</td>\
|
|
||||||
% endfor
|
|
||||||
</tr>
|
|
||||||
</%def>
|
|
||||||
|
|
||||||
Philosophy
|
|
||||||
===========
|
|
||||||
|
|
||||||
Python is a great scripting language. Don't reinvent the wheel...your templates can handle it !
|
|
||||||
|
|
||||||
Documentation
|
|
||||||
==============
|
|
||||||
|
|
||||||
See documentation for Mako at https://docs.makotemplates.org/en/latest/
|
|
||||||
|
|
||||||
License
|
|
||||||
========
|
|
||||||
|
|
||||||
Mako is licensed under an MIT-style license (see LICENSE).
|
|
||||||
Other incorporated projects may be licensed under different licenses.
|
|
||||||
All licenses allow for non-commercial and commercial use.
|
|
|
@ -1,8 +1,8 @@
|
||||||
# mako/__init__.py
|
# mako/__init__.py
|
||||||
# Copyright 2006-2019 the Mako authors and contributors <see AUTHORS file>
|
# Copyright 2006-2020 the Mako authors and contributors <see AUTHORS file>
|
||||||
#
|
#
|
||||||
# This module is part of Mako and is released under
|
# This module is part of Mako and is released under
|
||||||
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
||||||
|
|
||||||
|
|
||||||
__version__ = "1.1.0"
|
__version__ = '1.1.2'
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# mako/_ast_util.py
|
# mako/_ast_util.py
|
||||||
# Copyright 2006-2019 the Mako authors and contributors <see AUTHORS file>
|
# Copyright 2006-2020 the Mako authors and contributors <see AUTHORS file>
|
||||||
#
|
#
|
||||||
# This module is part of Mako and is released under
|
# This module is part of Mako and is released under
|
||||||
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# mako/ast.py
|
# mako/ast.py
|
||||||
# Copyright 2006-2019 the Mako authors and contributors <see AUTHORS file>
|
# Copyright 2006-2020 the Mako authors and contributors <see AUTHORS file>
|
||||||
#
|
#
|
||||||
# This module is part of Mako and is released under
|
# This module is part of Mako and is released under
|
||||||
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# mako/cache.py
|
# mako/cache.py
|
||||||
# Copyright 2006-2019 the Mako authors and contributors <see AUTHORS file>
|
# Copyright 2006-2020 the Mako authors and contributors <see AUTHORS file>
|
||||||
#
|
#
|
||||||
# This module is part of Mako and is released under
|
# This module is part of Mako and is released under
|
||||||
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
# mako/cmd.py
|
# mako/cmd.py
|
||||||
# Copyright 2006-2019 the Mako authors and contributors <see AUTHORS file>
|
# Copyright 2006-2020 the Mako authors and contributors <see AUTHORS file>
|
||||||
#
|
#
|
||||||
# This module is part of Mako and is released under
|
# This module is part of Mako and is released under
|
||||||
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
|
import io
|
||||||
from os.path import dirname
|
from os.path import dirname
|
||||||
from os.path import isfile
|
from os.path import isfile
|
||||||
import sys
|
import sys
|
||||||
|
@ -46,11 +47,17 @@ def cmdline(argv=None):
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--output-encoding", default=None, help="force output encoding"
|
"--output-encoding", default=None, help="force output encoding"
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--output-file",
|
||||||
|
default=None,
|
||||||
|
help="Write to file upon successful render instead of stdout",
|
||||||
|
)
|
||||||
parser.add_argument("input", nargs="?", default="-")
|
parser.add_argument("input", nargs="?", default="-")
|
||||||
|
|
||||||
options = parser.parse_args(argv)
|
options = parser.parse_args(argv)
|
||||||
|
|
||||||
output_encoding = options.output_encoding
|
output_encoding = options.output_encoding
|
||||||
|
output_file = options.output_file
|
||||||
|
|
||||||
if options.input == "-":
|
if options.input == "-":
|
||||||
lookup_dirs = options.template_dir or ["."]
|
lookup_dirs = options.template_dir or ["."]
|
||||||
|
@ -80,9 +87,16 @@ def cmdline(argv=None):
|
||||||
|
|
||||||
kw = dict([varsplit(var) for var in options.var])
|
kw = dict([varsplit(var) for var in options.var])
|
||||||
try:
|
try:
|
||||||
sys.stdout.write(template.render(**kw))
|
rendered = template.render(**kw)
|
||||||
except:
|
except:
|
||||||
_exit()
|
_exit()
|
||||||
|
else:
|
||||||
|
if output_file:
|
||||||
|
io.open(output_file, "wt", encoding=output_encoding).write(
|
||||||
|
rendered
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
sys.stdout.write(rendered)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# mako/codegen.py
|
# mako/codegen.py
|
||||||
# Copyright 2006-2019 the Mako authors and contributors <see AUTHORS file>
|
# Copyright 2006-2020 the Mako authors and contributors <see AUTHORS file>
|
||||||
#
|
#
|
||||||
# This module is part of Mako and is released under
|
# This module is part of Mako and is released under
|
||||||
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# mako/compat.py
|
# mako/compat.py
|
||||||
# Copyright 2006-2019 the Mako authors and contributors <see AUTHORS file>
|
# Copyright 2006-2020 the Mako authors and contributors <see AUTHORS file>
|
||||||
#
|
#
|
||||||
# This module is part of Mako and is released under
|
# This module is part of Mako and is released under
|
||||||
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# mako/exceptions.py
|
# mako/exceptions.py
|
||||||
# Copyright 2006-2019 the Mako authors and contributors <see AUTHORS file>
|
# Copyright 2006-2020 the Mako authors and contributors <see AUTHORS file>
|
||||||
#
|
#
|
||||||
# This module is part of Mako and is released under
|
# This module is part of Mako and is released under
|
||||||
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
||||||
|
@ -166,9 +166,7 @@ class RichTraceback(object):
|
||||||
module_source = info.code
|
module_source = info.code
|
||||||
template_source = info.source
|
template_source = info.source
|
||||||
template_filename = (
|
template_filename = (
|
||||||
info.template_filename
|
info.template_filename or info.template_uri or filename
|
||||||
or info.template_uri
|
|
||||||
or filename
|
|
||||||
)
|
)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
# A normal .py file (not a Template)
|
# A normal .py file (not a Template)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# ext/autohandler.py
|
# ext/autohandler.py
|
||||||
# Copyright 2006-2019 the Mako authors and contributors <see AUTHORS file>
|
# Copyright 2006-2020 the Mako authors and contributors <see AUTHORS file>
|
||||||
#
|
#
|
||||||
# This module is part of Mako and is released under
|
# This module is part of Mako and is released under
|
||||||
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# ext/babelplugin.py
|
# ext/babelplugin.py
|
||||||
# Copyright 2006-2019 the Mako authors and contributors <see AUTHORS file>
|
# Copyright 2006-2020 the Mako authors and contributors <see AUTHORS file>
|
||||||
#
|
#
|
||||||
# This module is part of Mako and is released under
|
# This module is part of Mako and is released under
|
||||||
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# ext/beaker_cache.py
|
# ext/beaker_cache.py
|
||||||
# Copyright 2006-2019 the Mako authors and contributors <see AUTHORS file>
|
# Copyright 2006-2020 the Mako authors and contributors <see AUTHORS file>
|
||||||
#
|
#
|
||||||
# This module is part of Mako and is released under
|
# This module is part of Mako and is released under
|
||||||
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# ext/extract.py
|
# ext/extract.py
|
||||||
# Copyright 2006-2019 the Mako authors and contributors <see AUTHORS file>
|
# Copyright 2006-2020 the Mako authors and contributors <see AUTHORS file>
|
||||||
#
|
#
|
||||||
# This module is part of Mako and is released under
|
# This module is part of Mako and is released under
|
||||||
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# ext/linguaplugin.py
|
# ext/linguaplugin.py
|
||||||
# Copyright 2006-2019 the Mako authors and contributors <see AUTHORS file>
|
# Copyright 2006-2020 the Mako authors and contributors <see AUTHORS file>
|
||||||
#
|
#
|
||||||
# This module is part of Mako and is released under
|
# This module is part of Mako and is released under
|
||||||
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# ext/preprocessors.py
|
# ext/preprocessors.py
|
||||||
# Copyright 2006-2019 the Mako authors and contributors <see AUTHORS file>
|
# Copyright 2006-2020 the Mako authors and contributors <see AUTHORS file>
|
||||||
#
|
#
|
||||||
# This module is part of Mako and is released under
|
# This module is part of Mako and is released under
|
||||||
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# ext/pygmentplugin.py
|
# ext/pygmentplugin.py
|
||||||
# Copyright 2006-2019 the Mako authors and contributors <see AUTHORS file>
|
# Copyright 2006-2020 the Mako authors and contributors <see AUTHORS file>
|
||||||
#
|
#
|
||||||
# This module is part of Mako and is released under
|
# This module is part of Mako and is released under
|
||||||
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# ext/turbogears.py
|
# ext/turbogears.py
|
||||||
# Copyright 2006-2019 the Mako authors and contributors <see AUTHORS file>
|
# Copyright 2006-2020 the Mako authors and contributors <see AUTHORS file>
|
||||||
#
|
#
|
||||||
# This module is part of Mako and is released under
|
# This module is part of Mako and is released under
|
||||||
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# mako/filters.py
|
# mako/filters.py
|
||||||
# Copyright 2006-2019 the Mako authors and contributors <see AUTHORS file>
|
# Copyright 2006-2020 the Mako authors and contributors <see AUTHORS file>
|
||||||
#
|
#
|
||||||
# This module is part of Mako and is released under
|
# This module is part of Mako and is released under
|
||||||
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# mako/lexer.py
|
# mako/lexer.py
|
||||||
# Copyright 2006-2019 the Mako authors and contributors <see AUTHORS file>
|
# Copyright 2006-2020 the Mako authors and contributors <see AUTHORS file>
|
||||||
#
|
#
|
||||||
# This module is part of Mako and is released under
|
# This module is part of Mako and is released under
|
||||||
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# mako/lookup.py
|
# mako/lookup.py
|
||||||
# Copyright 2006-2019 the Mako authors and contributors <see AUTHORS file>
|
# Copyright 2006-2020 the Mako authors and contributors <see AUTHORS file>
|
||||||
#
|
#
|
||||||
# This module is part of Mako and is released under
|
# This module is part of Mako and is released under
|
||||||
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# mako/parsetree.py
|
# mako/parsetree.py
|
||||||
# Copyright 2006-2019 the Mako authors and contributors <see AUTHORS file>
|
# Copyright 2006-2020 the Mako authors and contributors <see AUTHORS file>
|
||||||
#
|
#
|
||||||
# This module is part of Mako and is released under
|
# This module is part of Mako and is released under
|
||||||
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# mako/pygen.py
|
# mako/pygen.py
|
||||||
# Copyright 2006-2019 the Mako authors and contributors <see AUTHORS file>
|
# Copyright 2006-2020 the Mako authors and contributors <see AUTHORS file>
|
||||||
#
|
#
|
||||||
# This module is part of Mako and is released under
|
# This module is part of Mako and is released under
|
||||||
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# mako/pyparser.py
|
# mako/pyparser.py
|
||||||
# Copyright 2006-2019 the Mako authors and contributors <see AUTHORS file>
|
# Copyright 2006-2020 the Mako authors and contributors <see AUTHORS file>
|
||||||
#
|
#
|
||||||
# This module is part of Mako and is released under
|
# This module is part of Mako and is released under
|
||||||
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# mako/runtime.py
|
# mako/runtime.py
|
||||||
# Copyright 2006-2019 the Mako authors and contributors <see AUTHORS file>
|
# Copyright 2006-2020 the Mako authors and contributors <see AUTHORS file>
|
||||||
#
|
#
|
||||||
# This module is part of Mako and is released under
|
# This module is part of Mako and is released under
|
||||||
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# mako/template.py
|
# mako/template.py
|
||||||
# Copyright 2006-2019 the Mako authors and contributors <see AUTHORS file>
|
# Copyright 2006-2020 the Mako authors and contributors <see AUTHORS file>
|
||||||
#
|
#
|
||||||
# This module is part of Mako and is released under
|
# This module is part of Mako and is released under
|
||||||
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
||||||
|
@ -530,7 +530,7 @@ class ModuleTemplate(Template):
|
||||||
import mymodule
|
import mymodule
|
||||||
|
|
||||||
t = ModuleTemplate(mymodule)
|
t = ModuleTemplate(mymodule)
|
||||||
print t.render()
|
print(t.render())
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
# mako/util.py
|
# mako/util.py
|
||||||
# Copyright 2006-2019 the Mako authors and contributors <see AUTHORS file>
|
# Copyright 2006-2020 the Mako authors and contributors <see AUTHORS file>
|
||||||
#
|
#
|
||||||
# This module is part of Mako and is released under
|
# This module is part of Mako and is released under
|
||||||
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
# the MIT License: http://www.opensource.org/licenses/mit-license.php
|
||||||
|
from __future__ import absolute_import
|
||||||
|
|
||||||
|
from ast import parse
|
||||||
import codecs
|
import codecs
|
||||||
import collections
|
import collections
|
||||||
import operator
|
import operator
|
||||||
|
@ -257,9 +259,7 @@ def parse_encoding(fp):
|
||||||
m = _PYTHON_MAGIC_COMMENT_re.match(line1.decode("ascii", "ignore"))
|
m = _PYTHON_MAGIC_COMMENT_re.match(line1.decode("ascii", "ignore"))
|
||||||
if not m:
|
if not m:
|
||||||
try:
|
try:
|
||||||
import parser
|
parse(line1.decode("ascii", "ignore"))
|
||||||
|
|
||||||
parser.suite(line1.decode("ascii", "ignore"))
|
|
||||||
except (ImportError, SyntaxError):
|
except (ImportError, SyntaxError):
|
||||||
# Either it's a real syntax error, in which case the source
|
# Either it's a real syntax error, in which case the source
|
||||||
# is not valid python source, or line2 is a continuation of
|
# is not valid python source, or line2 is a continuation of
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue