Read an ExodusII file (``'.e'`` or ``'.exo'``)
773865
def read_exodus(filename,
                animate_mode_shapes=True,
                apply_displacements=True,
                displacement_magnitude=1.0,
                enabled_sidesets=None):
    """"""
    reader = vtk.vtkExodusIIReader()
    reader.SetFileName(filename)
    reader.UpdateInformation()
    reader.SetAnimateModeShapes(animate_mode_shapes)
    reader.SetApplyDisplacements(apply_displacements)
    reader.SetDisplacementMagnitude(displacement_magnitude)

    if enabled_sidesets is None:
        enabled_sidesets = list(range(reader.GetNumberOfSideSetArrays()))

    for sideset in enabled_sidesets:
        if isinstance(sideset, int):
            name = reader.GetSideSetArrayName(sideset)
        elif isinstance(sideset, str):
            name = sideset
        else:
            raise ValueError('Could not parse sideset ID/name: {}'.format(sideset))

        reader.SetSideSetArrayStatus(name, 1)

    reader.Update()
    return vtki.wrap(reader.GetOutput())
891821
def _read_etc(etc_file):
    
    etc_type = dtype([('offset', '<i'),
                      ('samplestamp', '<i'),
                      ('sample_num', '<i'),
                      ('sample_span', '<h'),
                      ('unknown', '<h')])

    with etc_file.open('rb') as f:
        f.seek(352)  # end of header
        etc = fromfile(f, dtype=etc_type)

    return etc
91029
def scan_path(executable="mongod"):
    
    for path in os.environ.get("PATH", "").split(":"):
        path = os.path.abspath(path)
        executable_path = os.path.join(path, executable)
        if os.path.exists(executable_path):
            return executable_path
26649
def reader(self):
        from ambry.orm.exc import NotFoundError
        from fs.errors import ResourceNotFoundError
        """"""

        try:
            return self.datafile.reader
        except ResourceNotFoundError:
            raise NotFoundError("Failed to find partition file, '{}' "
                                .format(self.datafile.path))
1290611
def read_dir(input_dir,input_ext,func):
    ''''''
    import os
    for dirpath, dnames, fnames in os.walk(input_dir):
        for fname in fnames:
            if not dirpath.endswith(os.sep):
                dirpath = dirpath + os.sep
            if fname.endswith(input_ext):
                func(read_file(dirpath + fname))
1017969
def get_readme(name='README.rst'):
    """"""
    with open(name) as f:
        return '\n'.join(
            line for line in f.read().splitlines()
            if not line.startswith('|') or not line.endswith('|'))
1034418
def load_to_ufos(
    file_or_path, include_instances=False, family_name=None, propagate_anchors=True
):
    """"""

    if hasattr(file_or_path, "read"):
        font = load(file_or_path)
    else:
        with open(file_or_path, "r", encoding="utf-8") as ifile:
            font = load(ifile)
    logger.info("Loading to UFOs")
    return to_ufos(
        font,
        include_instances=include_instances,
        family_name=family_name,
        propagate_anchors=propagate_anchors,
    )
968906
def readFAM(basefilename,usecols=None):
    
    fam = basefilename+'.fam'
    fam = SP.loadtxt(fam,dtype=bytes,usecols=usecols)
    return fam
1064478
def read_python_code(filename):
    ""
    file = open(filename, "rt")
    try:
        source = file.read()
    finally:
        file.close()
    # Python 2.6 and below did not support passing strings to exec() &
    # compile() functions containing line separators other than '\n'. To
    # support them we need to manually make sure such line endings get
    # converted even on platforms where this is not handled by native text file
    # read operations.
    source = source.replace("\r\n", "\n").replace("\r", "\n")
    return compile(source, filename, "exec")
997274
def read(self, path, ext=None, start=None, stop=None, recursive=False, npartitions=None):
        
        from .utils import connection_with_anon, connection_with_gs

        path = addextension(path, ext)
        scheme, bucket_name, keylist = self.getfiles(
            path, start=start, stop=stop, recursive=recursive)

        if not keylist:
            raise FileNotFoundError("No objects found for '%s'" % path)

        credentials = self.credentials

        self.nfiles = len(keylist)

        if spark and isinstance(self.engine, spark):

            def getsplit(kvIter):
                if scheme == 's3' or scheme == 's3n':
                    conn = connection_with_anon(credentials)
                    bucket = conn.get_bucket(bucket_name)
                elif scheme == 'gs':
                    conn = boto.storage_uri(bucket_name, 'gs')
                    bucket = conn.get_bucket()
                else:
                    raise NotImplementedError("No file reader implementation for URL scheme " + scheme)

                for kv in kvIter:
                    idx, keyname = kv
                    key = bucket.get_key(keyname)
                    buf = key.get_contents_as_string()
                    yield idx, buf, keyname

            npartitions = min(npartitions, self.nfiles) if npartitions else self.nfiles
            rdd = self.engine.parallelize(enumerate(keylist), npartitions)
            return rdd.mapPartitions(getsplit)

        else:

            if scheme == 's3' or scheme == 's3n':
                conn = connection_with_anon(credentials)
                bucket = conn.get_bucket(bucket_name)
            elif scheme == 'gs':
                conn = connection_with_gs(bucket_name)
                bucket = conn.get_bucket()
            else:
                raise NotImplementedError("No file reader implementation for URL scheme " + scheme)

            def getsplit(kv):
                idx, keyName = kv
                key = bucket.get_key(keyName)
                buf = key.get_contents_as_string()
                return idx, buf, keyName

            return [getsplit(kv) for kv in enumerate(keylist)]
667177
def read(self, path, ext=None, start=None, stop=None, recursive=False, npartitions=None):
        
        path = uri_to_path(path)
        files = self.list(path, ext=ext, start=start, stop=stop, recursive=recursive)

        nfiles = len(files)
        self.nfiles = nfiles

        if spark and isinstance(self.engine, spark):
            npartitions = min(npartitions, nfiles) if npartitions else nfiles
            rdd = self.engine.parallelize(enumerate(files), npartitions)
            return rdd.map(lambda kv: (kv[0], readlocal(kv[1]), kv[1]))
        else:
            return [(k, readlocal(v), v) for k, v in enumerate(files)]
955141
def read(self, source_path):
        """"""

        self._metadata = {}
        with pelican_open(source_path) as text:
            content = creole2html(text, macros={'header': self._parse_header_macro,
                                            'code': self._parse_code_macro})
        return content, self._metadata
804135
def read(opts = {})
      Bunto.logger.debug "Reading:", relative_path

      if yaml_file?
        @data = SafeYAML.load_file(path)
      else
        begin
          merge_defaults
          read_content(opts)
          read_post_data
        rescue SyntaxError => e
          Bunto.logger.error "Error:", "YAML Exception reading #{path}: #{e.message}"
        rescue => e
          raise e if e.is_a? Bunto::Errors::FatalException
          Bunto.logger.error "Error:", "could not read file #{path}: #{e.message}"
        end
      end
    end
68205
def read(fname, fail_silently=False):
        
        try:
            filepath = os.path.join(os.path.dirname(__file__), fname)
            with io.open(filepath, 'rt', encoding='utf8') as f:
                return f.read()
        except:
            if not fail_silently:
                raise
            return ''
703819
def read(path, savedir):
        "  "
        if path.startswith('http://'):
            name = op.basename(path)
            save_path = op.join(savedir, name)
            if not op.exists(save_path):
                src = urllib2.urlopen(path).read()
                try:
                    open(save_path, 'w').write(src)
                except IOError:
                    return src
            path = save_path
        return open(path, 'r').read()
1296771
def read(filename):
    
    # The format is specified at
    # <http://www.intes.de>.

    cells = {}
    meshio_to_permas_type = {
        "vertex": (1, "PLOT1"),
        "line": (2, "PLOTL2"),
        "triangle": (3, "TRIA3"),
        "quad": (4, "QUAD4"),
        "tetra": (4, "TET4"),
        "hexahedron": (8, "HEXE8"),
        "wedge": (6, "PENTA6"),
        "pyramid": (5, "PYRA5"),
    }

    opener = gzip.open if filename.endswith(".gz") else open

    with opener(filename, "rb") as f:
        while True:
            line = f.readline().decode("utf-8")
            if not line or re.search("\\$END STRUCTURE", line):
                break
            for meshio_type, permas_ele in meshio_to_permas_type.items():
                num_nodes = permas_ele[0]
                permas_type = permas_ele[1]

                if re.search("\\$ELEMENT TYPE = {}".format(permas_type), line):
                    while True:
                        line = f.readline().decode("utf-8")
                        if not line or line.startswith("!"):
                            break
                        data = numpy.array(line.split(), dtype=int)
                        if meshio_type in cells:
                            cells[meshio_type].append(data[-num_nodes:])
                        else:
                            cells[meshio_type] = [data[-num_nodes:]]

            if re.search("\\$COOR", line):
                points = []
                while True:
                    line = f.readline().decode("utf-8")
                    if not line or line.startswith("!"):
                        break
                    for r in numpy.array(line.split(), dtype=float)[1:]:
                        points.append(r)

    points = numpy.array(points)
    points = numpy.reshape(points, newshape=(len(points) // 3, 3))
    for key in cells:
        # Subtract one to account for the fact that python indices
        # are 0-based.
        cells[key] = numpy.array(cells[key], dtype=int) - 1

    return Mesh(points, cells)
722549
def read(fname):
    """"""
    content = None
    with open(os.path.join(here, fname)) as f:
        content = f.read()
    return content