Ensure match/case are recognized as statements (#2665)
This commit is contained in:
parent
b0c2bcc953
commit
20d7ae0676
@ -13,6 +13,7 @@
|
|||||||
`match a, *b:` (#2639) (#2659)
|
`match a, *b:` (#2639) (#2659)
|
||||||
- Fix `match`/`case` statements that contain `match`/`case` soft keywords multiple
|
- Fix `match`/`case` statements that contain `match`/`case` soft keywords multiple
|
||||||
times, like `match re.match()` (#2661)
|
times, like `match re.match()` (#2661)
|
||||||
|
- Fix `case` statements with an inline body (#2665)
|
||||||
- Fix assignment to environment variables in Jupyter Notebooks (#2642)
|
- Fix assignment to environment variables in Jupyter Notebooks (#2642)
|
||||||
- Add `flake8-simplify` and `flake8-comprehensions` plugins (#2653)
|
- Add `flake8-simplify` and `flake8-comprehensions` plugins (#2653)
|
||||||
- Fix determination of f-string expression spans (#2654)
|
- Fix determination of f-string expression spans (#2654)
|
||||||
|
@ -52,6 +52,8 @@
|
|||||||
syms.with_stmt,
|
syms.with_stmt,
|
||||||
syms.funcdef,
|
syms.funcdef,
|
||||||
syms.classdef,
|
syms.classdef,
|
||||||
|
syms.match_stmt,
|
||||||
|
syms.case_block,
|
||||||
}
|
}
|
||||||
STANDALONE_COMMENT: Final = 153
|
STANDALONE_COMMENT: Final = 153
|
||||||
token.tok_name[STANDALONE_COMMENT] = "STANDALONE_COMMENT"
|
token.tok_name[STANDALONE_COMMENT] = "STANDALONE_COMMENT"
|
||||||
|
27
tests/data/pattern_matching_style.py
Normal file
27
tests/data/pattern_matching_style.py
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
match something:
|
||||||
|
case b(): print(1+1)
|
||||||
|
case c(
|
||||||
|
very_complex=True,
|
||||||
|
perhaps_even_loooooooooooooooooooooooooooooooooooooong=- 1
|
||||||
|
): print(1)
|
||||||
|
case c(
|
||||||
|
very_complex=True,
|
||||||
|
perhaps_even_loooooooooooooooooooooooooooooooooooooong=-1
|
||||||
|
): print(2)
|
||||||
|
case a: pass
|
||||||
|
|
||||||
|
# output
|
||||||
|
|
||||||
|
match something:
|
||||||
|
case b():
|
||||||
|
print(1 + 1)
|
||||||
|
case c(
|
||||||
|
very_complex=True, perhaps_even_loooooooooooooooooooooooooooooooooooooong=-1
|
||||||
|
):
|
||||||
|
print(1)
|
||||||
|
case c(
|
||||||
|
very_complex=True, perhaps_even_loooooooooooooooooooooooooooooooooooooong=-1
|
||||||
|
):
|
||||||
|
print(2)
|
||||||
|
case a:
|
||||||
|
pass
|
@ -74,6 +74,7 @@
|
|||||||
"pattern_matching_simple",
|
"pattern_matching_simple",
|
||||||
"pattern_matching_complex",
|
"pattern_matching_complex",
|
||||||
"pattern_matching_extras",
|
"pattern_matching_extras",
|
||||||
|
"pattern_matching_style",
|
||||||
"parenthesized_context_managers",
|
"parenthesized_context_managers",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user