code: def _build_index():
      
      global _module_file_index
      _module_file_index = {
          mod.__file__: mod.__name__
          for mod in sys.modules.values()
          if hasattr(mod, '__file__') and hasattr(mod, '__name__')
      }
docs: Rebuild _module_file_index from sys.modules