e57cb3a32733ea69f91e80378d3828a458581a1e,pyemma/coordinates/data/util/reader_utils.py,,create_file_reader,#Any#Any#Any#Any#,29

Before Change


                raise ValueError("Some of the given input files were directories"
                                 " or did not exist:\n%s" % err_msg)

            if all_exist:
                // we need to check for h5 first, because of mdtraj custom HDF5 traj format (which is deprecated).
                if suffix in [".h5", ".hdf5"]:
                    // TODO: inspect if it is a mdtraj h5 file, eg. has the given attributes
                    try:
                        from mdtraj.formats import HDF5TrajectoryFile
                        HDF5TrajectoryFile(input_list[0])
                        reader = FeatureReader(input_list, featurizer=featurizer, topologyfile=topology,
                                               chunksize=chunksize)
                    except:
                        from pyemma.coordinates.data.h5_reader import H5Reader
                        reader = H5Reader(filenames=input_files, chunk_size=chunksize, **kw)
                // CASE 1.1: file types are MD files
                elif FeatureReader.supports_format(suffix):
                    // check: do we either have a featurizer or a topology file name? If not: raise ValueError.
                    // create a MD reader with file names and topology
                    if not featurizer and not topology:
                        raise ValueError("The input files were MD files which makes it mandatory to have either a "
                                         "featurizer or a topology file.")

                    reader = FeatureReader(input_list, featurizer=featurizer, topologyfile=topology,
                                           chunksize=chunksize)
                else:
                    if suffix in [".npy", ".npz"]:
                        reader = NumPyFileReader(input_list, chunksize=chunksize)
                    // otherwise we assume that given files are ascii tabulated data
                    else:
                        reader = PyCSVReader(input_list, chunksize=chunksize, **kw)
        else:
            raise ValueError("Not all elements in the input list were of the type %s!" % suffix)
    else:
        raise ValueError("Input \"%s\" was no string or list of strings." % input)

After Change


            // do all the files exist? If not: Raise value error
            all_exist = True
            from six import StringIO
            err_msg = StringIO()
            for item in input_list:
                if not os.path.isfile(item):
                    err_msg.write("\n" if err_msg.tell() > 0 else "")
                    err_msg.write("File %s did not exist or was no file" % item)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: markovmodel/PyEMMA
Commit Name: e57cb3a32733ea69f91e80378d3828a458581a1e
Time: 2018-11-22
Author: m.scherer@fu-berlin.de
File Name: pyemma/coordinates/data/util/reader_utils.py
Class Name:
Method Name: create_file_reader


Project Name: prody/ProDy
Commit Name: e93f4d4dcd70fc3eaf87779fc9f0b34f98e04ac8
Time: 2012-10-17
Author: lordnapi@gmail.com
File Name: lib/prody/utilities/pathtools.py
Class Name:
Method Name: gunzip


Project Name: vatlab/SoS
Commit Name: 97a77b0a7fcb34c422d0150fff101946f77c745a
Time: 2017-07-13
Author: ben.bob@gmail.com
File Name: src/sos/converter.py
Class Name:
Method Name: script_to_html