(
self,
node: SymbolTableNode,
module_id: str,
id: str,
imported_id: str,
fullname: str,
module_public: bool,
context: ImportBase,
)
| 3063 | ) |
| 3064 | |
| 3065 | def process_imported_symbol( |
| 3066 | self, |
| 3067 | node: SymbolTableNode, |
| 3068 | module_id: str, |
| 3069 | id: str, |
| 3070 | imported_id: str, |
| 3071 | fullname: str, |
| 3072 | module_public: bool, |
| 3073 | context: ImportBase, |
| 3074 | ) -> None: |
| 3075 | module_hidden = not module_public and ( |
| 3076 | # `from package import submodule` should work regardless of whether package |
| 3077 | # re-exports submodule, so we shouldn't hide it |
| 3078 | not isinstance(node.node, MypyFile) |
| 3079 | or fullname not in self.modules |
| 3080 | # but given `from somewhere import random_unrelated_module` we should hide |
| 3081 | # random_unrelated_module |
| 3082 | or not fullname.startswith(self.cur_mod_id + ".") |
| 3083 | ) |
| 3084 | |
| 3085 | if isinstance(node.node, PlaceholderNode): |
| 3086 | if self.final_iteration: |
| 3087 | self.report_missing_module_attribute( |
| 3088 | module_id, |
| 3089 | id, |
| 3090 | imported_id, |
| 3091 | module_public=module_public, |
| 3092 | module_hidden=module_hidden, |
| 3093 | context=context, |
| 3094 | ) |
| 3095 | return |
| 3096 | else: |
| 3097 | # This might become a type. |
| 3098 | self.mark_incomplete( |
| 3099 | imported_id, |
| 3100 | node.node, |
| 3101 | module_public=module_public, |
| 3102 | module_hidden=module_hidden, |
| 3103 | becomes_typeinfo=True, |
| 3104 | ) |
| 3105 | # NOTE: we take the original node even for final `Var`s. This is to support |
| 3106 | # a common pattern when constants are re-exported (same applies to import *). |
| 3107 | self.add_imported_symbol( |
| 3108 | imported_id, node, context, module_public=module_public, module_hidden=module_hidden |
| 3109 | ) |
| 3110 | |
| 3111 | def report_missing_module_attribute( |
| 3112 | self, |
no test coverage detected