Repository navigation
Tags
Tags
Fix opening-line comment moving to the alias line with combine_as_imp… …orts With combine_as_imports, the comments of an import that has an alias are kept under module.__combined_as__ and added to the comments of the grouped statement in _with_from_imports_for_module. Since the grouping change of #2614, preserve_comments_on_statement_line only looks at the module's own opening-line comments, so a wrapped import of a single aliased name went through wrap.line() and its comment, often a type: ignore, moved to the alias line, where mypy no longer applies it. That is the case #1839 reported, now only with combine_as_imports. Count the combined comments as statement comments too.
Name the predicate and drive the prefix test off STRING_PREFIXES Addresses the two review comments. The quote-based test in `process` is now `_is_comment_or_string_start`, so the call site says what it is asking rather than composing a strip and a startswith inline. The regr 8000 ession test iterates `isort.core.STRING_PREFIXES` instead of repeating the prefixes, so the two cannot drift apart.
PreviousNext