parameters: (self, text:str)
return_statement: return []
docstring: Match class names and attributes for %config magic
docstring_summary: Match class names and attributes for %config magic
docstring_tokens: Match class names and attributes for %config magic
function: def magic_config_matches(self, text:str) -> List[str]:
          """ Match class names and attributes for %config magic """
          texts = text.strip().split()
  
          if len(texts) > 0 and (texts[0] == 'config' or texts[0] == '%config'):
              # get all configuration classes
              classes = sorted(set([ c for c in self.shell.configurables
                                     if c.__class__.class_traits(config=True)
                                     ]), key=lambda x: x.__class__.__name__)
              classnames = [ c.__class__.__name__ for c in classes ]
  
              # return all classnames if config or %config is given
              if len(texts) == 1:
                  return classnames
  
              # match classname
              classname_texts = texts[1].split('.')
              classname = classname_texts[0]
              classname_matches = [ c for c in classnames
                                    if c.startswith(classname) ]
  
              # return matched classes or the matched class with attributes
              if texts[1].find('.') < 0:
                  return classname_matches
              elif len(classname_matches) == 1 and \
                              classname_matches[0] == classname:
                  cls = classes[classnames.index(classname)].__class__
                  help = cls.class_get_help()
                  # strip leading '--' from cl-args:
                  help = re.sub(re.compile(r'^--', re.MULTILINE), '', help)
                  return [ attr.split('=')[0]
                           for attr in help.strip().splitlines()
                           if attr.startswith(texts[1]) ]
          return []
function_tokens: def magic_config_matches ( self , text : str ) -> List [ str ] : texts = text . strip ( ) . split ( ) if len ( texts ) > 0 and ( texts [ 0 ] == 'config' or texts [ 0 ] == '%config' ) : # get all configuration classes classes = sorted ( set ( [ c for c in self . shell . configurables if c . __class__ . class_traits ( config = True ) ] ) , key = lambda x : x . __class__ . __name__ ) classnames = [ c . __class__ . __name__ for c in classes ] # return all classnames if config or %config is given if len ( texts ) == 1 : return classnames # match classname classname_texts = texts [ 1 ] . split ( '.' ) classname = classname_texts [ 0 ] classname_matches = [ c for c in classnames if c . startswith ( classname ) ] # return matched classes or the matched class with attributes if texts [ 1 ] . find ( '.' ) < 0 : return classname_matches elif len ( classname_matches ) == 1 and classname_matches [ 0 ] == classname : cls = classes [ classnames . index ( classname ) ] . __class__ help = cls . class_get_help ( ) # strip leading '--' from cl-args: help = re . sub ( re . compile ( r'^--' , re . MULTILINE ) , '' , help ) return [ attr . split ( '=' ) [ 0 ] for attr in help . strip ( ) . splitlines ( ) if attr . startswith ( texts [ 1 ] ) ] return [ ]