{"record":{"id":"70ae40ac9aa6066f","repo":"astral-sh/ruff","slug":"expected-all-submodule-imports-to-contain-a","errorCode":null,"errorMessage":"Expected all submodule imports to contain a '.'","messagePattern":"Expected all submodule imports to contain a '\\.'","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/ruff_linter/src/rules/pyflakes/rules/unused_import.rs","lineNumber":207,"sourceCode":"            context,\n        } = self;\n        if *ignore_init_module_imports {\n            match context {\n                UnusedImportContext::DunderInitFirstParty {\n                    dunder_all_count: DunderAllCount::Zero,\n                    submodule_import: false,\n                } => return Some(format!(\"Use an explicit re-export: `{module} as {module}`\")),\n                UnusedImportContext::DunderInitFirstParty {\n                    dunder_all_count: DunderAllCount::Zero,\n                    submodule_import: true,\n                } => {\n                    return Some(format!(\n                        \"Use an explicit re-export: \\\n                        `import {parent} as {parent}; import {binding}`\",\n                        parent = binding\n                            .split('.')\n                            .next()\n                            .expect(\"Expected all submodule imports to contain a '.'\")\n                    ));\n                }\n                UnusedImportContext::DunderInitFirstParty {\n                    dunder_all_count: DunderAllCount::One,\n                    submodule_import: false,\n                } => return Some(format!(\"Add unused import `{binding}` to __all__\")),\n                UnusedImportContext::DunderInitFirstParty {\n                    dunder_all_count: DunderAllCount::One,\n                    submodule_import: true,\n                } => {\n                    return Some(format!(\n                        \"Add `{}` to __all__\",\n                        binding\n                            .split('.')\n                            .next()\n                            .expect(\"Expected all submodule imports to contain a '.'\")\n                    ));\n                }","sourceCodeStart":189,"sourceCodeEnd":225,"githubUrl":"https://github.com/astral-sh/ruff/blob/26f38c119cac42e4d320ba08f09224fdec74af2c/crates/ruff_linter/src/rules/pyflakes/rules/unused_import.rs#L189-L225","documentation":"An internal expectation in the F401 unused-import fix message builder: while generating the explicit re-export suggestion for an __init__.py, a submodule import binding's module path contains no '.', even though the code path is guarded by submodule_import: true. The message text cannot be built for a non-dotted module.","triggerScenarios":"Thrown at crates/ruff_linter/src/rules/pyflakes/rules/unused_import.rs:207 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check how the binding was classified as a submodule import without a dotted name","Fall back to a generic message when the module name has no '.'"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"26f38c119cac42e4d320ba08f09224fdec74af2c","analyzedAt":"2026-09-05T10:32:37.492Z","contentChangedAt":"2026-09-05T10:32:37.492Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}