Get the writing path of a file.
776323
def get_path(dest, file, cwd = None):
	""""""
	if callable(dest):
		return dest(file)

	if not cwd:
		cwd = file.cwd
	if not os.path.isabs(dest):
		dest = os.path.join(cwd, dest)

	relative = os.path.relpath(file.path, file.base)
	return os.path.join(dest, relative)
1239246
def _get_filepath(self, ext):
        
        filename = ("%s%d.%s" % (self.FILE_PREFIX, self.page_nb + 1, ext))
        return self.fs.join(self.doc.path, filename)
1309482
def dirpath(self):
        """"""
        if self.isfile():
            return Path(op.dirname(self._fspath))
        else:
            return Path(self)
678980
def write_str2file(pathname, astr):
    """"""
    fname = pathname
    fhandle = open(fname, 'wb')
    fhandle.write(astr)
    fhandle.close()
27810
private synchronized Path getWritePath() throws IOException {
    if (pathToWriteTo == null) {
      // If we have not yet written before, check existence of files.
      final boolean originalExists = fileSystem.exists(changeLogPath);
      final boolean altExists = fileSystem.exists(changeLogAltPath);

      if (originalExists && altExists) {
        final FileStatus originalStatus = fileSystem.getFileStatus(changeLogPath);
        final FileStatus altStatus = fileSystem.getFileStatus(changeLogAltPath);

        // Return the shorter file.
        // TODO[JIRA REEF-1413]: This approach will not be able to work in REEF-1413.
        // TODO[JIRA REEF-1413]: Note that we cannot use last modified time because Azure blob's HDFS API only
        // TODO[JIRA REEF-1413]: supports time resolution up to a second.
        final long originalLen = originalStatus.getLen();
        final long altLen = altStatus.getLen();

        if (originalLen < altLen) {
          pathToWriteTo = changeLogPath;
        } else {
          pathToWriteTo = changeLogAltPath;
        }
      } else if (originalExists) {
        // Return the file that does not exist.
        pathToWriteTo = changeLogAltPath;
      } else {
        pathToWriteTo = changeLogPath;
      }
    }

    final Path returnPath = pathToWriteTo;
    pathToWriteTo = getAlternativePath(pathToWriteTo);

    return returnPath;
  }
1072995
function getPathToRoot(filePath) {
	filePath = filePath.replace(/\\/g, "/");

	var lastSlash = filePath.lastIndexOf("/");
	// strip out file name from the path
	filePath = lastSlash >= 0 ? filePath.slice(0, lastSlash + 1) : "";

	if (!filePath) {
		return "";
	}
    // now "folder1/folder2/file.ext" became "folder1/folder2/"
	filePath = filePath.replace(/[^/]+/g, "..");
	if (filePath.charAt(0) === "/") {
		filePath = filePath.slice(1);
	}
	return filePath;
}
908230
def path(self):
        """"""
        out = self.datetime.strftime("%Y-%m-%d")
        out += " "
        ssm = (
            self.datetime - self.datetime.replace(hour=0, minute=0, second=0, microsecond=0)
        ).total_seconds()
        out += str(int(ssm)).zfill(5)
        return out
80201
def get_file_path(dotted_path, extension='json'):
    
    # If the operating system's file path seperator character is in the string
    if os.sep in dotted_path or '/' in dotted_path:
        # Assume the path is a valid file path
        return dotted_path

    parts = dotted_path.split('.')
    if parts[0] == 'chatterbot':
        parts.pop(0)
        parts[0] = DATA_DIRECTORY

    corpus_path = os.path.join(*parts)

    if os.path.exists(corpus_path + '.{}'.format(extension)):
        corpus_path += '.{}'.format(extension)

    return corpus_path
978124
def get_path(filename):
    
    path = abspath(filename) if os.path.isdir(filename) else dirname(abspath(filename))
    return path
741627
def _find_vpath(self):
        """"""
        with open(self.path, 'r') as file_handle:

            for count, line in enumerate(file_handle):

                match = self.read_pattern.match(line)
                if match:

                    return match.group(1), count

        return None, None
1070309
def filepath(self, filename):
        """"""

        return os.path.join(self.node.full_path, filename)
899919
def read_file_to_string(path):
  """"""
  bytes_string = tf.gfile.Open(path, 'r').read()
  return dlutils.python_portable_string(bytes_string)
285284
def write_to_textfile(path, registry):
    """"""
    tmppath = '%s.%s.%s' % (path, os.getpid(), threading.current_thread().ident)
    with open(tmppath, 'wb') as f:
        f.write(generate_latest(registry))
    # rename(2) is atomic.
    os.rename(tmppath, path)
779296
def path(self):
        """"""
        if isinstance(self._rlist.path_or_fd(), int):
            raise ValueError("Path queried although mapping was applied to a file descriptor")
        # END handle type
        return self._rlist.path_or_fd()
933118
def write_file(path, data):
    """"""
    with open(path, 'w') as f:
        log.debug('setting %s contents:\n%s', path, data)
        f.write(data)
    return f
504548
def get_runtime_path(self, filename=None):
        """"""
        return self.get_path(prefix=settings.FLOW_EXECUTOR['RUNTIME_DIR'], filename=filename)
1220663
def write(self, string):
        """"""
        self.make_dir()
        with open(self.path, "w") as f:
            if not string.endswith("\n"):
                return f.write(string + "\n")
            else:
                return f.write(string)