class_docstr: Lazily import a module, mainly to avoid pulling in large dependencies.
class_docstr_tok: ["Lazily","import","a","module",",","mainly","to","avoid","pulling","in","large","dependencies","."]
docstr: Load the module and insert it into the parent's globals.
docstr_tok: ["Load","the","module","and","insert","it","into","the","parent","'s","globals","."]
code: def _load(self) -> types.ModuleType:
      """Load the module and insert it into the parent's globals."""
      # Import the target module and insert it into the parent's namespace
      module = importlib.import_module(self.__name__)
      self._parent_module_globals[self._local_name] = module
  
      # Emit a warning if one was specified
      if self._warning:
          logging.warning(self._warning)
          # Make sure to only warn once.
      self._warning = None
  
      # Update this object's dict so that if someone keeps a reference to the
      #   LazyLoader, lookups are efficient (__getattr__ is only called on lookups
      #   that fail).
      self.__dict__.update(module.__dict__)
  
      return module
  
file_path: xgboost/python-package/xgboost/compat.py
imports: import importlib.util
  import logging
  import sys
  import types
  from typing import Any, Dict, List, Optional, Sequence, cast
  import numpy
  from ._typing import _T
label_desc: Use image node_id 2 for calling the LazyLoader obj's underlying member method code with example usage: obj._load() and returns: module