Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try 3.10 grammar more often + remove redundant out()
Say you're attrs and you don't configure target-version. Previously Black would default to trying every single grammar it has, including the 3.10 grammar. With this PR, now target-version is configured for you effectively so now get_grammars() is more selective in which grammars it returns. If any target versions don't support the match statement, the 3.10 grammar won't be tried. And while in theory a 3.7+ project shoudn't be using 3.10 features, attrs has a test file which uses match (which fails to parse because the 3.10 grammar isn't selected). To avoid breaking attrs, get_grammars() will now return the 3.10 grammar as long as *any* the target versions support match. The out() call was made redundant by an older PR that prints the configuration if --verbose is passed.
- Loading branch information