original_docstring: Checks if two words are anagrams of each other.
docstring: Checks if two words are anagrams of each other.
docstring_tokens: Checks if two words are anagrams of each other .
code: def index():
      """Checks if two words are anagrams of each other."""
      error = None
      if request.method == 'POST':
          token = session.pop('_csrf_token', None)
          if not token or token != request.form.get('_csrf_token'):
              abort(403)
          else:
              string_1 = request.form.get("firststring")
              string_2 = request.form.get("secondstring")
              if "" in [string_1, string_2]:
                  flash('Oops, you missed a step! Enter two phrases to compare.', 'error')
              else:
                  ignore_formatting = request.form.get("ignore_formatting")
                  message_start = '"{0}" and "{1}" are '.format(string_1, string_2)
                  anagrams = message_start+' anagrams.'
                  non_anagrams = message_start+' NOT anagrams.'
                  if ignore_formatting:
                      #  this removes whitespace and special characters
                      chars_1 = ''.join(e for e in string_1 if e.isalnum())
                      chars_2 = ''.join(e for e in string_2 if e.isalnum())
                      #  this removes case
                      string_1 = chars_1.lower()
                      string_2 = chars_2.lower()
                  if len(string_1) != len(string_2):
                      flash(non_anagrams, 'warning')
                  elif sorted(string_1) != sorted(string_2):
                      flash(non_anagrams, 'warning')
                  else:
                      flash(anagrams, 'info')
      return render_template('index.html')
code_tokens: def index ( ) : error = None if request . method == 'POST' : token = session . pop ( '_csrf_token' , None ) if not token or token != request . form . get ( '_csrf_token' ) : abort ( 403 ) else : string_1 = request . form . get ( "firststring" ) string_2 = request . form . get ( "secondstring" ) if "" in [ string_1 , string_2 ] : flash ( 'Oops, you missed a step! Enter two phrases to compare.' , 'error' ) else : ignore_formatting = request . form . get ( "ignore_formatting" ) message_start = '"{0}" and "{1}" are ' . format ( string_1 , string_2 ) anagrams = message_start + ' anagrams.' non_anagrams = message_start + ' NOT anagrams.' if ignore_formatting : chars_1 = '' . join ( e for e in string_1 if e . isalnum ( ) ) chars_2 = '' . join ( e for e in string_2 if e . isalnum ( ) ) string_1 = chars_1 . lower ( ) string_2 = chars_2 . lower ( ) if len ( string_1 ) != len ( string_2 ) : flash ( non_anagrams , 'warning' ) elif sorted ( string_1 ) != sorted ( string_2 ) : flash ( non_anagrams , 'warning' ) else : flash ( anagrams , 'info' ) return render_template ( 'index.html' )
short_docstring: Checks if two words are anagrams of each other.
short_docstring_tokens: Checks if two words are anagrams of each other .
comment: """Checks if two words are anagrams of each other."""$SEP$#  this removes whitespace and special characters$SEP$#  this removes case