MCPcopy Index your code
hub / github.com/python/cpython / GetExtraHelpSourceList

Method GetExtraHelpSourceList

Lib/idlelib/config.py:690–720  ·  view source on GitHub ↗

Return list of extra help sources from a given configSet. Valid configSets are 'user' or 'default'. Return a list of tuples of the form (menu_item , path_to_help_file , option), or return the empty list. 'option' is the sequence number of the help resource. 'option'

(self, configSet)

Source from the content-addressed store, hash-verified

688 return keyBindings
689
690 def GetExtraHelpSourceList(self, configSet):
691 """Return list of extra help sources from a given configSet.
692
693 Valid configSets are 'user' or 'default'. Return a list of tuples of
694 the form (menu_item , path_to_help_file , option), or return the empty
695 list. 'option' is the sequence number of the help resource. 'option'
696 values determine the position of the menu items on the Help menu,
697 therefore the returned list must be sorted by 'option'.
698
699 """
700 helpSources = []
701 if configSet == 'user':
702 cfgParser = self.userCfg['main']
703 elif configSet == 'default':
704 cfgParser = self.defaultCfg['main']
705 else:
706 raise InvalidConfigSet('Invalid configSet specified')
707 options=cfgParser.GetOptionList('HelpFiles')
708 for option in options:
709 value=cfgParser.Get('HelpFiles', option, default=';')
710 if value.find(';') == -1: #malformed config entry with no ';'
711 menuItem = '' #make these empty
712 helpPath = '' #so value won't be added to list
713 else: #config entry contains ';' as expected
714 value=value.split(';')
715 menuItem=value[0].strip()
716 helpPath=value[1].strip()
717 if menuItem and helpPath: #neither are empty strings
718 helpSources.append( (menuItem,helpPath,option) )
719 helpSources.sort(key=lambda x: x[2])
720 return helpSources
721
722 def GetAllExtraHelpSourcesList(self):
723 """Return a list of the details of all additional help sources.

Callers 2

Calls 8

InvalidConfigSetClass · 0.85
GetOptionListMethod · 0.80
GetMethod · 0.80
findMethod · 0.45
splitMethod · 0.45
stripMethod · 0.45
appendMethod · 0.45
sortMethod · 0.45

Tested by 1