Skip to content
Myr

update pre-commit hooks

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 c167ddf · Browse files · 4 files+29 added−36 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

4 files+29 added−36 removed

  • other:+29 added−36 removed

4 files+29 added−36 removed

modified:src/jinja2/filters.py+1 added-1 removed
1162 unmodified lines
1163 if method == "common":1164 return round(value, precision)11651166 func = getattr(math, method)1167 return t.cast(float, func(value * (10 ** precision)) / (10 ** precision))1167 return t.cast(float, func(value * (10**precision)) / (10**precision))116811691170class _GroupTuple(t.NamedTuple):1171 grouper: t.Any
653 unmodified lines
modified:src/jinja2/lexer.py+12 added-12 removed
513 unmodified lines
514 self.newline_sequence = environment.newline_sequence515 self.keep_trailing_newline = environment.keep_trailing_newline516517 root_raw_re = (518 fr"(?P<raw_begin>{block_start_re}(\-|\+|)\s*raw\s*"519 fr"(?:\-{block_end_re}\s*|{block_end_re}))"518 rf"(?P<raw_begin>{block_start_re}(\-|\+|)\s*raw\s*"519 rf"(?:\-{block_end_re}\s*|{block_end_re}))"520 )521 root_parts_re = "|".join(522 [root_raw_re] + [fr"(?P<{n}>{r}(\-|\+|))" for n, r in root_tag_rules]522 [root_raw_re] + [rf"(?P<{n}>{r}(\-|\+|))" for n, r in root_tag_rules]523 )524525 # global lexing rules526 self.rules: t.Dict[str, t.List[_Rule]] = {527 "root": [528 # directives529 _Rule(530 c(fr"(.*?)(?:{root_parts_re})"),530 c(rf"(.*?)(?:{root_parts_re})"),531 OptionalLStrip(TOKEN_DATA, "#bygroup"), # type: ignore532 "#bygroup",533 ),534 # data
2 unmodified lines
537 # comments538 TOKEN_COMMENT_BEGIN: [539 _Rule(540 c(541 fr"(.*?)((?:\+{comment_end_re}|\-{comment_end_re}\s*"542 fr"|{comment_end_re}{block_suffix_re}))"541 rf"(.*?)((?:\+{comment_end_re}|\-{comment_end_re}\s*"542 rf"|{comment_end_re}{block_suffix_re}))"543 ),544 (TOKEN_COMMENT, TOKEN_COMMENT_END),545 "#pop",546 ),
2 unmodified lines
549 # blocks550 TOKEN_BLOCK_BEGIN: [551 _Rule(552 c(553 fr"(?:\+{block_end_re}|\-{block_end_re}\s*"554 fr"|{block_end_re}{block_suffix_re})"553 rf"(?:\+{block_end_re}|\-{block_end_re}\s*"554 rf"|{block_end_re}{block_suffix_re})"555 ),556 TOKEN_BLOCK_END,557 "#pop",558 ),
1 unmodified line
560 + tag_rules,561 # variables562 TOKEN_VARIABLE_BEGIN: [563 _Rule(564 c(fr"\-{variable_end_re}\s*|{variable_end_re}"),564 c(rf"\-{variable_end_re}\s*|{variable_end_re}"),565 TOKEN_VARIABLE_END,566 "#pop",567 )568 ]
1 unmodified line
570 # raw block571 TOKEN_RAW_BEGIN: [572 _Rule(573 c(574 fr"(.*?)((?:{block_start_re}(\-|\+|))\s*endraw\s*"575 fr"(?:\+{block_end_re}|\-{block_end_re}\s*"576 fr"|{block_end_re}{block_suffix_re}))"574 rf"(.*?)((?:{block_start_re}(\-|\+|))\s*endraw\s*"575 rf"(?:\+{block_end_re}|\-{block_end_re}\s*"576 rf"|{block_end_re}{block_suffix_re}))"577 ),578 OptionalLStrip(TOKEN_DATA, TOKEN_RAW_END), # type: ignore579 "#pop",580 ),
289 unmodified lines
modified:src/jinja2/parser.py+13 added-21 removed
362 unmodified lines
363 self.stream.expect("name:import")364 node.names = []365366 def parse_context() -> bool:367 if (368 self.stream.current.value369 in {370 "with",371 "without",372 }367 if self.stream.current.value in {368 "with",369 "without",370 } and self.stream.look().test("name:context"):373 and self.stream.look().test("name:context")374 ):371 node.with_context = next(self.stream).value == "with"372 self.stream.skip()373 return True374 return False
577 unmodified lines
952 dyn_args = dyn_kwargs = None953 kwargs = []954 if self.stream.current.type == "lparen":955 args, kwargs, dyn_args, dyn_kwargs = self.parse_call_args()960 elif (961 self.stream.current.type962 in {963 "name",964 "string",965 "integer",966 "float",967 "lparen",968 "lbracket",969 "lbrace",970 }956 elif self.stream.current.type in {957 "name",958 "string",959 "integer",960 "float",961 "lparen",962 "lbracket",963 "lbrace",964 } and not self.stream.current.test_any("name:else", "name:or", "name:and"):971 and not self.stream.current.test_any("name:else", "name:or", "name:and")972 ):965 if self.stream.current.test("name:is"):966 self.fail("You cannot chain multiple tests with is")967 arg_node = self.parse_primary()968 arg_node = self.parse_postfix(arg_node)
64 unmodified lines
modified:.pre-commit-config.yaml+3 added-2 removed