parameters: ()
return_statement: return main_module_name
docstring: Returns: string, name of the module from which execution started.
docstring_summary: Returns: string, name of the module from which execution started.
docstring_tokens: Returns : string name of the module from which execution started .
function: def _GetMainModule():
    """Returns: string, name of the module from which execution started."""
    # First, try to use the same logic used by _GetCallingModuleObjectAndName(),
    # i.e., call _GetModuleObjectAndName().  For that we first need to
    # find the dictionary that the main module uses to store the
    # globals.
    #
    # That's (normally) the same dictionary object that the deepest
    # (oldest) stack frame is using for globals.
    deepest_frame = sys._getframe(0)
    while deepest_frame.f_back is not None:
      deepest_frame = deepest_frame.f_back
    globals_for_main_module = deepest_frame.f_globals
    main_module_name = _GetModuleObjectAndName(globals_for_main_module)[1]
    # The above strategy fails in some cases (e.g., tools that compute
    # code coverage by redefining, among other things, the main module).
    # If so, just use sys.argv[0].  We can probably always do this, but
    # it's safest to try to use the same logic as _GetCallingModuleObjectAndName()
    if main_module_name is None:
      main_module_name = sys.argv[0]
    return main_module_name
function_tokens: def _GetMainModule ( ) : # First, try to use the same logic used by _GetCallingModuleObjectAndName(), # i.e., call _GetModuleObjectAndName().  For that we first need to # find the dictionary that the main module uses to store the # globals. # # That's (normally) the same dictionary object that the deepest # (oldest) stack frame is using for globals. deepest_frame = sys . _getframe ( 0 ) while deepest_frame . f_back is not None : deepest_frame = deepest_frame . f_back globals_for_main_module = deepest_frame . f_globals main_module_name = _GetModuleObjectAndName ( globals_for_main_module ) [ 1 ] # The above strategy fails in some cases (e.g., tools that compute # code coverage by redefining, among other things, the main module). # If so, just use sys.argv[0].  We can probably always do this, but # it's safest to try to use the same logic as _GetCallingModuleObjectAndName() if main_module_name is None : main_module_name = sys . argv [ 0 ] return main_module_name