parameters: (module, fromlist, import_, *, recursive=False)
return_statement: return module
docstring: Figure out what __import__ should return.
  
      The import_ parameter is a callable which takes the name of module to
      import. It is required to decouple the function from assuming importlib's
      import implementation is desired.
docstring_summary: Figure out what __import__ should return.
docstring_tokens: Figure out what __import__ should return .
function: def _handle_fromlist(module, fromlist, import_, *, recursive=False):
      """Figure out what __import__ should return.
  
      The import_ parameter is a callable which takes the name of module to
      import. It is required to decouple the function from assuming importlib's
      import implementation is desired.
  
      """
      # The hell that is fromlist ...
      # If a package was imported, try to import stuff from fromlist.
      if hasattr(module, '__path__'):
          for x in fromlist:
              if not isinstance(x, str):
                  if recursive:
                      where = module.__name__ + '.__all__'
                  else:
                      where = "``from list''"
                  raise TypeError(f"Item in {where} must be str, "
                                  f"not {type(x).__name__}")
              elif x == '*':
                  if not recursive and hasattr(module, '__all__'):
                      _handle_fromlist(module, module.__all__, import_,
                                       recursive=True)
              elif not hasattr(module, x):
                  from_name = '{}.{}'.format(module.__name__, x)
                  try:
                      _call_with_frames_removed(import_, from_name)
                  except ModuleNotFoundError as exc:
                      # Backwards-compatibility dictates we ignore failed
                      # imports triggered by fromlist for modules that don't
                      # exist.
                      if (exc.name == from_name and
                          sys.modules.get(from_name, _NEEDS_LOADING) is not None):
                          continue
                      raise
      return module
function_tokens: def _handle_fromlist ( module , fromlist , import_ , * , recursive = False ) : # The hell that is fromlist ... # If a package was imported, try to import stuff from fromlist. if hasattr ( module , '__path__' ) : for x in fromlist : if not isinstance ( x , str ) : if recursive : where = module . __name__ + '.__all__' else : where = "``from list''" raise TypeError ( f"Item in {where} must be str, " f"not {type(x).__name__}" ) elif x == '*' : if not recursive and hasattr ( module , '__all__' ) : _handle_fromlist ( module , module . __all__ , import_ , recursive = True ) elif not hasattr ( module , x ) : from_name = '{}.{}' . format ( module . __name__ , x ) try : _call_with_frames_removed ( import_ , from_name ) except ModuleNotFoundError as exc : # Backwards-compatibility dictates we ignore failed # imports triggered by fromlist for modules that don't # exist. if ( exc . name == from_name and sys . modules . get ( from_name , _NEEDS_LOADING ) is not None ) : continue raise return module