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:
dependabot[bot] 2022-05-16 20:33:50 -07:00 committed by GitHub
parent aa0c58ef0e
commit 238afb4794
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
45 changed files with 2948 additions and 848 deletions

View file

@ -1,5 +1,5 @@
# mako/exceptions.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
@ -68,7 +68,7 @@ class TopLevelLookupException(TemplateLookupException):
pass
class RichTraceback(object):
class RichTraceback:
"""Pull the current exception from the ``sys`` traceback and extracts
Mako-specific template information.
@ -106,7 +106,7 @@ class RichTraceback(object):
def _init_message(self):
"""Find a unicode representation of self.error"""
try:
self.message = compat.text_type(self.error)
self.message = str(self.error)
except UnicodeError:
try:
self.message = str(self.error)
@ -114,8 +114,8 @@ class RichTraceback(object):
# Fallback to args as neither unicode nor
# str(Exception(u'\xe6')) work in Python < 2.6
self.message = self.error.args[0]
if not isinstance(self.message, compat.text_type):
self.message = compat.text_type(self.message, "ascii", "replace")
if not isinstance(self.message, str):
self.message = str(self.message, "ascii", "replace")
def _get_reformatted_records(self, records):
for rec in records:
@ -139,8 +139,7 @@ class RichTraceback(object):
@property
def reverse_traceback(self):
"""Return the same data as traceback, except in reverse order.
"""
"""Return the same data as traceback, except in reverse order."""
return list(self._get_reformatted_records(self.reverse_records))
@ -170,17 +169,6 @@ class RichTraceback(object):
)
except KeyError:
# A normal .py file (not a Template)
if not compat.py3k:
try:
fp = open(filename, "rb")
encoding = util.parse_encoding(fp)
fp.close()
except IOError:
encoding = None
if encoding:
line = line.decode(encoding)
else:
line = line.decode("ascii", "replace")
new_trcback.append(
(
filename,
@ -236,13 +224,12 @@ class RichTraceback(object):
if new_trcback:
try:
# A normal .py file (not a Template)
fp = open(new_trcback[-1][0], "rb")
encoding = util.parse_encoding(fp)
if compat.py3k and not encoding:
encoding = "utf-8"
fp.seek(0)
self.source = fp.read()
fp.close()
with open(new_trcback[-1][0], "rb") as fp:
encoding = util.parse_encoding(fp)
if not encoding:
encoding = "utf-8"
fp.seek(0)
self.source = fp.read()
if encoding:
self.source = self.source.decode(encoding)
except IOError: