Implement the wrap_comprehension_in preview style from Black
Summary -- This PR implements the `wrap_comprehension_in` style added in https://github.com/psf/black/pull/4699. This wraps `in` clauses in comprehensions if they get too long. Using some examples from the upstream issue, this code: ```py [a for graph_path_expression in refined_constraint.condition_as_predicate.variables] [ a for graph_path_expression in refined_constraint.condition_as_predicate.variables ] ``` is currently formatted to: ```py [ a for graph_path_expression in refined_constraint.condition_as_predicate.variables ] [ a for graph_path_expression in refined_constraint.condition_as_predicate.variables ] ``` even if the second line of the comprehension exceeds the configured line length. In preview, black will now break these lines by parenthesizing the expression following `in`: ```py [ a for graph_path_expression in ( refined_constraint.condition_as_predicate.variables ) ] [ a for graph_path_expression in ( refined_constraint.condition_as_predicate.variables ) ] ``` I actually kind of like the alternative formatting mentioned on the original Black issue and in our #12870 which would be more like: ```py [ a for graph_path_expression in refined_constraint.condition_as_predicate.variables ] ``` but I think I'm in the minority there. Test Plan -- Existing Black compatibility tests showing fewer differences
This commit is contained in: