def semantic_analyze_target(target: str, state: 'State', node: Union[MypyFile, FuncDef, OverloadedFuncDef, Decorator], active_type: Optional[TypeInfo], final_iteration: bool) -> Tuple[List[str], bool]: tree = state.tree assert tree is not None analyzer = state.manager.new_semantic_analyzer # TODO: Move initialization to somewhere else analyzer.global_decls = [set()] analyzer.nonlocal_decls = [set()] analyzer.globals = tree.names with state.wrap_context(): with analyzer.file_context(file_node=tree, fnam=tree.path, options=state.options, active_type=active_type): refresh_node = node if isinstance(refresh_node, Decorator): # Decorator expressions will be processed as part of the module top level. refresh_node = refresh_node.func analyzer.refresh_partial(refresh_node, [], final_iteration) if isinstance(node, Decorator): infer_decorator_signature_if_simple(node, analyzer) if analyzer.deferred: return [target], analyzer.incomplete else: return [], analyzer.incomplete
def semantic_analyze_target(target: str, state: 'State', node: Union[MypyFile, FuncDef, OverloadedFuncDef, Decorator], active_type: Optional[TypeInfo], final_iteration: bool, patches: Patches) -> Tuple[List[str], bool, bool]: """Semantically analyze a single target. Return tuple with these items: - list of deferred targets - was some definition incomplete - were any new names were defined (or placeholders replaced) """ state.manager.processed_targets.append(target) tree = state.tree assert tree is not None analyzer = state.manager.new_semantic_analyzer # TODO: Move initialization to somewhere else analyzer.global_decls = [set()] analyzer.nonlocal_decls = [set()] analyzer.globals = tree.names analyzer.progress = False with state.wrap_context(check_blockers=False): refresh_node = node if isinstance(refresh_node, Decorator): # Decorator expressions will be processed as part of the module top level. refresh_node = refresh_node.func analyzer.refresh_partial(refresh_node, patches, final_iteration, file_node=tree, options=state.options, active_type=active_type) if isinstance(node, Decorator): infer_decorator_signature_if_simple(node, analyzer) for dep in analyzer.imports: state.dependencies.append(dep) priority = mypy.build.PRI_LOW if priority <= state.priorities.get(dep, priority): state.priorities[dep] = priority if analyzer.deferred: return [target], analyzer.incomplete, analyzer.progress else: return [], analyzer.incomplete, analyzer.progress
def semantic_analyze_target(target: str, state: 'State', node: Union[MypyFile, FuncDef, OverloadedFuncDef, Decorator], active_type: Optional[TypeInfo], final_iteration: bool, patches: Patches) -> Tuple[List[str], bool, bool]: """Semantically analyze a single target. Return tuple with these items: - list of deferred targets - was some definition incomplete - were any new names were defined (or placeholders replaced) """ tree = state.tree assert tree is not None analyzer = state.manager.new_semantic_analyzer # TODO: Move initialization to somewhere else analyzer.global_decls = [set()] analyzer.nonlocal_decls = [set()] analyzer.globals = tree.names analyzer.progress = False with state.wrap_context(check_blockers=False): with analyzer.file_context(file_node=tree, fnam=tree.path, options=state.options, active_type=active_type): refresh_node = node if isinstance(refresh_node, Decorator): # Decorator expressions will be processed as part of the module top level. refresh_node = refresh_node.func analyzer.refresh_partial(refresh_node, patches, final_iteration) if isinstance(node, Decorator): infer_decorator_signature_if_simple(node, analyzer) for dep in analyzer.imports: state.dependencies.append(dep) priority = mypy.build.PRI_LOW if priority <= state.priorities.get(dep, priority): state.priorities[dep] = priority if analyzer.deferred: return [target], analyzer.incomplete, analyzer.progress else: return [], analyzer.incomplete, analyzer.progress