Return group content.

    Args:
        filename (:class:`pathlib.Path`): path of hdf5 file.
        groupname (str): name of group to read.
    Returns:
        :class:`numpy.array`: content of group.
503049
def _read_group_h5(filename, groupname):
    
    with h5py.File(filename, 'r') as h5f:
        data = h5f[groupname][()]
    return data
1238278
def parsefile(self, filename):
        
        with open(filename, 'rb') as fd:
            return self.parse(fd.read())
1139793
def readText (self, filename=None):
    
    if filename is None:
      filename = self.pathname

    self.header = { }
    inBody      = False

    with open(filename, 'rt') as stream:
      for (lineno, line) in enumerate(stream.readlines()):
        stripped = line.strip()
        if stripped == '':
          continue
        elif stripped.startswith('#'):
          if not inBody:
            self._parseHeader(line, lineno, self.log)
        else:
          inBody = True
          self.lines.append( SeqCmd.parse(line, lineno, self.log, self.cmddict) )

    if 'seqid' in self.header:
      self.seqid = self.header['seqid']
    elif self.seqid is None:
      self.log.error('No sequence id present in header.')

    if 'version' in self.header:
      self.version = self.header['version']
    elif self.version is None:
      self.log.warning('No version present in header.  Defaulting to zero (0).')
      self.version = 0
1258097
def get_file_contents(filename):
    
    data = None
    try:
        with open(filename) as pf:
            data = pf.read()
    except IOError:
        # File not found, return None
        pass
    return data
1109706
def open_hdf5(filename, mode='r'):
    
    if isinstance(filename, (h5py.Group, h5py.Dataset)):
        return filename
    if isinstance(filename, FILE_LIKE):
        return h5py.File(filename.name, mode)
    return h5py.File(filename, mode)
167014
def _read_header(filename):
    
    with filename.open('rb') as f:
        h = f.read(HDR_LENGTH).decode()

        header = {}
        for line in h.split('\n'):
            if '=' in line:
                key, value = line.split(' = ')
                key = key.strip()[7:]
                value = value.strip()[:-1]
                header[key] = value

    return header
289156
def hdf5_to_dict(filepath, group='/'):
    
    if not h5py.is_hdf5(filepath):
        raise RuntimeError(filepath, 'is not a valid HDF5 file.')

    with h5py.File(filepath, 'r') as handler:
        dic = walk_hdf5_to_dict(handler[group])
    return dic
185048
def read(self, filename):
        
        f = h5py.File(filename, "r")
        self.data = []
        for i in range(f['data'].attrs['length']):
            self.data.append(f['data']['data_' + str(i)].value)
        self.u = []
        for i in range(f['u'].attrs['length']):
            self.u.append(f['u']['u_' + str(i)].value)
        self.sigma = []
        for i in range(f['sigma'].attrs['length']):
            self.sigma.append(f['sigma']['sigma_' + str(i)].value)
        self.v = []
        for i in range(f['v'].attrs['length']):
            self.v.append(f['v']['v_' + str(i)].value)
        self.stachans = [tuple(stachan.decode('ascii').split('.'))
                         for stachan in f['stachans'].value]
        self.dimension = f['data'].attrs['dimension']
        self.filt_order = f['data'].attrs['filt_order']
        self.highcut = f['data'].attrs['highcut']
        self.lowcut = f['data'].attrs['lowcut']
        self.multiplex = bool(f['data'].attrs['multiplex'])
        self.sampling_rate = f['data'].attrs['sampling_rate']
        if isinstance(f['data'].attrs['name'], str):
            self.name = f['data'].attrs['name']
        else:
            self.name = f['data'].attrs['name'].decode('ascii')
        return self
1190759
def get_group(self, group_id):
    

    group = self.group_id_map.get(group_id)

    if group:
      return group

    self.logger.error('Group ID "%s" is not in datafile.' % group_id)
    self.error_handler.handle_error(exceptions.InvalidGroupException(enums.Errors.INVALID_GROUP_ID_ERROR))
    return None
115220
def get_metadata(self, filename):
        ''''''
        obj = self.bucket.Object(filename)
        checksum = 'md5:{0}'.format(obj.e_tag[1:-1])
        mime = obj.content_type.split(';', 1)[0] if obj.content_type else None
        return {
            'checksum': checksum,
            'size': obj.content_length,
            'mime': mime,
            'modified': obj.last_modified,
        }
895445
def get(self, key):
        
        group = self.get_node(key)
        if group is None:
            raise KeyError('No object named {key} in the file'.format(key=key))
        return self._read_group(group)
579350
def _readfile(cls, filename):
        
        f = codecs.open(filename, encoding='utf-8')
        filedata = f.read()
        f.close()
        tokenz = LM.tokenize(filedata, mode='c')
        #print tokenz
        return tokenz
1094137
def get(cls, filename):
        
        path = os.path.join(SparkFiles.getRootDirectory(), filename)
        return os.path.abspath(path)
65639
def read_features_and_groups(features_path, groups_path):
    ""

    try:
        if not pexists(features_path):
            raise ValueError('non-existent features file')

        if not pexists(groups_path):
            raise ValueError('non-existent groups file')

        if isinstance(features_path, str):
            features = np.genfromtxt(features_path, dtype=float)
        else:
            raise ValueError('features input must be a file path ')

        if isinstance(groups_path, str):
            groups = np.genfromtxt(groups_path, dtype=str)
        else:
            raise ValueError('groups input must be a file path ')

    except:
        raise IOError('error reading the specified features and/or groups.')

    if len(features) != len(groups):
        raise ValueError("lengths of features and groups do not match!")

    return features, groups
1356383
def parseFilename(filename):
    
    # Parse out any extension specified in filename
    _indx = filename.find('[')
    if _indx > 0:
        # Read extension name provided
        _fname = filename[:_indx]
        extn = filename[_indx+1:-1]

        # An extension was provided, so parse it out...
        if repr(extn).find(',') > 1:
            _extns = extn.split(',')
            # Two values given for extension:
            #    for example, 'sci,1' or 'dq,1'
            _extn = [_extns[0],int(_extns[1])]
        elif repr(extn).find('/') > 1:
            # We are working with GEIS group syntax
            _indx = str(extn[:extn.find('/')])
            _extn = [int(_indx)]
        elif isinstance(extn, str):
            # Only one extension value specified...
            if extn.isdigit():
                # We only have an extension number specified as a string...
                _nextn = int(extn)
            else:
                # We only have EXTNAME specified...
                _nextn = extn
            _extn = [_nextn]
        else:
            # Only integer extension number given, or default of 0 is used.
            _extn = [int(extn)]

    else:
        _fname = filename
        _extn = None
    return _fname,_extn
268336
def get_version(filename):
    
    init_py = open(filename).read()
    return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1)
894843
def read_csv(filename):
    

    with open(filename) as file:
        table = list(csv.reader(file))
    m = from_table(table)
    return m