"""Read a list of files located in your local directory."""
from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str

import logging
import pickle
import random

logger = logging.getLogger('file_reader')
if __name__ == '__main__':
    parser = get_parser(
        __doc__,
        ('A file containing a list of files to be input into reach. These'
         'should be nxml or txt files.')
        )
    parser.add_argument(
        dest='output_name',
        help=('All pickled results will be saved in files labelled by '
              '<output_name>_<output_type>.pkl.')
        )
    args = parser.parse_args()
    if args.debug and not args.quiet:
        logger.setLevel(logging.DEBUG)
 

from indra.tools.reading.readers import _get_dir, get_readers
from indra.tools.reading.script_tools import get_parser, make_statements


def read_files(files, readers, **kwargs):
    """Read the files in `files` with the reader objects in `readers`.

    Parameters
    ----------
    files : list [str]
        A list of file paths to be read by the readers. Supported files are
        limited to text and nxml files.
    readers : list [Reader instances]
        A list of Reader objects to be used reading the files.
    **kwargs :
        Other keyword arguments are passed to the `read` method of the readers.

    Returns
    -------
    output_list : list [ReadingData]
        A list of ReadingData objects with the contents of the readings.
    """
    output_list = []
    for reader in readers:
        res_list = reader.read(files, **kwargs)
        if res_list is None:
            logger.info("Nothing read by %s." % reader.name)
        else:
            logger.info("Successfully read %d content entries with %s."
                        % (len(res_list), reader.name))
            output_list += res_list
    logger.info("Read %s text content entries in all." % len(output_list))
    return output_list


if __name__ == '__main__':
   with open(args.file_file, 'r') as f:
        input_lines = f.readlines()
    logger.info("Found %d files." % len(input_lines))
    for ftype in ['nxml', 'txt']:
        logger.debug('%d are %s' % (
            len([f for f in input_lines if f.endswith(ftype)]), ftype
            ))

    # Select only a sample of the lines, if sample is chosen.
    if args.sample is not None:
        input_lines = random.sample(input_lines, args.sample)

    # If a range is specified, only use that range.
    if args.in_range is not None:
        start_idx, end_idx = [int(n) for n in args.in_range.split(':')]
        input_lines = input_lines[start_idx:end_idx]

    # Create a single base directory
    base_dir = _get_dir('run_%s' % ('_and_'.join(args.readers)))

    # Set the verbosity. The quiet argument overrides the verbose argument.
    verbose = args.verbose and not args.quiet

    # Get the readers objects.
    readers = [reader_class(base_dir=base_dir, n_proc=args.num_procs)
               for reader_class in get_readers()
               if reader_class.name.lower() in args.readers]

    # Read the files.
    outputs = read_files(input_lines, readers, verboes=verbose)
    reading_out_path = args.output_name + '_readings.pkl'
    with open(reading_out_path, 'wb') as f:
        pickle.dump([output.make_tuple() for output in outputs], f)
    print("Reading outputs stored in %s." % reading_out_path)

    stmt_data_list = make_statements(outputs)
    stmts_pkl_path = args.output_name + '_stmts.pkl'
    with open(stmts_pkl_path, 'wb') as f:
        pickle.dump([sd.statement for sd in stmt_data_list], f)
        print("Statements pickled in %s." % stmts_pkl_path)

@@ -732,17 +732,16 @@
 .DEBUG)%0A
- 
 %0A%0Afrom i
@@ -1984,16 +1984,17 @@
 ain__':%0A
+ 
    with 

Fix indent error.