#2127: Strategy 3 hit filter for an EXTERNAL Python import. The hit must * spell the import's module chain (a src/ layout the module resolver missed * still does), and whatever names a module -- an enclosing path segment, or * any segment of a plain `import x` -- can only be a Module/File node (`import * copy` must not fall back to a project method called `copy`). */
| 1796 | * any segment of a plain `import x` -- can only be a Module/File node (`import |
| 1797 | * copy` must not fall back to a project method called `copy`). */ |
| 1798 | static bool python_external_hit_rejected(const CBMImport *imp, const char *name, |
| 1799 | bool enclosing_segment, const cbm_gbuf_node_t *hit) { |
| 1800 | if (!cbm_python_import_path_matches_qn(imp->module_path, name, hit->qualified_name)) { |
| 1801 | return true; |
| 1802 | } |
| 1803 | bool names_module = enclosing_segment || python_is_plain_module_import(imp); |
| 1804 | return names_module && strcmp(hit->label, "Module") != 0 && strcmp(hit->label, "File") != 0; |
| 1805 | } |
| 1806 | |
| 1807 | /* #1934: whether the name-guess import fallbacks — Strategy 1b (sibling file, |
| 1808 | * whose label filter admits symbols) and Strategy 3 (symbol name) — may run |
no test coverage detected