def indent_files(arguments):
    """ indent_files(fname : str)

    1. Creates a backup of the source file(backup_source_file())
    2. Reads the files contents(read_file())
    3. Indents the code(indent_code())
    4. Writes the file or print the indented code(_after_indentation())
    """
    opts = parse_options(arguments)
    if not opts.files:
        # Indent from stdin
        code = sys.stdin.read()
        indent_result = indent_code(code, opts)
        _after_indentation(indent_result)

    for fname in opts.files:
        code = read_file(fname)
        if not opts.dialect:
            # Guess dialect from the file extensions if none is specified in the
            # command line
            if fname.endswith('.lisp'):
                opts.dialect = 'lisp'
            elif fname.endswith('.lsp'):
                opts.dialect = 'newlisp'
            elif re.search(".clj[sc]{0,1}$", fname):
                opts.dialect = 'clojure'
            elif fname.endswith('.ss') or fname.endswith('.scm'):
                opts.dialect = 'scheme'
            else:
                opts.dialect = 'all'
        indent_result = indent_code(code, opts)

        if opts.backup:
            # Create a backup file in the directory specified
            backup_source_file(fname, opts)

        _after_indentation(indent_result, fpath=fname)
def indent_files ( arguments ) : opts = parse_options ( arguments ) if not opts . files : code = sys . stdin . read ( ) indent_result = indent_code ( code , opts ) _after_indentation ( indent_result ) for fname in opts . files : code = read_file ( fname ) if not opts . dialect : if fname . endswith ( '.lisp' ) : opts . dialect = 'lisp' elif fname . endswith ( '.lsp' ) : opts . dialect = 'newlisp' elif re . search ( ".clj[sc]{0,1}$" , fname ) : opts . dialect = 'clojure' elif fname . endswith ( '.ss' ) or fname . endswith ( '.scm' ) : opts . dialect = 'scheme' else : opts . dialect = 'all' indent_result = indent_code ( code , opts ) if opts . backup : backup_source_file ( fname , opts ) _after_indentation ( indent_result , fpath = fname )
indent_files(fname : str)

    1. Creates a backup of the source file(backup_source_file())
    2. Reads the files contents(read_file())
    3. Indents the code(indent_code())
    4. Writes the file or print the indented code(_after_indentation())