Create a temp file, write our PID into it.
338708
def make_tempfile(data=None):
    ""
    with tempfile.NamedTemporaryFile(mode='w', delete=False) as temp:
        temp.write(six.text_type(data if data is not None else os.getpid()))
        return temp.name
32073
def write_pidfile(pidfile):
    
    pid = os.getpid()
    if pidfile:
        with open(pidfile, "w", encoding="utf-8") as fobj:
            fobj.write(six.u(str(pid)))
    return pid
137332
def _write_pidfile(self):
        """"""
        flags = os.O_CREAT | os.O_RDWR
        try:
            # Some systems don't have os.O_EXLOCK
            flags = flags | os.O_EXLOCK
        except AttributeError:
            pass
        self._pid_fd = os.open(self.pidfile, flags, 0o666 & ~self.umask)
        os.write(self._pid_fd, str(os.getpid()).encode('utf-8'))
821493
def _write_conf_file():
    
    with open(CONF_FILE, "w") as f:
        f.write(DEFAULT_PROFTPD_CONF)
        logger.debug("'%s' created.", CONF_FILE)
351443
def write_pid_file():
    
    pidfile = os.path.basename(sys.argv[0])[:-3] + '.pid'  # strip .py, add .pid
    with open(pidfile, 'w') as fh:
        fh.write("%d\n" % os.getpid())
        fh.close()
213608
public TempFile createTempFile() throws IOException {
		TempFile tempFile = new TempFile(prefix, suffix, directory);
		synchronized(tempFiles) {
			tempFiles.add(new WeakReference<>(tempFile));
		}
		return tempFile;
	}
1052904
def copy_to_tmp(source):
    
    tmp_dir = tempfile.mkdtemp()
    # Use pathlib because os.path.basename is different depending on whether
    # the path ends in a /
    p = pathlib.Path(source)
    dirname = p.name or 'temp'
    new_dir = os.path.join(tmp_dir, dirname)
    if os.path.isdir(source):
        shutil.copytree(source, new_dir)
    else:
        shutil.copy2(source, new_dir)
    return new_dir
23018
def make_temp(suffix="", prefix="tmp", dir=None):
    
    temporary = tempfile.mkstemp(suffix=suffix, prefix=prefix, dir=dir)
    os.close(temporary[0])
    try:
        yield temporary[1]
    finally:
        os.remove(temporary[1])
930428
def tmp_file(*args, **kwargs):
    
    fileno, path = tempfile.mkstemp(*args, **kwargs)

    # create the file
    with open(path, "w") as f:
        f.write("")

    # yield it
    try:
        yield fileno, path
    finally:
        if os.path.exists(path):
            os.remove(path)
682227
def write_to_temp_file(data, temp_base_name)
      Tempfile.new(temp_base_name, AttachmentMagic.tempfile_path).tap do |tmp|
        tmp.binmode
        tmp.write data
        tmp.close
      end
    end
1100030
def write_pidfile(rundir, process_type=PROCESS_TYPE,
                  name=None, file=None): #@ReservedAssignment
    
    from feat.common.run import get_pidpath
    # don't shadow builtin file
    pid_file = file
    if pid_file is None:
        _ensure_dir(rundir, "rundir")
        filename = get_pidpath(rundir, process_type, name)
        pid_file = open(filename, 'w')
    else:
        filename = pid_file.name
    pid_file.write("%d\n" % (os.getpid(), ))
    pid_file.close()
    os.chmod(filename, 0644)
    return filename
471844
def createTempFile(self, suffix=None, prefix=None, secure=True) -> 'File':
        
        if not secure:
            raise NotImplementedError("We only support secure files at this point")

        # tempfile.mkstemp(suffix=None, prefix=None, dir=None, text=False)

        newFileNum, newFileRealPath = tempfile.mkstemp(
            suffix=suffix, prefix=prefix, dir=self._path)
        os.close(newFileNum)

        relativePath = os.path.relpath(newFileRealPath, self.path)

        file = File(self, pathName=relativePath, exists=True)
        self._files[file.pathName] = file
        return file
1077549
def write_temp_file(content):
        
        f_temp = NamedTemporaryFile(delete=True)
        f_temp.file.write(content)
        f_temp.file.flush()
        return f_temp
197034
def _tmpfile(self, cache_key, use):
    """"""
    with temporary_file(suffix=cache_key.id + use, root_dir=self._cache_root,
                        permissions=self._permissions) as tmpfile:
      yield tmpfile
603697
def write(self):
        """"""
        with open(self.path, 'w') as f:
            self.config.write(f)
529924
def tmpfile(*args, **kwargs):
    
    (fd, fname) = tempfile.mkstemp(*args, **kwargs)
    try:
        yield fname
    finally:
        os.close(fd)
        if os.path.exists(fname):
            os.remove(fname)
49332
def _write_pidfile(pidfile):
    
    pid = str(os.getpid())
    handle = open(pidfile, 'w')
    try:
        handle.write("%s\n" % pid)
    finally:
        handle.close()