parameters: (subpatterns)
return_statement: return max(subpatterns, key=len)
docstring: Picks the most characteristic from a list of linear patterns
      Current order used is:
      names > common_names > common_chars
docstring_summary: Picks the most characteristic from a list of linear patterns
      Current order used is:
      names > common_names > common_chars
docstring_tokens: Picks the most characteristic from a list of linear patterns Current order used is : names > common_names > common_chars
function: def get_characteristic_subpattern(subpatterns):
      """Picks the most characteristic from a list of linear patterns
      Current order used is:
      names > common_names > common_chars
      """
      if not isinstance(subpatterns, list):
          return subpatterns
      if len(subpatterns)==1:
          return subpatterns[0]
  
      # first pick out the ones containing variable names
      subpatterns_with_names = []
      subpatterns_with_common_names = []
      common_names = ['in', 'for', 'if' , 'not', 'None']
      subpatterns_with_common_chars = []
      common_chars = "[]().,:"
      for subpattern in subpatterns:
          if any(rec_test(subpattern, lambda x: type(x) is str)):
              if any(rec_test(subpattern,
                              lambda x: isinstance(x, str) and x in common_chars)):
                  subpatterns_with_common_chars.append(subpattern)
              elif any(rec_test(subpattern,
                                lambda x: isinstance(x, str) and x in common_names)):
                  subpatterns_with_common_names.append(subpattern)
  
              else:
                  subpatterns_with_names.append(subpattern)
  
      if subpatterns_with_names:
          subpatterns = subpatterns_with_names
      elif subpatterns_with_common_names:
          subpatterns = subpatterns_with_common_names
      elif subpatterns_with_common_chars:
          subpatterns = subpatterns_with_common_chars
      # of the remaining subpatterns pick out the longest one
      return max(subpatterns, key=len)
function_tokens: def get_characteristic_subpattern ( subpatterns ) : if not isinstance ( subpatterns , list ) : return subpatterns if len ( subpatterns ) == 1 : return subpatterns [ 0 ] # first pick out the ones containing variable names subpatterns_with_names = [ ] subpatterns_with_common_names = [ ] common_names = [ 'in' , 'for' , 'if' , 'not' , 'None' ] subpatterns_with_common_chars = [ ] common_chars = "[]().,:" for subpattern in subpatterns : if any ( rec_test ( subpattern , lambda x : type ( x ) is str ) ) : if any ( rec_test ( subpattern , lambda x : isinstance ( x , str ) and x in common_chars ) ) : subpatterns_with_common_chars . append ( subpattern ) elif any ( rec_test ( subpattern , lambda x : isinstance ( x , str ) and x in common_names ) ) : subpatterns_with_common_names . append ( subpattern ) else : subpatterns_with_names . append ( subpattern ) if subpatterns_with_names : subpatterns = subpatterns_with_names elif subpatterns_with_common_names : subpatterns = subpatterns_with_common_names elif subpatterns_with_common_chars : subpatterns = subpatterns_with_common_chars # of the remaining subpatterns pick out the longest one return max ( subpatterns , key = len )