(self, i: ImportAll)
| 3218 | return import_id |
| 3219 | |
| 3220 | def visit_import_all(self, i: ImportAll) -> None: |
| 3221 | i_id = self.correct_relative_import(i) |
| 3222 | if i_id in self.modules: |
| 3223 | m = self.modules[i_id] |
| 3224 | if self.is_incomplete_namespace(i_id): |
| 3225 | # Any names could be missing from the current namespace if the target module |
| 3226 | # namespace is incomplete. |
| 3227 | self.mark_incomplete("*", i) |
| 3228 | for name, node in m.names.items(): |
| 3229 | if node.no_serialize: |
| 3230 | # This is either internal or generated symbol, skip it to avoid problems |
| 3231 | # like accidental name conflicts or invalid cross-references. |
| 3232 | continue |
| 3233 | fullname = i_id + "." + name |
| 3234 | self.set_future_import_flags(fullname) |
| 3235 | # if '__all__' exists, all nodes not included have had module_public set to |
| 3236 | # False, and we can skip checking '_' because it's been explicitly included. |
| 3237 | if node.module_public and (not name.startswith("_") or "__all__" in m.names): |
| 3238 | if isinstance(node.node, MypyFile): |
| 3239 | # Star import of submodule from a package, add it as a dependency. |
| 3240 | self.imports.add(node.node.fullname) |
| 3241 | # `from x import *` always reexports symbols |
| 3242 | self.add_imported_symbol( |
| 3243 | name, node, context=i, module_public=True, module_hidden=False |
| 3244 | ) |
| 3245 | # This is a (minimalist) copy of the logic in visit_import_from(), we need |
| 3246 | # to clean-up any remaining placeholders by replacing them with Var(Any). |
| 3247 | if isinstance(node.node, PlaceholderNode) and self.final_iteration: |
| 3248 | self.add_unknown_imported_symbol( |
| 3249 | name, i, target_name=None, module_public=True, module_hidden=False |
| 3250 | ) |
| 3251 | |
| 3252 | else: |
| 3253 | # Don't add any dummy symbols for 'from x import *' if 'x' is unknown. |
| 3254 | pass |
| 3255 | |
| 3256 | # |
| 3257 | # Assignment |
nothing calls this directly
no test coverage detected