X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/dc90d4951f66ac665582159537b902017d9a0361..05e1fbf27d93df36b09c560791ad46c6ce3eb518:/src/black/__init__.py diff --git a/src/black/__init__.py b/src/black/__init__.py index 08c239d..9bc8fc1 100644 --- a/src/black/__init__.py +++ b/src/black/__init__.py @@ -37,6 +37,7 @@ from mypy_extensions import mypyc_attr from black.const import DEFAULT_LINE_LENGTH, DEFAULT_INCLUDES, DEFAULT_EXCLUDES from black.const import STDIN_PLACEHOLDER from black.nodes import STARS, syms, is_simple_decorator_expression +from black.nodes import is_string_token from black.lines import Line, EmptyLineTracker from black.linegen import transform_line, LineGenerator, LN from black.comments import normalize_fmt_off @@ -1156,8 +1157,8 @@ def get_features_used( # noqa: C901 } for n in node.pre_order(): - if n.type == token.STRING: - value_head = n.value[:2] # type: ignore + if is_string_token(n): + value_head = n.value[:2] if value_head in {'f"', 'F"', "f'", "F'", "rf", "fr", "RF", "FR"}: features.add(Feature.F_STRINGS) @@ -1218,6 +1219,13 @@ def get_features_used( # noqa: C901 ): features.add(Feature.UNPACKING_ON_FLOW) + elif ( + n.type == syms.annassign + and len(n.children) >= 4 + and n.children[3].type == syms.testlist_star_expr + ): + features.add(Feature.ANN_ASSIGN_EXTENDED_RHS) + # Python 2 only features (for its deprecation) except for integers, see above elif n.type == syms.print_stmt: features.add(Feature.PRINT_STMT)