fix new formatting issues
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by David Lord · committed by David Lord · parent e993a9d · Browse files · 7 files·+28 added−21 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
7 files+28 added−21 removed
- tests:+4 added−4 removed
- other:+24 added−17 removed
Provenance
- Commit
a30f92d- Tree
4c8a7f7- Author
David Lord <davidism@gmail.com>- Committer
David Lord <davidism@gmail.com>- Parent
e993a9d
7 files changed+28 added−21 removed
modified:src/jinja2/parser.py+21 added-13 removed
320 unmodified lines321 self.stream.expect("name:import")322 node.names = []323 324 def parse_context():325- if self.stream.current.value in (326- "with",327- "without",328- ) and self.stream.look().test("name:context"):325+ if (326+ self.stream.current.value327+ in {328+ "with",329+ "without",330+ }331+ and self.stream.look().test("name:context")332+ ):333 node.with_context = next(self.stream).value == "with"334 self.stream.skip()335 return True336 return False534 unmodified lines871 dyn_args = dyn_kwargs = None872 kwargs = []873 if self.stream.current.type == "lparen":874 args, kwargs, dyn_args, dyn_kwargs = self.parse_call(None)875+ elif (876+ self.stream.current.type871- elif self.stream.current.type in (872- "name",873- "string",874- "integer",875- "float",876- "lparen",877- "lbracket",878- "lbrace",879- ) and not self.stream.current.test_any("name:else", "name:or", "name:and"):877+ in {878+ "name",879+ "string",880+ "integer",881+ "float",882+ "lparen",883+ "lbracket",884+ "lbrace",885+ }886+ and not self.stream.current.test_any("name:else", "name:or", "name:and")887+ ):888 if self.stream.current.test("name:is"):889 self.fail("You cannot chain multiple tests with is")890 arg_node = self.parse_primary()891 arg_node = self.parse_postfix(arg_node)62 unmodified linesmodified:src/jinja2/runtime.py+1 added-1 removed
806 unmodified lines807 def _fail_with_undefined_error(self, *args, **kwargs):808 try:809 return super()._fail_with_undefined_error(*args, **kwargs)810 except self._undefined_exception as e:811- logger.error(f"Template variable error: %s", e)811+ logger.error("Template variable error: %s", e)812 raise e813 814 def __str__(self):815 _log_message(self)105 unmodified linesmodified:src/jinja2/utils.py+1 added-2 removed
159 unmodified lines160 return f"{cls.__module__}.{cls.__name__} object"161 162 163 def pformat(obj):164- """Format an object using :func:`pprint.pformat`.165- """164+ """Format an object using :func:`pprint.pformat`."""165 from pprint import pformat166 167 return pformat(obj)168 575 unmodified linesmodified:tests/test_async.py+1 added-1 removed
256 unmodified lines257 assert t.render().strip() == "(FOO)"258 259 def test_unoptimized_scopes_autoescape(self):260 env = Environment(261- loader=DictLoader(dict(o_printer="({{ o }})",)),261+ loader=DictLoader({"o_printer": "({{ o }})"}),262 autoescape=True,263 enable_async=True,264 )265 t = env.from_string(325 unmodified linesmodified:tests/test_filters.py+2 added-2 removed
196 unmodified lines197 assert t.render(value=value) == expect198 199 @pytest.mark.parametrize(200 ("value", "base", "expect"),201- (("0x4d32", 16, "19762"), ("011", 8, "9"), ("0x33Z", 16, "0"),),201+ (("0x4d32", 16, "19762"), ("011", 8, "9"), ("0x33Z", 16, "0")),202 )203 def test_int_base(self, env, value, base, expect):204 t = env.from_string("{{ value|int(base=base) }}")205 assert t.render(value=value, base=base) == expect333 unmodified lines539 def test_min_max(self, env, source, expect):540 t = env.from_string(source)541 assert t.render() == expect542 543- @pytest.mark.parametrize("name,expect", (("min", "1"), ("max", "9"),))543+ @pytest.mark.parametrize(("name", "expect"), [("min", "1"), ("max", "9")])544 def test_min_max_attribute(self, env, name, expect):545 t = env.from_string("{{ items|" + name + '(attribute="value") }}')546 assert t.render(items=map(Magic, [5, 1, 9])) == expect547 221 unmodified linesmodified:tests/test_lexnparse.py+1 added-1 removed
996 unmodified lines997 tmpl = env.from_string("{{x}}{% raw +%}\n\n {% endraw +%}\n\n{{ y }}")998 999 def test_no_trim_angle_bracket(self, env):1000 env = Environment(1001- "<%", "%>", "${", "}", "<%#", "%>", lstrip_blocks=True, trim_blocks=True,1001+ "<%", "%>", "${", "}", "<%#", "%>", lstrip_blocks=True, trim_blocks=True1002 )1003 tmpl = env.from_string(" <% if True +%>\n\n <% endif %>")1004 assert tmpl.render() == "\n\n"1005 18 unmodified linesmodified:setup.py+1 added-1 removed
1 import re2 3 from setuptools import setup4 5-with open("src/jinja2/__init__.py", "rt", encoding="utf8") as f:5+with open("src/jinja2/__init__.py", encoding="utf8") as f:6 version = re.search(r'__version__ = "(.*?)"', f.read(), re.M).group(1)7 8 # Metadata goes in setup.cfg. These are here for GitHub's dependency graph.9 setup(5 unmodified lines