parameters: (self, user_module=None, user_ns=None)
return_statement: return user_module, user_ns
docstring: Prepare the module and namespace in which user code will be run.
          
          When IPython is started normally, both parameters are None: a new module
          is created automatically, and its __dict__ used as the namespace.
          
          If only user_module is provided, its __dict__ is used as the namespace.
          If only user_ns is provided, a dummy module is created, and user_ns
          becomes the global namespace. If both are provided (as they may be
          when embedding), user_ns is the local namespace, and user_module
          provides the global namespace.
  
          Parameters
          ----------
          user_module : module, optional
              The current user module in which IPython is being run. If None,
              a clean module will be created.
          user_ns : dict, optional
              A namespace in which to run interactive commands.
  
          Returns
          -------
          A tuple of user_module and user_ns, each properly initialised.
docstring_summary: Prepare the module and namespace in which user code will be run.
          
          When IPython is started normally, both parameters are None: a new module
          is created automatically, and its __dict__ used as the namespace.
          
          If only user_module is provided, its __dict__ is used as the namespace.
          If only user_ns is provided, a dummy module is created, and user_ns
          becomes the global namespace. If both are provided (as they may be
          when embedding), user_ns is the local namespace, and user_module
          provides the global namespace.
docstring_tokens: Prepare the module and namespace in which user code will be run . When IPython is started normally both parameters are None : a new module is created automatically and its __dict__ used as the namespace . If only user_module is provided its __dict__ is used as the namespace . If only user_ns is provided a dummy module is created and user_ns becomes the global namespace . If both are provided ( as they may be when embedding ) user_ns is the local namespace and user_module provides the global namespace .
function: def prepare_user_module(self, user_module=None, user_ns=None):
          """Prepare the module and namespace in which user code will be run.
          
          When IPython is started normally, both parameters are None: a new module
          is created automatically, and its __dict__ used as the namespace.
          
          If only user_module is provided, its __dict__ is used as the namespace.
          If only user_ns is provided, a dummy module is created, and user_ns
          becomes the global namespace. If both are provided (as they may be
          when embedding), user_ns is the local namespace, and user_module
          provides the global namespace.
  
          Parameters
          ----------
          user_module : module, optional
              The current user module in which IPython is being run. If None,
              a clean module will be created.
          user_ns : dict, optional
              A namespace in which to run interactive commands.
  
          Returns
          -------
          A tuple of user_module and user_ns, each properly initialised.
          """
          if user_module is None and user_ns is not None:
              user_ns.setdefault("__name__", "__main__")
              user_module = DummyMod()
              user_module.__dict__ = user_ns
  
          if user_module is None:
              user_module = types.ModuleType("__main__",
                  doc="Automatically created module for IPython interactive environment")
  
          # We must ensure that __builtin__ (without the final 's') is always
          # available and pointing to the __builtin__ *module*.  For more details:
          # http://mail.python.org/pipermail/python-dev/2001-April/014068.html
          user_module.__dict__.setdefault('__builtin__', builtin_mod)
          user_module.__dict__.setdefault('__builtins__', builtin_mod)
  
          if user_ns is None:
              user_ns = user_module.__dict__
  
          return user_module, user_ns
function_tokens: def prepare_user_module ( self , user_module = None , user_ns = None ) : if user_module is None and user_ns is not None : user_ns . setdefault ( "__name__" , "__main__" ) user_module = DummyMod ( ) user_module . __dict__ = user_ns if user_module is None : user_module = types . ModuleType ( "__main__" , doc = "Automatically created module for IPython interactive environment" ) # We must ensure that __builtin__ (without the final 's') is always # available and pointing to the __builtin__ *module*.  For more details: # http://mail.python.org/pipermail/python-dev/2001-April/014068.html user_module . __dict__ . setdefault ( '__builtin__' , builtin_mod ) user_module . __dict__ . setdefault ( '__builtins__' , builtin_mod ) if user_ns is None : user_ns = user_module . __dict__ return user_module , user_ns