We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug
When trying to run black on a file with a patter matching block where a case is a class pattern with an as pattern inside of it fails to format
black
class
as
To Reproduce
For example, take this code:
A stripped down example of file that was failing
from collections.abc import Callable class Foo: bb = 5 def aa(self): ... bar1 = Foo() match bar1: case Foo(aa=Callable() as aa, bb=int()): print(bar1.aa, bar1.bb) case _: print("no match", "\n")
And run it with these arguments:
$ black file.py --target-version=py310
The resulting error is:
error: cannot format test.py: Cannot parse: 14:27: case Foo(aa=Callable() as aa, bb=int()): Oh no! 💥 💔 💥 1 file failed to reformat.
Expected behavior
Expected not to fail
Environment
RHEL7 python 3.10.1 black 21.12b0
The text was updated successfully, but these errors were encountered:
I believe this is related to #1948
Sorry, something went wrong.
I can verify this bug, and confirm it is a grammar inconsistency. Will submit a PR tonight.
Successfully merging a pull request may close this issue.
Describe the bug
When trying to run
black
on a file with a patter matching block where a case is aclass
pattern with anas
pattern inside of it fails to formatTo Reproduce
For example, take this code:
A stripped down example of file that was failing
And run it with these arguments:
The resulting error is:
Expected behavior
Expected not to fail
Environment
RHEL7
python 3.10.1
black 21.12b0
The text was updated successfully, but these errors were encountered: