Returns the contents of the given list file in an array, if it
 can be found, if not will raise an error
499811
def open_list(file)
      f = clean_path_to(file, allow_missing: true)
      if f
        f = File.open(f, 'r')
      elsif File.exist?("#{Origen.root}/list/#{File.basename(file)}")
        f = File.open("#{Origen.root}/list/#{File.basename(file)}", 'r')
      elsif @last_opened_list_dir && File.exist?("#{@last_opened_list_dir}/#{file}")
        f = File.open("#{@last_opened_list_dir}/#{file}", 'r')
      else
        fail "Could not find list file: #{file}"
      end
      lines = f.readlines
      f.close
      # Before we go save the directory of this list, this will help
      # us to resolve any relative path references to other lists that
      # it may contain
      @last_opened_list_dir = clean_path_to(Pathname.new(f).dirname)
      lines
    end
434095
function parse(contents, retained, parser) {
    var errors = [], data = [], lines = 0;

    // optional parser
    if (!parser) parser = JSON;

    // process each line of the file
    contents.toString().split('\n').forEach(function(line) {
        if (!line) return;
        lines++;
        try {
            data.push(parser.parse(line));
        } catch (e) {
            e.line = line;
            errors.push(e);
        }
    });

    // if no errors/data, don't return an empty array
    var ret = {};
    if (errors.length) ret.errors = errors;
    if (data.length) ret.data = data;

    // if every line failed, probably not line-delimited
    if (errors.length == lines) ret.errors = retained;

    return ret;
}
1064830
def _fileToMatrix(file_name):
    """"""
    # TODO: np.loadtxt() might be an alternative
    #     try:
    if 1 < 3:
        lres = []
        for line in open(file_name, 'r').readlines():
            if len(line) > 0 and line[0] not in ('%', '#'):
                lres.append(list(map(float, line.split())))
        res = lres
    while res != [] and res[0] == []:  # remove further leading empty lines
        del res[0]
    return res
    #     except:
    print('could not read file ' + file_name)
949674
static
	public List<?> getContent(NDArray array, String key){
		Map<String, ?> content = (Map<String, ?>)array.getContent();

		return asJavaList(array, (List<?>)content.get(key));
	}
246049
async def get_contents(self, uri) -> List[Content]:
        
        contents = [
            Content.make(**x)
            for x in await self.services["avContent"]["getContentList"](uri=uri)
        ]
        contentlist = []

        for content in contents:
            if content.contentKind == "directory" and content.index >= 0:
                # print("got directory %s" % content.uri)
                res = await self.get_contents(content.uri)
                contentlist.extend(res)
            else:
                contentlist.append(content)
                # print("%s%s" % (' ' * depth, content))
        return contentlist
941866
def asarray(self, file=None, out=None, **kwargs):
        
        if file is not None:
            if isinstance(file, int):
                return self.imread(self.files[file], **kwargs)
            return self.imread(file, **kwargs)

        im = self.imread(self.files[0], **kwargs)
        shape = self.shape + im.shape
        result = create_output(out, shape, dtype=im.dtype)
        result = result.reshape(-1, *im.shape)
        for index, fname in zip(self._indices, self.files):
            index = [i-j for i, j in zip(index, self._startindex)]
            index = numpy.ravel_multi_index(index, self.shape)
            im = self.imread(fname, **kwargs)
            result[index] = im
        result.shape = shape
        return result
145174
public static int listFind(String list, String value, String delimiter) {
	Array arr = listToArrayTrim(list, delimiter);
	int len = arr.size();
	for (int i = 1; i <= len; i++) {
	    if (arr.get(i, "").equals(value)) return i - 1;
	}

	return -1;
    }
1269622
def file_list( files )
    case files
    when String
      [files]
    when Array
      files
    when Proc
      files.call # result should respond to #each
    else
      []
    end
  end
1352768
def _create_list(value, allow_filename=False):
    
    if isinstance(value, list):
        return value
    elif isinstance(value, string_type):
        if allow_filename and os.path.isfile(value):
            with codecs.open(value, 'r', encoding="utf-8") as handle:
                return handle.read().splitlines()
        return value.split(',')
    else:
        raise ValueError("Can't create list for input {}".format(value))
798310
def get_file_contents(self, pointer=False):
        '''
        
        '''
        if self.pointer:
            if pointer:
                return self.old_pointed
            else:
                return self.old_data
        else:
            return self.old_data
931489
def _read_files(files):
    
    file_contents = [
        (
            _parse_title(file_path),
            _read_file(file_path),
        )
        for file_path in files
    ]
    return file_contents
261743
def all_strings(arr):
        
        if not isinstance([], list):
            raise TypeError("non-list value found where list is expected")
        return all(isinstance(x, str) for x in arr)
1283402
def loadFileList(self):
        """"""
        try:
            data = open(self.filelist_file, 'rb')
        except IOError:
            '''print "No SRTM cached file list. Creating new one!"'''
            if self.offline == 0:
                self.createFileList()
            return
        try:
            self.filelist = pickle.load(data)
            data.close()
            if len(self.filelist) < self.min_filelist_len:
                self.filelist = {}
                if self.offline == 0:
                    self.createFileList()
        except:
            '''print "Unknown error loading cached SRTM file list. Creating new one!"'''
            if self.offline == 0:
                self.createFileList()
695709
def file_to_list(in_file):
    '''  '''
    lines = []
    for line in in_file:
        # Strip new line
        line = line.strip('\n')

        # Ignore empty lines
        if line != '':
            # Ignore comments
            if line[0] != '#':
                lines.append(line)

    return lines
345264
def contents(self, maxlen=70):
        ""
        lines = []
        if len(self._files) == 0:
            print("Empty %s" % self.__class__.__name__)
            return

        fnames = [self._truncate_name(maxlen=maxlen, *k) for k in self._files]
        max_len = max([len(f) for f in fnames])
        for name,v in zip(fnames, self._files.values()):
            mime_type = v[1].get('mime_type', 'no mime type')
            lines.append('%s : %s' % (name.ljust(max_len), mime_type))
        print('\n'.join(lines))
37939
def get_list(file,fmt):
    ''''''
    out=[]
    for i in fmt:
        if i == 'i':
            out.append(get_int(file));
        elif i == 'f' or i == 'd':
            out.append(get_float(file));
        elif i == 's':
            out.append(get_str(file));
        else:
            raise ValueError("Unexpected flag '{}'".format(i));
    return out;
967155
def files_array(files)
      return [] unless files
      files.is_a?(Array) ? files : pattern_to_filelist(files.to_s)
    end