X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/9edba85f71d50d12996ef7bda576426362016171..882d8795c6ff65c02f2657e596391748d1b6b7f5:/src/black/lines.py?ds=sidebyside diff --git a/src/black/lines.py b/src/black/lines.py index 48fde88..6acc95e 100644 --- a/src/black/lines.py +++ b/src/black/lines.py @@ -239,6 +239,21 @@ class Line: return False + def contains_implicit_multiline_string_with_comments(self) -> bool: + """Chck if we have an implicit multiline string with comments on the line""" + for leaf_type, leaf_group_iterator in itertools.groupby( + self.leaves, lambda leaf: leaf.type + ): + if leaf_type != token.STRING: + continue + leaf_list = list(leaf_group_iterator) + if len(leaf_list) == 1: + continue + for leaf in leaf_list: + if self.comments_after(leaf): + return True + return False + def contains_uncollapsable_type_comments(self) -> bool: ignored_ids = set() try: