Computes the base path for a given file.
162440
def _file_path(self, container: Container, fn: str) -> str:
        
        fn = self.resolve(container, fn)
        assert fn[0] == '/'
        fn = fn[1:]
        path = "files/{}/{}".format(container.uid, fn)
        return path
396074
function ( path, base )
{ let filename
  let start = path.substr ( 0, 2 )
  if ( path.charAt ( 0 )  === '/' )
  { // absolute path
    filename = path
  }
  else if ( start == './' || start == '..' || path == '.' )
  { filename = lpath.resolve ( base, path )
  }
  else
  { // funky node_modules path not supported
    throw new Error
    ( `Cannot watch path '${ path }'  ( not a relative or absolute path ) ` )
  }
  return filename
}
1360085
def path_to( file )
      path = Pathname( file )
              .expand_path
              .relative_path_from( root )
              .to_path

      path.start_with?( '.' ) ? path : File.join( '.', path )
    end
92781
function (path, basePath) {
        if (!basePath || path.match(/^\//)) {
            return path;
        }
        var pathParts = path.split('/');
        var basePathParts = basePath.split('/');

        var item = pathParts[0];
        while(item === '.' || item === '..') {
            if (item === '..') {
                basePathParts.pop();
            }
            pathParts.shift();
            item = pathParts[0];
        }
        return basePathParts.join('/') + '/' + pathParts.join('/');
    }
790503
function relativePath(file, pattern) {
    var length = file.length,
        x;

    pattern = path.normalize(pattern);
    file = path.normalize(file);

    for (x = 0; x < length; x += 1) {
        if (file[x] !== pattern[x]) {
            return file.substr(x);
        }
    }

    return path.basename(file);
}
503324
public function basePath($file = '')
    {
        $basePath = dirname($_SERVER['PHP_SELF']);
        if ($basePath != '/') {
            $basePath .= '/';
        }

        if (! empty($file)) {
            $basePath.= ltrim($file, '/');
        }

        return $basePath;
    }
741342
def __get_path(path):
    """"""
    if not os.path.isabs(path):
        path = os.path.join(os.getcwd(), path)

    return os.path.normpath(path)
1010797
def get_root_path():
    """"""
    return os.path.realpath(os.path.join(os.path.dirname(__file__), os.pardir))
822911
public String relativePath(File base, File nested) throws IOException {
        String basePath = base.getCanonicalPath();
        String nestedPath = nested.getCanonicalPath();
        if (nestedPath.equals(basePath)) {
            return "";
        } else if (nestedPath.startsWith(basePath)) {
            return nestedPath.substring(basePath.length() + 1);
        } else {
            return nestedPath;
        }
    }
467214
def relpath(path, start=posixpath.curdir):
    """"""
    if not path:
        raise ValueError("no path specified")

    start_list = posixpath.abspath(start).split(posixpath.sep)
    path_list = posixpath.abspath(path).split(posixpath.sep)

    # Work out how much of the filepath is shared by start and path.
    i = len(posixpath.commonprefix([start_list, path_list]))

    rel_list = [posixpath.pardir] * (len(start_list) - i) + path_list[i:]
    if not rel_list:
        return posixpath.curdir
    return posixpath.join(*rel_list)
830501
def find_base_path_and_format(main_path, formats):
    """"""
    for fmt in formats:
        try:
            return base_path(main_path, fmt), fmt
        except InconsistentPath:
            continue

    raise InconsistentPath(u"Path '{}' matches none of the export formats. "
                           "Please make sure that jupytext.formats covers the current file "
                           "(e.g. add '{}' to the export formats)".format(main_path,
                                                                          os.path.splitext(main_path)[1][1:]))
1070309
def filepath(self, filename):
        """"""

        return os.path.join(self.node.full_path, filename)
1361921
private static Path toPath(@Nonnull File file) throws IOException {
        try {
            return file.toPath();
        } catch (InvalidPathException e) {
            throw new IOException(e);
        }
    }
1125702
private static String basename(final File file) {
        final String name = file.getName();
        if(name.contains(".")) {
            return name.substring(0, name.lastIndexOf("."));
        }
        return name;
    }
1088234
def base(self, path1, *paths):
        
        root_dir = self.configuration.root_dir
        return root_dir.relpathto(path1.joinpath(*paths))
722757
def basename(self):
        ''''''
        return os.path.basename(self.read_file)[:-len(self._get_extension(self.read_file))]
2906
private String getPathRelativeToSourceSet(File file) {
    Path absolutePath = Paths.get(file.getAbsolutePath());
    Path basePath = Paths.get(task.getProject().file("src").getAbsolutePath() + File.separator + getSourceSetNameFromFile(file));
    return basePath.relativize(absolutePath).toString();
  }