MCPcopy Index your code
hub / github.com/python/mypy / skipping_ancestor

Function skipping_ancestor

mypy/build.py:3999–4012  ·  view source on GitHub ↗

Produce an error for an ancestor ignored due to --follow_imports=error

(manager: BuildManager, id: str, path: str, ancestor_for: State)

Source from the content-addressed store, hash-verified

3997
3998
3999def skipping_ancestor(manager: BuildManager, id: str, path: str, ancestor_for: State) -> None:
4000 """Produce an error for an ancestor ignored due to --follow_imports=error"""
4001 # TODO: Read the path (the __init__.py file) and return
4002 # immediately if it's empty or only contains comments.
4003 # But beware, some package may be the ancestor of many modules,
4004 # so we'd need to cache the decision.
4005 save_import_context = manager.errors.import_context()
4006 manager.errors.set_import_context([])
4007 manager.errors.set_file(ancestor_for.xpath, ancestor_for.id, manager.options)
4008 manager.error(None, f'Ancestor package "{id}" ignored', only_once=True)
4009 manager.note(
4010 None, "(Using --follow-imports=error, submodule passed on command line)", only_once=True
4011 )
4012 manager.errors.set_import_context(save_import_context)
4013
4014
4015def log_configuration(manager: BuildManager, sources: list[BuildSource]) -> None:

Callers 1

find_module_and_diagnoseFunction · 0.85

Calls 5

import_contextMethod · 0.80
set_import_contextMethod · 0.80
set_fileMethod · 0.80
errorMethod · 0.45
noteMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…