def json_formatall(filenames, indent=DEFAULT_INDENT_SIZE, dry_run=False):
 errors = 0
 console = logging.getLogger('console')
 for filename in filenames:
  try:
   result = json_format(filename, indent=indent, console=console, dry_run=dry_run)
   if (not result):
    errors += 1
  except Exception as e:
   console.error('ERROR %s: %s (filename: %s)', e.__class__.__name__, e, filename)
   errors += 1
 return errors

def json_formatall ( filenames , indent = DEFAULT_INDENT_SIZE , dry_run = False ) : errors = 0 console = logging . getLogger ( 'console' ) for filename in filenames : try : result = json_format ( filename , indent = indent , console = console , dry_run = dry_run ) if ( not result ) : errors += 1 except Exception as e : console . error ( 'ERROR %s: %s (filename: %s)' , e . __class__ . __name__ , e , filename ) errors += 1 return errors
format/beautify a json file .