Decide what to do with the file.
354998
def detect_file(filename):
    """"""
    image_format = get_image_format(filename)

    if image_format in Settings.formats:
        return image_format

    if image_format in (NONE_FORMAT, ERROR_FORMAT):
        return None

    if Settings.verbose > 1 and not Settings.list_only:
        print(filename, image_format, 'is not a enabled image or '
              'comic archive type.')
    return None
1153351
def process(self):
    """"""
    for _, path in self.state.input:
      self._copy_file_or_directory(path, self._target_directory)
      print('{0:s} -> {1:s}'.format(path, self._target_directory))
1227194
def finished_file(file, lints)
      super

      if lints.any?
        lints.each do |lint|
          linters_with_lints[lint.linter.name] |= [lint.filename]
          linters_lint_count[lint.linter.name] += 1
        end
      end
    end
591110
def delete(self):
        """"""
        self.close()
        if self.does_file_exist():
            os.remove(self.path)
1032697
def save(self, outfile):
        """"""
        if isinstance(outfile, compat.string_type):
            outfile = open(outfile, 'wb')
        outfile.write(self._contents)
438656
def remove_file(path, remove=os.remove, exists=os.path.exists):
    """"""
    try:
        remove(path)
    except OSError:
        if exists(path):
            raise
1250139
def set_file_path(self, path):
        """"""
        self.file_path.delete(0, END)
        self.file_path.insert(0, path)
909707
def choices(self):
        
        print("| {0}K{1}{2}eep the old and .new files, no changes".format(
            self.red, self.endc, self.br))
        print("| {0}O{1}{2}verwrite all old configuration files with new "
              "ones".format(self.red, self.endc, self.br))
        print("|  The old files will be saved with suffix .old")
        print("| {0}R{1}{2}emove all .new files".format(
            self.red, self.endc, self.br))
        print("| {0}P{1}{2}rompt K, O, R, D, M option for each single "
              "file".format(self.red, self.endc, self.br))
        print("| {0}Q{1}{2}uit from menu".format(self.red, self.endc, self.br))
        self.msg.template(78)
        try:
            choose = raw_input("\nWhat would you like to do [K/O/R/P/Q]? ")
        except EOFError:
            print("")
            raise SystemExit()
        print("")
        if choose in ("K", "k"):
            self.keep()
        elif choose in ("O", "o"):
            self.overwrite_all()
        elif choose in ("R", "r"):
            self.remove_all()
        elif choose in ("P", "p"):
            self.prompt()
1334824
def _handle_files(self, data):
        """"""

        initial = data.get("set", False)
        files = data["files"]
        for f in files:
            try:
                fobj = File(
                    self.room,
                    self.conn,
                    f[0],
                    f[1],
                    type=f[2],
                    size=f[3],
                    expire_time=int(f[4]) / 1000,
                    uploader=f[6].get("nick") or f[6].get("user"),
                )
                self.room.filedict = fobj.fid, fobj
                if not initial:
                    self.conn.enqueue_data("file", fobj)
            except Exception:
                import pprint

                LOGGER.exception("bad file")
                pprint.pprint(f)
        if initial:
            self.conn.enqueue_data("initial_files", self.room.files)
461227
private static File findFileOption(String[] args, String option, String name, boolean needed)
        throws ProblemException, ProblemException {
        File file = null;
        for (int i = 0; i<args.length; ++i) {
            if (args[i].equals(option)) {
                if (file != null) {
                    throw new ProblemException("You have already specified the "+name+" file!");
                }
                if (i+1 >= args.length) {
                    throw new ProblemException("You have to specify a file following "+option+".");
                }
                file = new File(args[i+1]);
                if (file.isDirectory()) {
                    throw new ProblemException("\""+args[i+1]+"\" is not a file.");
                }
                if (!file.exists() && needed) {
                    throw new ProblemException("The file \""+args[i+1]+"\" does not exist.");
                }

            }
        }
        if (file == null && needed) {
            throw new ProblemException("You have to specify "+option);
        }
        return file;
    }
439366
def files_ondisk(self, file_objs: models.File) -> set:
        """"""

        return set([ file_obj for file_obj in file_objs if Path(file_obj.full_path).is_file() ])
777241
public void moveThisFile(File file)
    {
        String strDestName = file.getName();
        boolean bMoveFile = true;
        String extension = this.getProperty(EXTENSION);
        String filter = this.getProperty(FILTER);
    	if (extension != null)
    	{
    		bMoveFile = false;
            int iJava = strDestName.lastIndexOf(extension);
            if (iJava != -1) if (iJava == strDestName.length() - extension.length())
            	bMoveFile = true;
    	}
    	if (filter != null)
    	{
            bMoveFile = strDestName.matches(filter);
    	}
    	if ((bMoveFile) && (this.getScanListener() != null))
    		bMoveFile = this.getScanListener().filterFile(file);
        if (bMoveFile)
        {
            String strParentSource = file.getParent();
            this.moveThisFile(file, strDestName, strParentSource);
        }
    }
774929
function processFile() {
  const options = {};
  return (file, callback) => {
    const data = csso.minify(file.data, options).css;
    async.nextTick(callback, null, Object.assign({}, file, { data }));
  };
}
778760
def delete(self):
        """"""
        self._ensure_filename()
        self._close_if_open()
        os.remove(self.filename)
24379
def transfer_file(self):
        """"""
        if self.direction == "put":
            self.put_file()
        elif self.direction == "get":
            self.get_file()
1104621
def process_options options
      options = options.clone
      [:left, :right].each do |key|
        if options.key?(key) && !(options[key].nil?)
          options[key] = File.expand_path options[key]
        end
      end
      options
    end
565693
def do_rm(self, path):
        path = path[0]

        """"""
        self.n.delete(self.current_path + path)
        self.dirs = self.dir_complete()
        self.files = self.file_complete()