parameters: (glob, comment_prefix)
return_statement: return printed_count
docstring: Prints names of all files missing either a copyright or Apache 2 license.
  
      Finds all glob-matching files under the current directory and checks if they
      contain the copyright message and license notice.  Prints the names of all the
      files that don't meet both criteria.
  
      Returns the total number of file names printed.
docstring_summary: Prints names of all files missing either a copyright or Apache 2 license.
docstring_tokens: Prints names of all files missing either a copyright or Apache 2 license .
function: def alert_if_no_copyright(glob, comment_prefix):
      """Prints names of all files missing either a copyright or Apache 2 license.
  
      Finds all glob-matching files under the current directory and checks if they
      contain the copyright message and license notice.  Prints the names of all the
      files that don't meet both criteria.
  
      Returns the total number of file names printed.
      """
      printed_count = 0
      for file in filtered_descendants(glob):
          has_copyright = False
          has_apache2 = False
          line_num = 0
          apache_expected_end = 0
          with open(file, encoding='utf-8') as contents:
              for line in contents:
                  line_num += 1
                  if COPYRIGHT_RE.search(line):
                      has_copyright = True
                  if APACHE2_BEGIN_RE.search(line):
                      apache_expected_end = line_num + LICENSED_LEN
                  if (line_num is apache_expected_end) and APACHE2_END_RE.search(line):
                      has_apache2 = True
          if not (has_copyright and has_apache2):
              message = file
              if not has_copyright:
                  message += ' has no copyright'
              if not has_apache2:
                  message += ' has no Apache 2 license notice'
              print(message)
              printed_count += 1
      return printed_count
function_tokens: def alert_if_no_copyright ( glob , comment_prefix ) : printed_count = 0 for file in filtered_descendants ( glob ) : has_copyright = False has_apache2 = False line_num = 0 apache_expected_end = 0 with open ( file , encoding = 'utf-8' ) as contents : for line in contents : line_num += 1 if COPYRIGHT_RE . search ( line ) : has_copyright = True if APACHE2_BEGIN_RE . search ( line ) : apache_expected_end = line_num + LICENSED_LEN if ( line_num is apache_expected_end ) and APACHE2_END_RE . search ( line ) : has_apache2 = True if not ( has_copyright and has_apache2 ) : message = file if not has_copyright : message += ' has no copyright' if not has_apache2 : message += ' has no Apache 2 license notice' print ( message ) printed_count += 1 return printed_count