Normalize UNIX path to a native path.
504065
def normpath(path):
    """"""
    normalized = os.path.join(*path.split("/"))
    if os.path.isabs(path):
        return os.path.abspath("/") + normalized
    else:
        return normalized
741342
def __get_path(path):
    """"""
    if not os.path.isabs(path):
        path = os.path.join(os.getcwd(), path)

    return os.path.normpath(path)
1259267
def normpath(path, keep_trailing=False):
    """"""
    new_path = k_paths.normpath(path)
    if keep_trailing and path.endswith("/") and not new_path.endswith("/"):
        new_path = new_path + "/"
    if not new_path.startswith('/'):
        return '/' + new_path
    return new_path
1304630
def normalize_path(path, resolve_symlinks=True):
    # type: (str, bool) -> str
    
    path = expanduser(path)
    if resolve_symlinks:
        path = os.path.realpath(path)
    else:
        path = os.path.abspath(path)
    return os.path.normcase(path)
557742
protected Path normalizePath(final Path parent, final String path) {
        return parent.resolve(path).toAbsolutePath().normalize();
    }
154521
def fixpath(path):
    """"""
    return os.path.normpath(os.path.realpath(os.path.expanduser(path)))
786296
private static String normalizePath(String absPath)
   {
      if (absPath.endsWith("/"))
      {
         return absPath.substring(0, absPath.length() - 1);
      }

      return absPath;
   }
1347093
def _cache_normalize_path(path):
    """"""
    # _module_file calls abspath on every path in sys.path every time it's
    # called; on a larger codebase this easily adds up to half a second just
    # assembling path components. This cache alleviates that.
    try:
        return _NORM_PATH_CACHE[path]
    except KeyError:
        if not path:  # don't cache result for ''
            return _normalize_path(path)
        result = _NORM_PATH_CACHE[path] = _normalize_path(path)
        return result
313436
private static Path normalizePath(Path path) {
		URI uri = path.toUri();
		if (uri.getScheme() == null) {
			try {
				uri = new URI("file", uri.getHost(), uri.getPath(), uri.getFragment());
				path = new Path(uri.toString());
			} catch (URISyntaxException e) {
				throw new IllegalArgumentException("path is invalid", e);
			}
		}
		return path;
	}
1103365
function _normalizePath(path, parent, ancestors) {
    if (path === '/') {
        return path;
    }

    path = path.replace(/\/$/, '');

    // If path begins with / then assume it is independent route
    if (path[0] === '/') {
        return path;
    }

    // If no parent, and route doesn't start with /, then prepend /
    if (! parent) {
        return `/${path}`;
    }

    if (ancestors) {
        return _cleanPath(`${ancestors.join('/')}/${path}`);
    }

    return _cleanPath(`${parent.path}/${path}`);
}
27738
def _fixpath(root, base):
    """"""
    return os.path.abspath(os.path.normpath(os.path.join(root, base)))
1059826
function normalizePath(href, _root, _from) {
	/* istanbul ignore next */
	return href ? path.join(path.isAbsolute(href) ? _root : path.dirname(_from), href) : _from;
}
833230
function normalizeResourcePath(path) {
    path = path || "";
    while (path.startsWith("/"))
        path = path.slice(1);
    while (path.endsWith("/"))
        path = path.slice(0, -1);
    return path;
}
1343053
def _merge_relative_path(dst_path, rel_path):
  """"""
  # Convert rel_path to be relative and normalize it to remove ".", "..", "//",
  # which are valid directories in fileystems like "gs://".
  norm_rel_path = os.path.normpath(rel_path.lstrip("/"))

  if norm_rel_path == ".":
    return dst_path

  # Check that the norm rel path does not starts with "..".
  if norm_rel_path.startswith(".."):
    raise ValueError("Relative path %r is invalid." % rel_path)

  merged = os.path.join(dst_path, norm_rel_path)

  # After merging verify that the merged path keeps the original dst_path.
  if not merged.startswith(dst_path):
    raise ValueError("Relative path %r is invalid. Failed to merge with %r." % (
        rel_path, dst_path))
  return merged
947922
function __normalizePath(remotePath) {
    if (remotePath instanceof Buffer) {
        remotePath = remotePath.toString('utf8');
    }

    if (remotePath === '/') {
        return '';
    }

    if (remotePath.indexOf('./') === 0) {
        return remotePath.replace(/\.\//, '');
    }

    return remotePath;
}
181353
def normalize_path(path)
      raise "abnormal path `#{path}'" if path[0] != ?/
      ret = path.dup

      ret.gsub!(%r{/+}o, '/')                    # //      => /
      while ret.sub!(%r'/\.(?:/|\Z)', '/'); end  # /.      => /
      while ret.sub!(%r'/(?!\.\./)[^/]+/\.\.(?:/|\Z)', '/'); end # /foo/.. => /foo

      raise "abnormal path `#{path}'" if %r{/\.\.(/|\Z)} =~ ret
      ret
    end
916128
def canonical_path(path):
        
        return os.path.normcase(os.path.realpath(os.path.abspath(
            os.path.expanduser(path))))