def main():
 errors = 0
 fits_files = handle_options(sys.argv[1:])
 setup_logging()
 for filename in fits_files:
  errors += process_file(filename)
 if errors:
  log.warning('{} errors'.format(errors))
 return int(bool(errors))

def main ( ) : errors = 0 fits_files = handle_options ( sys . argv [ 1 : ] ) setup_logging ( ) for filename in fits_files : errors += process_file ( filename ) if errors : log . warning ( '{} errors' . format ( errors ) ) return int ( bool ( errors ) )
construct main app and run it .