Redefine * to return either a string or a new file list.
166488
def *(other)
      result = @items * other
      case result
      when Array
        FileList.new.import(result)
      else
        result
      end
    end
787217
function (dir, filelist, ext, currentBundleOptions) {
    var path = path || require('path');
    var fs = fs || require('fs');
    var files = fs.readdirSync(dir);
    filelist = filelist || [];
    files.forEach(function (file) {
        if (fs.statSync(path.join(dir, file)).isDirectory()) {
            filelist = walkSync(path.join(dir, file), filelist, ext, currentBundleOptions);
        }
        else {
            if (file.match(new RegExp("." + ext + "$")) && !isExcluded(file, currentBundleOptions))
                filelist.push(path.join(dir, file));
        }
    });
    return filelist;
}
71869
private void refreshFileList()
      throws IOException {
    FileStatus[] files = fileSystem.globStatus(inputDirectoryAndPattern);
    for (FileStatus file : files) {
      String fileName = file.getPath().getName();
      if (!knownFileSet.contains(fileName)) {
        if (endFileNumber != -1) {
          // Sanity check against endFileNumber.
          int newFileIndex = parseFileIndex(fileName);
          Preconditions.checkState(newFileIndex < endFileNumber,
              "Found new file '%s' with index %s, which isn't less than endFileNumber %s!",
              fileName, newFileIndex, endFileNumber);
        }

        logger.atInfo().log(
            "Adding new file '%s' of size %s to knownFileSet.", fileName, file.getLen());
        knownFileSet.add(fileName);
        fileQueue.add(file);
      }
    }
  }
1151696
def myreplace(astr, thefind, thereplace):
    """"""
    alist = astr.split(thefind)
    new_s = alist.split(thereplace)
    return new_s
1104633
def get_diff_text(old, new, filename):
    """"""
    newline = '\n'
    diff = difflib.unified_diff(
        old, new,
        'original/' + filename,
        'fixed/' + filename,
        lineterm=newline)

    text = ''
    for line in diff:
        text += line

        # Work around missing newline (http://bugs.python.org/issue2142).
        if text and not line.endswith(newline):
            text += newline + r'\ No newline at end of file' + newline

    return text
15242
function _browseDir (dir, fileList) {
  fileList || (fileList = [])

  try {
    fs.readdirSync(dir)
      .map(item => _buildFullPath(dir, item))
      .map(item => _addFileOrContinueBrowsing(item, fileList))
  } catch (e) {
    throw new Error(e.message)
  }

  return fileList
}
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
313804
def transform(self, tr_list, files):
        
        singular = False
        if not isinstance(files, list) and not isinstance(files, tuple):
            singular = True
            files = [files]

        for _find, _replace in tr_list:
            files = [opt.replace(_find, _replace) for opt in files]

        if singular:
            return files[0]
        else:
            return files
1007009
function(fileURL, newF){
			var fileName;
			if(this.options && this.options.newFileName && this.options.oldFileName) {
				fileName = newF ? this.options.newFileName : this.options.oldFileName;
			} else {
				fileName = fileURL.split("?")[0]; //$NON-NLS-0$
			}
			return fileName;
		}
598859
private File getFileInRfs(String res) {

        String path = m_destinationPathInRfs + res.substring(0, res.lastIndexOf("/"));
        String fileName = res.substring(res.lastIndexOf("/") + 1);
        return new File(path, fileName);
    }
634758
def wrap_io_or_string(io_or_str)
      return io_or_str if io_or_str.respond_to?(:read_one_char) # Bychar or R
      return R.new(io_or_str) if io_or_str.respond_to?(:read)
      R.new(StringIO.new(io_or_str))
    end
53113
def new_file(self, path: str, checksum: str=None, to_archive: bool=False,
                 tags: List[models.Tag]=None) -> models.File:
        """"""
        new_file = self.File(path=path, checksum=checksum, to_archive=to_archive, tags=tags)
        return new_file
19644
def get_file(db_folder, file_name):
    """"""
    if not os.path.isdir(db_folder):
        return
    file_name = file_name.lower().strip()
    for cand_name in os.listdir(db_folder):
        if cand_name.lower().strip() == file_name:
            return os.path.join(db_folder, cand_name)
672614
def reqfile(filepath):
    """"""
    result = []
    import re
    url_re = re.compile(".+:.+#egg=(.+)")
    with open(filepath, "r") as f:
        for line in f:
            line = line.strip()
            if not line or line.startswith("#"):
                continue
            mo = url_re.match(line)
            if mo is not None:
                line = mo.group(1)
            result.append(line)
    return result
410991
def update_input(filelist, ivmlist=None, removed_files=None):
    
    newfilelist = []

    if removed_files == []:
        return filelist, ivmlist
    else:
        sci_ivm = list(zip(filelist, ivmlist))
        for f in removed_files:
            result=[sci_ivm.remove(t) for t in sci_ivm if t[0] == f ]
        ivmlist = [el[1] for el in sci_ivm]
        newfilelist = [el[0] for el in sci_ivm]
        return newfilelist, ivmlist
1354611
def file_new(input_params={}, always_retry=True, **kwargs):
    
    input_params_cp = Nonce.update_nonce(input_params)
    return DXHTTPRequest('/file/new', input_params_cp, always_retry=always_retry, **kwargs)
1073465
def string_in_list(tmp_str, strlist):
        # type: (AnyStr, List[AnyStr]) -> bool
        """"""
        new_str_list = strlist[:]
        for i, str_in_list in enumerate(new_str_list):
            new_str_list[i] = str_in_list.lower()
        return tmp_str.lower() in new_str_list